diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-07-10 16:08:15 +0000 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2009-02-13 00:01:43 +0200 |
commit | 108ad37eca68fc834db8be451579f9549d41d281 (patch) | |
tree | 7aebc7382f6721ea85ff278c5d8626422b82e8a6 /tools | |
parent | 5f8fe27b970254ce5164915f191c16ea1f67a960 (diff) |
doc-generator.xsl: check that the D-Bus type of a property, arg, tp:member etc. is the same as the D-Bus type of its tp:type
Diffstat (limited to 'tools')
-rw-r--r-- | tools/doc-generator.xsl | 74 |
1 files changed, 59 insertions, 15 deletions
diff --git a/tools/doc-generator.xsl b/tools/doc-generator.xsl index 4647aa4..323f7d0 100644 --- a/tools/doc-generator.xsl +++ b/tools/doc-generator.xsl @@ -754,6 +754,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA <xsl:template name="tp-type"> <xsl:param name="tp-type"/> + <xsl:param name="type"/> <xsl:variable name="single-type"> <xsl:choose> @@ -766,21 +767,63 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA </xsl:choose> </xsl:variable> - <xsl:choose> - <xsl:when test="//tp:simple-type[@name=$single-type]" /> - <xsl:when test="//tp:struct[@name=$single-type]" /> - <xsl:when test="//tp:enum[@name=$single-type]" /> - <xsl:when test="//tp:flags[@name=$single-type]" /> - <xsl:when test="//tp:mapping[@name=$single-type]" /> - <xsl:when test="//tp:external-type[@name=$single-type]" /> - <xsl:otherwise> - <xsl:message terminate="yes"> - <xsl:text>ERR: Unable to find type '</xsl:text> - <xsl:value-of select="$tp-type"/> - <xsl:text>' </xsl:text> - </xsl:message> - </xsl:otherwise> - </xsl:choose> + <xsl:variable name="type-of-tp-type"> + <xsl:if test="contains($tp-type, '[]')"> + <!-- one 'a', plus one for each [ after the [], and delete all ] --> + <xsl:value-of select="concat('a', + translate(substring-after($tp-type, '[]'), '[]', 'a'))"/> + </xsl:if> + + <xsl:choose> + <xsl:when test="//tp:simple-type[@name=$single-type]"> + <xsl:value-of select="string(//tp:simple-type[@name=$single-type]/@type)"/> + </xsl:when> + <xsl:when test="//tp:struct[@name=$single-type]"> + <xsl:text>(</xsl:text> + <xsl:for-each select="//tp:struct[@name=$single-type]/tp:member"> + <xsl:value-of select="@type"/> + </xsl:for-each> + <xsl:text>)</xsl:text> + </xsl:when> + <xsl:when test="//tp:enum[@name=$single-type]"> + <xsl:value-of select="string(//tp:enum[@name=$single-type]/@type)"/> + </xsl:when> + <xsl:when test="//tp:flags[@name=$single-type]"> + <xsl:value-of select="string(//tp:flags[@name=$single-type]/@type)"/> + </xsl:when> + <xsl:when test="//tp:mapping[@name=$single-type]"> + <xsl:text>a{</xsl:text> + <xsl:for-each select="//tp:mapping[@name=$single-type]/tp:member"> + <xsl:value-of select="@type"/> + </xsl:for-each> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:when test="//tp:external-type[@name=$single-type]"> + <xsl:value-of select="string(//tp:external-type[@name=$single-type]/@type)"/> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes"> + <xsl:text>ERR: Unable to find type '</xsl:text> + <xsl:value-of select="$tp-type"/> + <xsl:text>' </xsl:text> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:if test="string($type) != '' and + string($type-of-tp-type) != string($type)"> + <xsl:message terminate="yes"> + <xsl:text>ERR: tp:type '</xsl:text> + <xsl:value-of select="$tp-type"/> + <xsl:text>' has D-Bus type '</xsl:text> + <xsl:value-of select="$type-of-tp-type"/> + <xsl:text>' but has been used with type='</xsl:text> + <xsl:value-of select="$type"/> + <xsl:text>' </xsl:text> + </xsl:message> + </xsl:if> + <a href="#type-{$single-type}"><xsl:value-of select="$tp-type"/></a> </xsl:template> @@ -790,6 +833,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA <xsl:text> (</xsl:text> <xsl:call-template name="tp-type"> <xsl:with-param name="tp-type" select="@tp:type"/> + <xsl:with-param name="type" select="@type"/> </xsl:call-template> <xsl:text>)</xsl:text> </xsl:if> |