From 19f0d683384723ab0ed729d99b94ff20da5374fc Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Fri, 11 Jul 2003 13:05:10 +0000 Subject: [PATCH] 2003-07-11 Casper S. Hornstrup * tools/rgenstat/rgenstat.c (API_INFO): Add filename field. (path_to_url, get_filename): New functions. (parse_file, process_directory): Build cvs path. (generate_xml_for_component): Set file attribute on a function. * tools/rgenstat/web/rapistatus.css (.h): New class. * tools/rgenstat/web/rapistatus.js (clickHandler): Go to the file in ViewCVS on click on a function. * tools/rgenstat/web/rapistatus.xsl: Handle file attribute. svn path=/trunk/; revision=5071 --- reactos/ChangeLog | 11 ++++ reactos/tools/rgenstat/rgenstat.c | 77 ++++++++++++++++++----- reactos/tools/rgenstat/web/rapistatus.css | 5 ++ reactos/tools/rgenstat/web/rapistatus.js | 19 ++++++ reactos/tools/rgenstat/web/rapistatus.xsl | 7 +++ 5 files changed, 103 insertions(+), 16 deletions(-) diff --git a/reactos/ChangeLog b/reactos/ChangeLog index b7d28ab3685..d26aa882cbc 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,14 @@ +2003-07-11 Casper S. Hornstrup + + * tools/rgenstat/rgenstat.c (API_INFO): Add filename field. + (path_to_url, get_filename): New functions. + (parse_file, process_directory): Build cvs path. + (generate_xml_for_component): Set file attribute on a function. + * tools/rgenstat/web/rapistatus.css (.h): New class. + * tools/rgenstat/web/rapistatus.js (clickHandler): Go to the file in + ViewCVS on click on a function. + * tools/rgenstat/web/rapistatus.xsl: Handle file attribute. + 2003-07-11 Casper S. Hornstrup * subsys/win32k/objects/region.c (W32kFillRgn): Fix syntax error. diff --git a/reactos/tools/rgenstat/rgenstat.c b/reactos/tools/rgenstat/rgenstat.c index eef751e5927..16fa54fb3b9 100755 --- a/reactos/tools/rgenstat/rgenstat.c +++ b/reactos/tools/rgenstat/rgenstat.c @@ -40,6 +40,7 @@ typedef struct _API_INFO struct _API_INFO *next; int tag_id; char name[100]; + char filename[MAX_PATH]; } API_INFO, *PAPI_INFO; @@ -87,6 +88,23 @@ convert_path(char* origpath) return(newpath); } +static char* +path_to_url(char* path) +{ + int i; + + i = 0; + while (path[i] != 0) + { + if (path[i] == '\\') + { + path[i] = '/'; + } + i++; + } + return(path); +} + static void write_line(char *line) { @@ -380,15 +398,25 @@ skip_to_next_name(char *name) return 0; } +// Build a path and filename so it is of the format [cvs-module][directory][filename]. +// Also convert all backslashes into forward slashes. static void -parse_file(char *filename) +get_filename(char *cvspath, char *filename, char *result) +{ + strcpy(result, cvspath); + strcat(result, filename); + path_to_url(result); +} + +static void +parse_file(char *fullname, char *cvspath, char *filename) { PAPI_INFO api_info; char prev[200]; char name[200]; int tag_id; - read_file(filename); + read_file(fullname); prev[0] = 0; do @@ -407,7 +435,7 @@ parse_file(char *filename) if (strlen(name) == 0) { printf("Warning: empty function name in file %s. Previous function name was %s.\n", - filename, prev); + fullname, prev); } api_info = malloc(sizeof(API_INFO)); if (api_info == NULL) @@ -419,6 +447,8 @@ parse_file(char *filename) api_info->tag_id = tag_id; strcpy(api_info->name, name); + get_filename(cvspath, filename, api_info->filename); + api_info->next = api_info_list; api_info_list = api_info; strcpy(prev, name); @@ -432,14 +462,13 @@ parse_file(char *filename) /* Win32 version */ static void -process_directory (char *path) +process_directory (char *path, char *cvspath) { struct _finddata_t f; int findhandle; char searchbuf[MAX_PATH]; char buf[MAX_PATH]; - - printf("Processing '%s'\n", path); + char newcvspath[MAX_PATH]; strcpy(searchbuf, path); strcat(searchbuf, "*.*"); @@ -456,7 +485,12 @@ process_directory (char *path) strcpy(buf, path); strcat(buf, f.name); strcat(buf, DIR_SEPARATOR_STRING); - process_directory(buf); + + strcpy(newcvspath, cvspath); + strcat(newcvspath, f.name); + strcat(newcvspath, '/'); + + process_directory(buf, cvspath, f.name); } continue; } @@ -470,7 +504,7 @@ process_directory (char *path) continue; } - parse_file(buf); + parse_file(buf, cvspath, f.name); } while (_findnext(findhandle, &f) == 0); _findclose(findhandle); @@ -486,12 +520,13 @@ process_directory (char *path) /* Linux version */ static void -process_directory (char *path) +process_directory (char *path, char *cvspath) { DIR *dirp; struct dirent *entry; struct stat stbuf; char buf[MAX_PATH]; + char newcvspath[MAX_PATH]; #ifdef HAVE_D_TYPE dirp = opendir(path); @@ -527,7 +562,11 @@ process_directory (char *path) if (S_ISDIR(stbuf.st_mode)) { - process_directory(buf); + strcpy(newcvspath, cvspath); + strcat(newcvspath, f.name); + strcat(newcvspath, '/'); + + process_directory(buf, newcvspath); continue; } @@ -537,7 +576,7 @@ process_directory (char *path) continue; } - parse_file(buf); + parse_file(buf, cvspath, entry->d_name); } } closedir(dirp); @@ -581,7 +620,11 @@ process_directory (char *path) if (S_ISDIR(stbuf.st_mode)) { - process_directory(buf); + strcpy(newcvspath, cvspath); + strcat(newcvspath, entry->d_name); + strcat(newcvspath, "/"); + + process_directory(buf, newcvspath); continue; } @@ -591,7 +634,7 @@ process_directory (char *path) continue; } - parse_file(buf); + parse_file(buf, cvspath, entry->d_name); } closedir(dirp); } @@ -667,8 +710,10 @@ generate_xml_for_component(char *component_name) api_info = api_info_list; while (api_info != NULL) { - sprintf(buf, "", - api_info->name, api_info->tag_id == TAG_IMPLEMENTED ? "true" : "false"); + sprintf(buf, "", + api_info->name, + api_info->tag_id == TAG_IMPLEMENTED ? "true" : "false", + api_info->filename); write_line(buf); write_line(""); api_info = api_info->next; @@ -818,7 +863,7 @@ read_input_file(char *input_file) canonical_path = convert_path(component_path); if (canonical_path != NULL) { - process_directory(canonical_path); + process_directory(canonical_path, canonical_path); free(canonical_path); generate_xml_for_component(component_name); } diff --git a/reactos/tools/rgenstat/web/rapistatus.css b/reactos/tools/rgenstat/web/rapistatus.css index 52965a119c0..a429226f4bb 100755 --- a/reactos/tools/rgenstat/web/rapistatus.css +++ b/reactos/tools/rgenstat/web/rapistatus.css @@ -18,6 +18,11 @@ display: none; } +.h +{ + display: none; +} + .t { cursor: pointer; diff --git a/reactos/tools/rgenstat/web/rapistatus.js b/reactos/tools/rgenstat/web/rapistatus.js index 55ba8c976e7..1ae597f8643 100755 --- a/reactos/tools/rgenstat/web/rapistatus.js +++ b/reactos/tools/rgenstat/web/rapistatus.js @@ -145,6 +145,25 @@ function clickHandler (evt) if (elt.className == 'l') // label { + var strName; + + eltDiv = getParentDiv (elt); + var strEltClass = eltDiv.className; + if (strEltClass.charAt (strEltClass.length - 1) == '_') + strEltClass = strEltClass.slice (0, strEltClass.length - 1); + strName = getName (eltDiv); + + if (strEltClass == 'f') // Function + { + var strFilename = elt.nextSibling; + if (strFilename && strFilename.innerText) + { + var strRoot = 'http://mok.lvcm.com/cgi-bin/reactos/ros-cvs/~checkout~/'; + var strExtra = '?content-type=text/plain'; + + window.open (strRoot + strFilename.innerText + strExtra, 'CVS'); + } + } } else { diff --git a/reactos/tools/rgenstat/web/rapistatus.xsl b/reactos/tools/rgenstat/web/rapistatus.xsl index 8c6bbb74506..d429ec439d0 100755 --- a/reactos/tools/rgenstat/web/rapistatus.xsl +++ b/reactos/tools/rgenstat/web/rapistatus.xsl @@ -131,6 +131,7 @@ + @@ -172,4 +173,10 @@ + + + + + + -- 2.17.1