mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Browser XSLT support. Optimize for size.
svn path=/trunk/; revision=16855
This commit is contained in:
parent
3b17d563fa
commit
e4bb3b1573
4 changed files with 62 additions and 48 deletions
|
@ -21,7 +21,7 @@
|
||||||
<property name="reactos.dir" value="reactos" />
|
<property name="reactos.dir" value="reactos" />
|
||||||
<property name="apistatus.xsl" value="rapistatus.xsl" />
|
<property name="apistatus.xsl" value="rapistatus.xsl" />
|
||||||
<property name="apistatus.xml" value="rapistatus.xml" />
|
<property name="apistatus.xml" value="rapistatus.xml" />
|
||||||
<property name="apistatus.html" value="index.html" />
|
<property name="apistatus.html" value="index2.html" />
|
||||||
<include buildfile="config.include" />
|
<include buildfile="config.include" />
|
||||||
|
|
||||||
<target name="publish">
|
<target name="publish">
|
||||||
|
|
|
@ -76,22 +76,28 @@
|
||||||
<xsl:call-template name="ELEMENT">
|
<xsl:call-template name="ELEMENT">
|
||||||
<xsl:with-param name="class">c</xsl:with-param>
|
<xsl:with-param name="class">c</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates>
|
||||||
|
<xsl:with-param name="base"><xsl:value-of select="@base"/></xsl:with-param>
|
||||||
|
</xsl:apply-templates>
|
||||||
</DIV>
|
</DIV>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- function -->
|
<!-- function -->
|
||||||
<xsl:template match="functions">
|
<xsl:template match="functions">
|
||||||
<xsl:apply-templates select="function">
|
<xsl:param name="base"/>
|
||||||
<xsl:sort select="@name"/>
|
<xsl:apply-templates select="f">
|
||||||
|
<xsl:sort select="@n"/>
|
||||||
|
<xsl:with-param name="base"><xsl:value-of select="$base"/></xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="functions/function">
|
<xsl:template match="functions/f">
|
||||||
|
<xsl:param name="base"/>
|
||||||
<DIV>
|
<DIV>
|
||||||
<xsl:call-template name="ELEMENT">
|
<xsl:call-template name="ELEMENT">
|
||||||
<xsl:with-param name="class">f</xsl:with-param>
|
<xsl:with-param name="class">f</xsl:with-param>
|
||||||
|
<xsl:with-param name="base"><xsl:value-of select="$base"/></xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</DIV>
|
</DIV>
|
||||||
|
@ -102,6 +108,7 @@
|
||||||
|
|
||||||
<xsl:template name="ELEMENT">
|
<xsl:template name="ELEMENT">
|
||||||
<xsl:param name="class"/>
|
<xsl:param name="class"/>
|
||||||
|
<xsl:param name="base"/>
|
||||||
<xsl:param name="image"/>
|
<xsl:param name="image"/>
|
||||||
<xsl:attribute name="class">
|
<xsl:attribute name="class">
|
||||||
<xsl:value-of select="$class"/>
|
<xsl:value-of select="$class"/>
|
||||||
|
@ -109,10 +116,10 @@
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:call-template name="toggle"/>
|
<xsl:call-template name="toggle"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="./node() and local-name() != 'component' and @implemented = 'true'">
|
<xsl:when test="./node() and local-name() != 'component' and @i = 'true'">
|
||||||
<img src="i.gif" class="i"/>
|
<img src="i.gif" class="i"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="./node() and local-name() != 'component' and @implemented = 'false'">
|
<xsl:when test="./node() and local-name() != 'component' and @i = 'false'">
|
||||||
<img src="u.gif" class="u"/>
|
<img src="u.gif" class="u"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="./node() and local-name() = 'component' and @complete >= 100">
|
<xsl:when test="./node() and local-name() = 'component' and @complete >= 100">
|
||||||
|
@ -131,7 +138,10 @@
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:call-template name="name"/>
|
<xsl:call-template name="name"/>
|
||||||
<xsl:call-template name="file"/>
|
<xsl:call-template name="n"/>
|
||||||
|
<xsl:call-template name="file">
|
||||||
|
<xsl:with-param name="base"><xsl:value-of select="$base"/></xsl:with-param>
|
||||||
|
</xsl:call-template>
|
||||||
<xsl:call-template name="status"/>
|
<xsl:call-template name="status"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
@ -173,9 +183,16 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="n">
|
||||||
|
<xsl:if test="@n">
|
||||||
|
<SPAN class="l"><xsl:value-of select="@n"/></SPAN>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="file">
|
<xsl:template name="file">
|
||||||
<xsl:if test="@file">
|
<xsl:param name="base"/>
|
||||||
<SPAN class="h"><xsl:value-of select="@file"/></SPAN>
|
<xsl:if test="@f">
|
||||||
|
<SPAN class="h"><xsl:value-of select="$base"/><xsl:value-of select="@f"/></SPAN>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,7 @@ skip_to_next_name(char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a path and filename so it is of the format [cvs-module][directory][filename].
|
// Build a path and filename so it is of the format [module][directory][filename].
|
||||||
// Also convert all backslashes into forward slashes.
|
// Also convert all backslashes into forward slashes.
|
||||||
static void
|
static void
|
||||||
get_filename(char *cvspath, char *filename, char *result)
|
get_filename(char *cvspath, char *filename, char *result)
|
||||||
|
@ -659,10 +659,19 @@ compare_api_order(PAPI_INFO p, PAPI_INFO q)
|
||||||
return strcmp(p->name, q->name);
|
return strcmp(p->name, q->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
get_filename_without_base(char *component_base,
|
||||||
|
char *filename)
|
||||||
|
{
|
||||||
|
return &filename[strlen(component_base)];
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
generate_xml_for_component(char *component_name)
|
generate_xml_for_component(char *component_name,
|
||||||
|
char *component_base)
|
||||||
{
|
{
|
||||||
PAPI_INFO api_info;
|
PAPI_INFO api_info;
|
||||||
|
char canonical_base[MAX_PATH];
|
||||||
char buf[200];
|
char buf[200];
|
||||||
int complete;
|
int complete;
|
||||||
int implemented_total;
|
int implemented_total;
|
||||||
|
@ -678,28 +687,23 @@ generate_xml_for_component(char *component_name)
|
||||||
while (api_info != NULL)
|
while (api_info != NULL)
|
||||||
{
|
{
|
||||||
if (api_info->tag_id == TAG_IMPLEMENTED)
|
if (api_info->tag_id == TAG_IMPLEMENTED)
|
||||||
{
|
|
||||||
implemented_total ++;
|
implemented_total ++;
|
||||||
}
|
|
||||||
else if (api_info->tag_id == TAG_UNIMPLEMENTED)
|
else if (api_info->tag_id == TAG_UNIMPLEMENTED)
|
||||||
{
|
|
||||||
unimplemented_total ++;
|
unimplemented_total ++;
|
||||||
}
|
|
||||||
|
|
||||||
api_info = api_info->next;
|
api_info = api_info->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (implemented_total + unimplemented_total > 0)
|
if (implemented_total + unimplemented_total > 0)
|
||||||
{
|
|
||||||
complete = ((implemented_total) * 100) / (implemented_total + unimplemented_total);
|
complete = ((implemented_total) * 100) / (implemented_total + unimplemented_total);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
complete = 100;
|
complete = 100;
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(buf, "<component name=\"%s\" complete=\"%d\" implemented_total=\"%d\" unimplemented_total=\"%d\">",
|
strcpy(canonical_base, component_base);
|
||||||
component_name, complete, implemented_total, unimplemented_total);
|
path_to_url(canonical_base);
|
||||||
|
|
||||||
|
sprintf(buf, "<component name=\"%s\" base=\"%s\" complete=\"%d\" implemented_total=\"%d\" unimplemented_total=\"%d\">",
|
||||||
|
component_name, canonical_base, complete, implemented_total, unimplemented_total);
|
||||||
write_line(buf);
|
write_line(buf);
|
||||||
|
|
||||||
if (api_info_list != NULL)
|
if (api_info_list != NULL)
|
||||||
|
@ -709,12 +713,12 @@ generate_xml_for_component(char *component_name)
|
||||||
api_info = api_info_list;
|
api_info = api_info_list;
|
||||||
while (api_info != NULL)
|
while (api_info != NULL)
|
||||||
{
|
{
|
||||||
sprintf(buf, "<function name=\"%s\" implemented=\"%s\" file=\"%s\">",
|
sprintf(buf, "<f n=\"%s\" i=\"%s\" f=\"%s\" />",
|
||||||
api_info->name,
|
api_info->name,
|
||||||
api_info->tag_id == TAG_IMPLEMENTED ? "true" : "false",
|
api_info->tag_id == TAG_IMPLEMENTED ? "true" : "false",
|
||||||
api_info->filename);
|
get_filename_without_base(component_base,
|
||||||
|
api_info->filename));
|
||||||
write_line(buf);
|
write_line(buf);
|
||||||
write_line("</function>");
|
|
||||||
api_info = api_info->next;
|
api_info = api_info->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,38 +787,26 @@ read_input_file(char *input_file)
|
||||||
|
|
||||||
/* Skip whitespace and eol characters */
|
/* Skip whitespace and eol characters */
|
||||||
while ((index < size) && (is_whitespace(buffer[index]) || (is_eol_char(buffer[index]))))
|
while ((index < size) && (is_whitespace(buffer[index]) || (is_eol_char(buffer[index]))))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
if ((file_pointer < size) && (buffer[index] == '\n'))
|
if ((file_pointer < size) && (buffer[index] == '\n'))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
|
|
||||||
if (buffer[index] == ';')
|
if (buffer[index] == ';')
|
||||||
{
|
{
|
||||||
/* Skip comments */
|
/* Skip comments */
|
||||||
while ((index < size) && (!is_eol_char(buffer[index])))
|
while ((index < size) && (!is_eol_char(buffer[index])))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
if ((index < size) && (buffer[index] == '\n'))
|
if ((index < size) && (buffer[index] == '\n'))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get component name */
|
/* Get component name */
|
||||||
start = index;
|
start = index;
|
||||||
while ((index < size) && (!is_whitespace(buffer[index])))
|
while ((index < size) && (!is_whitespace(buffer[index])))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
if (index >= size)
|
if (index >= size)
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
len = index - start;
|
len = index - start;
|
||||||
strncpy(component_name, &buffer[start], len);
|
strncpy(component_name, &buffer[start], len);
|
||||||
|
@ -822,20 +814,14 @@ read_input_file(char *input_file)
|
||||||
|
|
||||||
/* Skip whitespace */
|
/* Skip whitespace */
|
||||||
while ((index < size) && (is_whitespace(buffer[index])))
|
while ((index < size) && (is_whitespace(buffer[index])))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
if (index >= size)
|
if (index >= size)
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/* Get component path */
|
/* Get component path */
|
||||||
start = index;
|
start = index;
|
||||||
while ((index < size) && (!is_whitespace(buffer[index]) && !is_eol_char(buffer[index])))
|
while ((index < size) && (!is_whitespace(buffer[index]) && !is_eol_char(buffer[index])))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
|
|
||||||
len = index - start;
|
len = index - start;
|
||||||
strncpy(component_path, &buffer[start], len);
|
strncpy(component_path, &buffer[start], len);
|
||||||
|
@ -851,20 +837,17 @@ read_input_file(char *input_file)
|
||||||
|
|
||||||
/* Skip to end of line */
|
/* Skip to end of line */
|
||||||
while ((index < size) && (!is_eol_char(buffer[index])))
|
while ((index < size) && (!is_eol_char(buffer[index])))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
if ((index < size) && (buffer[index] == '\n'))
|
if ((index < size) && (buffer[index] == '\n'))
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
|
||||||
|
|
||||||
canonical_path = convert_path(component_path);
|
canonical_path = convert_path(component_path);
|
||||||
if (canonical_path != NULL)
|
if (canonical_path != NULL)
|
||||||
{
|
{
|
||||||
process_directory(canonical_path, canonical_path);
|
process_directory(canonical_path, canonical_path);
|
||||||
free(canonical_path);
|
free(canonical_path);
|
||||||
generate_xml_for_component(component_name);
|
generate_xml_for_component(component_name,
|
||||||
|
component_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
14
reactos/tools/rgenstat/web/index.html
Normal file
14
reactos/tools/rgenstat/web/index.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
If your browser do not support XSLT click <a href="index2.html">here</a>.
|
||||||
|
<script type="text/javascript">
|
||||||
|
var xml = new ActiveXObject("Microsoft.XMLDOM")
|
||||||
|
xml.async = false
|
||||||
|
xml.load("rapistatus.xml")
|
||||||
|
var xsl = new ActiveXObject("Microsoft.XMLDOM")
|
||||||
|
xsl.async = false
|
||||||
|
xsl.load("rapistatus.xsl")
|
||||||
|
document.write(xml.transformNode(xsl))
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue