2003-07-11 Casper S. Hornstrup <chorns@users.sourceforge.net>

* 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
This commit is contained in:
Casper Hornstrup 2003-07-11 13:05:10 +00:00
parent da0c79cd27
commit 19f0d68338
5 changed files with 103 additions and 16 deletions

View file

@ -1,3 +1,14 @@
2003-07-11 Casper S. Hornstrup <chorns@users.sourceforge.net>
* 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 <chorns@users.sourceforge.net>
* subsys/win32k/objects/region.c (W32kFillRgn): Fix syntax error.

View file

@ -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, "<function name=\"%s\" implemented=\"%s\">",
api_info->name, api_info->tag_id == TAG_IMPLEMENTED ? "true" : "false");
sprintf(buf, "<function name=\"%s\" implemented=\"%s\" file=\"%s\">",
api_info->name,
api_info->tag_id == TAG_IMPLEMENTED ? "true" : "false",
api_info->filename);
write_line(buf);
write_line("</function>");
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);
}

View file

@ -18,6 +18,11 @@
display: none;
}
.h
{
display: none;
}
.t
{
cursor: pointer;

View file

@ -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
{

View file

@ -131,6 +131,7 @@
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="name"/>
<xsl:call-template name="file"/>
<xsl:call-template name="status"/>
</xsl:template>
@ -172,4 +173,10 @@
</xsl:if>
</xsl:template>
<xsl:template name="file">
<xsl:if test="@file">
<SPAN class="h"><xsl:value-of select="@file"/></SPAN>
</xsl:if>
</xsl:template>
</xsl:stylesheet>