ICU-7373 add enums

X-SVN-Rev: 28933
This commit is contained in:
Steven R. Loomis 2010-10-28 00:08:31 +00:00
parent 88da3e392c
commit 3b9fe8ba09
3 changed files with 187 additions and 37 deletions

View File

@ -42,6 +42,8 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.sun.xml.internal.fastinfoset.stax.events.XMLConstants;
/**
A utility to report the status change between two ICU releases
@ -204,6 +206,8 @@ public class StableAPI {
}
}
private static boolean didWarnSuperTrim = false;
private static String trimICU(String ver) {
final String ICU_ = ICU_SPACE_PREFIX;
final String ICU = "ICU";
@ -220,7 +224,11 @@ public class StableAPI {
int n;
for(n=ver.length()-1;n>0 && ((ver.charAt(n)=='.') || Character.isDigit(ver.charAt(n))) ;n--)
;
warn("super-trimming: '" + ver + "'");
warn("Trimming extraneous 'version' text: '" + ver + "'");
if(!didWarnSuperTrim) {
didWarnSuperTrim = true;
warn("Please ONLY use: '@whatever ICU X.Y.Z'");
}
if(n>0) {
ver = ver.substring(n+1).trim();
}
@ -361,7 +369,8 @@ public class StableAPI {
static String getAttr(Node node, String attrName){
if(node.getAttributes()==null && node.getNodeType()==3) {
return "(text node 3)";
// return "(text node 3)";
return "(Node: " + node.toString() + " )";
// return node.getFirstChild().getAttributes().getNamedItem(attrName).getNodeValue();
}
@ -408,7 +417,11 @@ public class StableAPI {
f.version = trimICU(getAttr(n, "version"));
f.file = getAttr(n, "file");
f.purifyPrototype();
f.file = Function.getBasename(f.file);
if(f.file == null) {
f.file = "{null}";
} else {
f.file = Function.getBasename(f.file);
}
f.comparableName = f.comparableName();
return f;
}

View File

@ -40,6 +40,67 @@
<xsl:copy-of select="location/@file" />
</cppfunc>
  </xsl:for-each>
<!-- now enums -->
<xsl:variable name="enum_node"
select="document($file)/doxygen/compounddef/sectiondef/memberdef[@kind='enum'][@prot='public']" />
<xsl:for-each select="$enum_node">
<!-- use a name, else '(anonymous)' -->
<xsl:variable name="enum_node_name">
<xsl:choose>
<xsl:when test="contains(name/text(), '@')">
(anonymous)
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="name/text()" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- enum object -->
<xsl:variable name="enum_status" select="detaileddescription/para/xrefsect/xreftitle/text()"/>
<xsl:variable name="enum_version" select="detaileddescription/para/xrefsect/xrefdescription/para/text()"/>
<xsl:if test="not(contains(name/text(), '@'))"> <!-- no anonymous file level enums -->
<cppfunc>
<xsl:copy-of select="@id" />
<xsl:attribute name="status"><xsl:value-of select="$enum_status" /></xsl:attribute>
<xsl:attribute name="version"><xsl:value-of select="$enum_status" /></xsl:attribute>
<xsl:attribute name="prototype">enum <xsl:value-of
select="$enum_node_name" /></xsl:attribute>
<xsl:copy-of select="location/@file" />
</cppfunc>
</xsl:if>
<xsl:variable name="enum_node_file" select="location/@file" />
<xsl:variable name="enum_member" select="enumvalue[@prot='public']"/>
<xsl:for-each select="$enum_member">
<cppfunc>
<xsl:copy-of select="@id" />
<!-- status and version: only override if set. -->
<xsl:attribute name="status"><xsl:choose>
<xsl:when test="detaileddescription/para/xrefsect/xreftitle/text() != ''"><xsl:value-of select="detaileddescription/para/xrefsect/xreftitle/text()"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$enum_status" /></xsl:otherwise>
</xsl:choose></xsl:attribute>
<xsl:attribute name="version"><xsl:choose>
<xsl:when test="detaileddescription/para/xrefsect/xrefdescription/para/text() != ''"><xsl:value-of select="detaileddescription/para/xrefsect/xrefdescription/para/text()"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$enum_version" /></xsl:otherwise>
</xsl:choose></xsl:attribute>
<xsl:attribute name="prototype">enum <xsl:value-of select="$enum_node_name"/>::<xsl:value-of
select="name/text()" /></xsl:attribute>
<xsl:attribute name="file"><xsl:value-of select="$enum_node_file" /></xsl:attribute>
</cppfunc>
</xsl:for-each> <!-- done with enum member -->
</xsl:for-each> <!-- done with enum -->
</xsl:for-each>
</list>
</xsl:template>

View File

@ -1,38 +1,114 @@
<!--
/*
*******************************************************************************
* Copyright (C) 2009-2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
* This is an XSLT file.
*/
-->
<!--
List all cpp public functions generated from the 'index.xml'
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="docFolder" />
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2009-2010, International Business Machines Corporation and others. All Rights Reserved. -->
<!-- List all cpp public functions generated from the 'index.xml' -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="docFolder" />
<xsl:template match="/">
<list>
<xsl:variable name="files_node" select="/doxygenindex/compound[@kind='class']/@refid" />
<xsl:for-each select="$files_node">
<xsl:variable name="file" select="concat($docFolder, '/', . , '.xml')" />
<xsl:variable name="funcs_node" select="document($file)/doxygen/compounddef/sectiondef/memberdef[@prot='public'][@kind='function']" />
<xsl:for-each select="$funcs_node">
<cppfunc>
<xsl:copy-of select="@id" />
<xsl:attribute name="status"><xsl:value-of select="detaileddescription/para/xrefsect/xreftitle/text()"/></xsl:attribute>
<xsl:attribute name="version"><xsl:value-of select="detaileddescription/para/xrefsect/xrefdescription/para/text()"/></xsl:attribute>
<xsl:attribute name="prototype"><xsl:value-of select="concat(definition/text(), argsstring/text())" /></xsl:attribute>
<xsl:copy-of select="location/@file" />
<xsl:copy-of select="@static" />
<xsl:copy-of select="@inline" />
</cppfunc>
</xsl:for-each>
</xsl:for-each>
</list>
</xsl:template>
<xsl:template match="/">
<list>
<xsl:variable name="files_node"
select="/doxygenindex/compound[@kind='class']/@refid" />
<xsl:for-each select="$files_node">
<xsl:variable name="file"
select="concat($docFolder, '/', . , '.xml')" />
<xsl:variable name="funcs_node"
select="document($file)/doxygen/compounddef/sectiondef/memberdef[@prot='public'][@kind='function']" />
<xsl:variable name="compoundname"
select="document($file)/doxygen/compounddef/compoundname/text()" />
<xsl:for-each select="$funcs_node">
<cppfunc>
<xsl:copy-of select="@id" />
<xsl:attribute name="status"><xsl:value-of
select="detaileddescription/para/xrefsect/xreftitle/text()" /></xsl:attribute>
<xsl:attribute name="version"><xsl:value-of
select="detaileddescription/para/xrefsect/xrefdescription/para/text()" /></xsl:attribute>
<xsl:attribute name="prototype"><xsl:value-of
select="concat(definition/text(), argsstring/text())" /></xsl:attribute>
<xsl:copy-of select="location/@file" />
<xsl:copy-of select="@static" />
<xsl:copy-of select="@inline" />
</cppfunc>
</xsl:for-each>
<!-- now enums -->
<xsl:variable name="enum_node"
select="document($file)/doxygen/compounddef/sectiondef/memberdef[@kind='enum'][@prot='public']" />
<xsl:for-each select="$enum_node">
<!-- use a name, else '(anonymous)' -->
<xsl:variable name="enum_node_name">
<xsl:choose>
<xsl:when test="contains(name/text(), '@')">
(anonymous)
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="name/text()" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="enum_status" select="detaileddescription/para/xrefsect/xreftitle/text()"/>
<xsl:variable name="enum_version" select="detaileddescription/para/xrefsect/xrefdescription/para/text()"/>
<cppfunc>
<xsl:copy-of select="@id" />
<xsl:attribute name="status"><xsl:value-of
select="$enum_status" /></xsl:attribute>
<xsl:attribute name="version"><xsl:value-of
select="$enum_version" /></xsl:attribute>
<xsl:attribute name="prototype">enum
<xsl:value-of select="$compoundname"/>::
<xsl:value-of
select="$enum_node_name" /></xsl:attribute>
<xsl:copy-of select="location/@file" />
</cppfunc>
<xsl:variable name="enum_node_file" select="location/@file" />
<xsl:variable name="enum_member" select="enumvalue[@prot='public']"/>
<!-- for each member -->
<xsl:for-each select="$enum_member">
<cppfunc>
<xsl:copy-of select="@id" />
<!-- status and version: only override if set. -->
<xsl:attribute name="status">
<xsl:choose>
<xsl:when test="detaileddescription/para/xrefsect/xreftitle/text() != ''">
<xsl:value-of select="detaileddescription/para/xrefsect/xreftitle/text()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$enum_status" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="version">
<xsl:choose>
<xsl:when test="detaileddescription/para/xrefsect/xrefdescription/para/text() != ''">
<xsl:value-of select="detaileddescription/para/xrefsect/xrefdescription/para/text()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$enum_version" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="prototype">enum
<xsl:value-of select="$compoundname"/>::<xsl:value-of
select="name/text()" /></xsl:attribute>
<xsl:attribute name="file"><xsl:value-of select="$enum_node_file" /></xsl:attribute>
</cppfunc>
</xsl:for-each> <!-- done with enum member -->
 
</xsl:for-each> <!-- done with enums -->
</xsl:for-each> <!-- done with file -->
</list>
</xsl:template>
</xsl:stylesheet>