123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808 |
- <?xml version="1.0" encoding="UTF-8"?>
-
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:output method="xml" indent="no"/>
-
- <xsl:param name="keyword.namespace" select="'Atmel.Language.C'"/>
-
- <xsl:template name="generate.book.title">
- <xsl:text>LUFA Library</xsl:text>
- </xsl:template>
-
- <xsl:template name="generate.book.id">
- <xsl:param name="book.title"/>
- <xsl:choose>
- <xsl:when test="@id">
- <xsl:value-of select="@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate($book.title, ' ','')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="generate.index.id">
- <xsl:param name="name"/>
- <xsl:variable name="book.title">
- <xsl:call-template name="generate.book.title"/>
- </xsl:variable>
- <xsl:variable name="book.id">
- <xsl:call-template name="generate.book.id">
- <xsl:with-param name="book.title" select="$book.title"/>
- </xsl:call-template>
- </xsl:variable>
-
- <indexterm id="{$keyword.namespace}.{$name}">
- <primary>
- <xsl:value-of select="$book.title"/>
- </primary>
- <secondary>
- <xsl:value-of select="$name"/>
- </secondary>
- </indexterm>
- </xsl:template>
-
- <xsl:template match="doxygen">
- <xsl:variable name="book.title">
- <xsl:call-template name="generate.book.title"/>
- </xsl:variable>
-
- <xsl:variable name="book.id">
- <xsl:call-template name="generate.book.id">
- <xsl:with-param name="book.title" select="$book.title"/>
- </xsl:call-template>
- </xsl:variable>
-
- <book id="{$book.id}">
- <title>
- <xsl:value-of select="$book.title"/>
- </title>
-
- <!-- Add index chapter -->
- <xsl:apply-templates select="compounddef[@kind = 'page' and @id = 'indexpage']">
- <xsl:with-param name="element.type" select="'chapter'"/>
- <xsl:with-param name="page.title" select="'Library Information'"/>
- </xsl:apply-templates>
-
- <!-- Add free-floating chapters -->
- <xsl:apply-templates select="compounddef[@kind = 'page' and not(@id = 'indexpage') and not(//innerpage/@refid = @id)]">
- <xsl:with-param name="element.type" select="'chapter'"/>
- </xsl:apply-templates>
-
- <!-- Add Modules chapter -->
- <chapter>
- <title>Modules</title>
- <xsl:apply-templates select="compounddef[@kind = 'group' and not(//innergroup/@refid = @id)]"/>
- </chapter>
- </book>
- </xsl:template>
-
- <xsl:template match="compounddef[@kind = 'page']">
- <xsl:param name="element.type" select="'section'"/>
- <xsl:param name="page.title" select="title"/>
-
- <xsl:element name="{$element.type}">
- <xsl:attribute name="id">
- <xsl:value-of select="@id"/>
- </xsl:attribute>
-
- <xsl:variable name="name">
- <xsl:text>LUFA.</xsl:text>
- <xsl:value-of select="translate(compoundname, '_', '.')"/>
- </xsl:variable>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="$name"/>
- </xsl:call-template>
-
- <title>
- <xsl:value-of select="$page.title"/>
- </title>
-
- <xsl:apply-templates select="detaileddescription"/>
-
- <xsl:if test="not(innerpage) and count(detaileddescription//sect1)">
- <para>
- <emphasis role="bold">Subsections:</emphasis>
- <itemizedlist>
- <xsl:for-each select="detaileddescription//sect1">
- <listitem>
- <link linkend="{@id}">
- <xsl:value-of select="title"/>
- </link>
- </listitem>
- </xsl:for-each>
- </itemizedlist>
- </para>
- </xsl:if>
-
- <xsl:for-each select="innerpage">
- <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="compounddef[@kind = 'group']">
- <section id="{@id}">
- <title>
- <xsl:value-of select="title"/>
- </title>
-
- <xsl:variable name="name">
- <xsl:text>LUFA.</xsl:text>
- <xsl:value-of select="translate(compoundname, '_', '.')"/>
- </xsl:variable>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="$name"/>
- </xsl:call-template>
-
- <xsl:apply-templates select="detaileddescription"/>
-
- <xsl:if test="count(innergroup)">
- <para>
- <emphasis role="bold">Subgroups:</emphasis>
- <itemizedlist>
- <xsl:for-each select="innergroup">
- <listitem>
- <link linkend="{@refid}">
- <xsl:value-of select="text()"/>
- </link>
- </listitem>
- </xsl:for-each>
- </itemizedlist>
- </para>
- </xsl:if>
-
- <xsl:apply-templates select="sectiondef"/>
-
- <xsl:for-each select="innerclass">
- <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
- </xsl:for-each>
-
- <xsl:for-each select="innergroup">
- <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'group' and @id = current()/@refid]"/>
- </xsl:for-each>
- </section>
- </xsl:template>
-
- <xsl:template match="compounddef[@kind = 'struct' or @kind = 'union']">
- <xsl:variable name="name" select="compoundname"/>
-
- <section id="{@id}" xreflabel="{$name}">
- <title>
- <xsl:choose>
- <xsl:when test="@kind = 'struct'">
- <xsl:text>Struct </xsl:text>
- </xsl:when>
-
- <xsl:when test="@kind = 'union'">
- <xsl:text>Union </xsl:text>
- </xsl:when>
- </xsl:choose>
-
- <xsl:value-of select="$name"/>
- </title>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="$name"/>
- </xsl:call-template>
-
- <xsl:apply-templates select="detaileddescription"/>
-
- <xsl:for-each select="sectiondef[@kind = 'public-attrib']">
- <table>
- <title>
- <xsl:value-of select="$name"/>
- </title>
-
- <tgroup cols="3">
- <thead>
- <row>
- <entry>Type</entry>
- <entry>Name</entry>
- <entry>Description</entry>
- </row>
- </thead>
-
- <tbody>
- <xsl:for-each select="memberdef">
- <row id="{@id}" xreflabel="{name}">
- <entry>
- <xsl:value-of select="type"/>
- </entry>
- <entry>
- <xsl:value-of select="name"/>
- <xsl:if test="starts-with(argsstring, '[')">
- <xsl:text>[]</xsl:text>
- </xsl:if>
-
- <xsl:variable name="struct.element.name">
- <xsl:value-of select="$name"/>
- <xsl:text>.</xsl:text>
- <xsl:value-of select="name"/>
- </xsl:variable>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="$struct.element.name"/>
- </xsl:call-template>
- </entry>
- <entry>
- <xsl:apply-templates select="detaileddescription"/>
- </entry>
- </row>
- </xsl:for-each>
- </tbody>
- </tgroup>
- </table>
- </xsl:for-each>
- </section>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind = 'function']">
- <section id="{@id}" xreflabel="{name}">
- <title>
- <xsl:text>Function </xsl:text>
- <xsl:value-of select="name"/>
- <xsl:text>()</xsl:text>
- </title>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="name"/>
- </xsl:call-template>
-
- <para>
- <emphasis role="italic">
- <xsl:value-of select="briefdescription"/>
- </emphasis>
- </para>
-
- <programlisting language="c">
- <emphasis role="keyword">
- <xsl:value-of select="type"/>
- </emphasis>
- <xsl:text> </xsl:text>
- <xsl:value-of select="name"/>
- <xsl:text>(</xsl:text>
-
- <xsl:choose>
- <xsl:when test="not(param[1]/declname)">
- <emphasis role="keyword">void</emphasis>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:for-each select="param">
- <xsl:if test="position() > 1">
- <xsl:text>,</xsl:text>
- </xsl:if>
- <xsl:text> 	</xsl:text>
- <emphasis role="keyword">
- <xsl:value-of select="type"/>
- </emphasis>
- <xsl:text> </xsl:text>
- <xsl:value-of select="declname"/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:text>)</xsl:text>
- </programlisting>
-
- <xsl:apply-templates select="detaileddescription"/>
- </section>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind = 'enum']">
- <section id="{@id}" xreflabel="{name}">
- <title>
- <xsl:text>Enum </xsl:text>
- <xsl:value-of select="name"/>
- </title>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="name"/>
- </xsl:call-template>
-
- <xsl:apply-templates select="detaileddescription"/>
-
- <table>
- <title>Members</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Enum Value</entry>
- <entry>Description</entry>
- </row>
- </thead>
-
- <tbody>
- <xsl:for-each select="enumvalue">
- <row>
- <entry>
- <para id="{@id}" xreflabel="{name}">
- <xsl:value-of select="name"/>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="name"/>
- </xsl:call-template>
- </para>
- </entry>
- <entry>
- <xsl:apply-templates select="detaileddescription"/>
- </entry>
- </row>
- </xsl:for-each>
- </tbody>
- </tgroup>
- </table>
- </section>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind = 'define']">
- <section id="{@id}" xreflabel="{name}">
- <title>
- <xsl:text>Macro </xsl:text>
- <xsl:value-of select="name"/>
- </title>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="name"/>
- </xsl:call-template>
-
- <programlisting language="c">
- <emphasis role="preprocessor">
- <xsl:text>#define </xsl:text>
- <xsl:value-of select="name"/>
- <xsl:if test="count(param) > 0">
- <xsl:text>(</xsl:text>
- <xsl:for-each select="param/defname">
- <xsl:if test="position() > 1">
- <xsl:text>,</xsl:text>
- </xsl:if>
- <xsl:value-of select="."/>
- </xsl:for-each>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:text> </xsl:text>
-
- <!-- Split long macro definitions across multiple lines -->
- <xsl:if test="(string-length(initializer) > 50) or (count(param) > 0)">
- <xsl:text>\ 	</xsl:text>
- </xsl:if>
-
- <xsl:value-of select="initializer"/>
- </emphasis>
- <xsl:text> </xsl:text>
- </programlisting>
-
- <xsl:apply-templates select="detaileddescription"/>
- </section>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind = 'typedef']">
- <section id="{@id}" xreflabel="{name}">
- <title>
- <xsl:text>Type </xsl:text>
- <xsl:value-of select="name"/>
- </title>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="name"/>
- </xsl:call-template>
-
- <programlisting language="c">
- <emphasis role="keyword">
- <xsl:text>typedef </xsl:text>
- <xsl:value-of select="type"/>
- </emphasis>
- <xsl:text> </xsl:text>
- <xsl:value-of select="name"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="argsstring"/>
- </programlisting>
-
- <xsl:apply-templates select="detaileddescription"/>
- </section>
- </xsl:template>
-
-
- <xsl:template match="memberdef[@kind = 'variable']">
- <section id="{@id}" xreflabel="{name}">
- <title>
- <xsl:text>Variable </xsl:text>
- <xsl:value-of select="name"/>
- </title>
-
- <xsl:call-template name="generate.index.id">
- <xsl:with-param name="name" select="name"/>
- </xsl:call-template>
-
- <programlisting language="c">
- <emphasis role="keyword">
- <xsl:value-of select="type"/>
- </emphasis>
- <xsl:text> </xsl:text>
- <xsl:value-of select="name"/>
- </programlisting>
-
- <xsl:apply-templates select="detaileddescription"/>
- </section>
- </xsl:template>
-
- <xsl:template match="linebreak | simplesectsep">
- <!-- MUST be on two separate lines, as this is a *literal* newline -->
- <literallayout>
- </literallayout>
- </xsl:template>
-
- <xsl:template match="verbatim">
- <programlisting>
- <xsl:apply-templates/>
- </programlisting>
- </xsl:template>
-
- <xsl:template match="sectiondef">
- <para>
- <xsl:value-of select="description"/>
- </para>
-
- <xsl:apply-templates select="memberdef"/>
- </xsl:template>
-
- <xsl:template match="simplesect" mode="struct">
- <footnote>
- <xsl:apply-templates/>
- </footnote>
- </xsl:template>
-
- <xsl:template match="simplesect">
- <xsl:choose>
- <xsl:when test="@kind = 'par'">
- <note>
- <title>
- <xsl:value-of select="title"/>
- </title>
- <xsl:apply-templates/>
- </note>
- </xsl:when>
-
- <xsl:when test="@kind = 'return'">
- <note>
- <title>Returns</title>
- <xsl:apply-templates/>
- </note>
- </xsl:when>
-
- <xsl:when test="@kind = 'warning'">
- <warning>
- <title>Warning</title>
- <xsl:apply-templates/>
- </warning>
- </xsl:when>
-
- <xsl:when test="@kind = 'pre'">
- <note>
- <title>Precondition</title>
- <xsl:apply-templates/>
- </note>
- </xsl:when>
-
- <xsl:when test="@kind = 'see'">
- <note>
- <title>See also</title>
- <xsl:apply-templates/>
- </note>
- </xsl:when>
-
- <xsl:when test="@kind = 'note'">
- <note>
- <title>Note</title>
- <xsl:apply-templates/>
- </note>
- </xsl:when>
-
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="parameterlist[@kind = 'param']">
- <table>
- <title>Parameters</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>Data Direction</entry>
- <entry>Parameter Name</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <xsl:for-each select="parameteritem">
- <row>
- <xsl:apply-templates select="."/>
- </row>
- </xsl:for-each>
- </tbody>
- </tgroup>
- </table>
- </xsl:template>
-
- <xsl:template match="parameterlist[@kind = 'retval']">
- <table>
- <title>Return Values</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Return Value</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <xsl:for-each select="parameteritem">
- <row>
- <xsl:apply-templates select="."/>
- </row>
- </xsl:for-each>
- </tbody>
- </tgroup>
- </table>
- </xsl:template>
-
- <xsl:template match="parameteritem">
- <xsl:if test="parent::parameterlist/@kind = 'param'">
- <entry>
- <para>
- <xsl:choose>
- <xsl:when test="not(descendant::parametername/@direction)">
- <emphasis role="italic">?</emphasis>
- </xsl:when>
-
- <xsl:otherwise>
- <emphasis role="bold">
- [<xsl:value-of select="descendant::parametername/@direction"/>]
- </emphasis>
- </xsl:otherwise>
- </xsl:choose>
- </para>
- </entry>
- </xsl:if>
-
- <entry>
- <para>
- <xsl:value-of select="parameternamelist/parametername"/>
- </para>
- </entry>
-
- <entry>
- <xsl:apply-templates select="parameterdescription"/>
- </entry>
- </xsl:template>
-
- <xsl:template match="parameterdescription">
- <para>
- <xsl:apply-templates/>
- </para>
- </xsl:template>
-
- <xsl:template match="type">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="bold">
- <emphasis role="bold">
- <xsl:apply-templates/>
- </emphasis>
- </xsl:template>
-
- <xsl:template match="emphasis">
- <emphasis role="italic">
- <xsl:apply-templates/>
- </emphasis>
- </xsl:template>
-
- <xsl:template match="small">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="mdash | ndash">
- <!-- Doxygen bug; double dashed are replaced with single HTML dash
- entities, even in verbatim-like <tt> sections -->
- <xsl:text>--</xsl:text>
- </xsl:template>
-
- <xsl:template match="computeroutput | preformatted">
- <computeroutput>
- <xsl:apply-templates/>
- </computeroutput>
- </xsl:template>
-
- <xsl:template match="codeline">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="ulink">
- <ulink url="{@url}">
- <xsl:value-of select="."/>
- </ulink>
- </xsl:template>
-
- <xsl:template match="superscript">
- <superscript>
- <xsl:apply-templates/>
- </superscript>
- </xsl:template>
-
- <xsl:template match="subscript">
- <subscript>
- <xsl:apply-templates/>
- </subscript>
- </xsl:template>
-
- <xsl:template match="para">
- <para>
- <xsl:apply-templates/>
- </para>
- </xsl:template>
-
- <xsl:template match="ref">
- <xsl:choose>
- <!-- Don't show links inside program listings -->
- <xsl:when test="ancestor::programlisting">
- <xsl:value-of select="."/>
- </xsl:when>
-
- <!-- Don't show links to file compound definitions, as they are discarded -->
- <xsl:when test="ancestor::*/compounddef[@kind = 'file' and @id = current()/@refid]">
- <xsl:value-of select="."/>
- </xsl:when>
-
- <!-- Show links outside program listings -->
- <xsl:otherwise>
- <link linkend="{@refid}">
- <xsl:value-of select="text()"/>
- </link>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="entry">
- <entry>
- <xsl:apply-templates/>
- </entry>
- </xsl:template>
-
- <xsl:template match="table[caption]">
- <table>
- <title>
- <xsl:value-of select="caption"/>
- </title>
-
- <tgroup cols="{@cols}">
- <thead>
- <xsl:apply-templates select="row[entry/@thead = 'yes']"/>
- </thead>
-
- <tbody>
- <xsl:apply-templates select="row[entry/@thead != 'yes']"/>
- </tbody>
- </tgroup>
- </table>
- </xsl:template>
-
- <xsl:template match="table[not(caption)]">
- <informaltable>
- <tgroup cols="{@cols}">
- <thead>
- <xsl:apply-templates select="row[entry/@thead = 'yes']"/>
- </thead>
-
- <tbody>
- <xsl:apply-templates select="row[entry/@thead != 'yes']"/>
- </tbody>
- </tgroup>
- </informaltable>
- </xsl:template>
-
- <xsl:template match="row">
- <row>
- <xsl:apply-templates/>
- </row>
- </xsl:template>
-
- <xsl:template match="itemizedlist">
- <itemizedlist>
- <xsl:apply-templates/>
- </itemizedlist>
- </xsl:template>
-
- <xsl:template match="orderedlist">
- <orderedlist>
- <xsl:apply-templates/>
- </orderedlist>
- </xsl:template>
-
- <xsl:template match="listitem">
- <listitem>
- <xsl:apply-templates/>
- </listitem>
- </xsl:template>
-
- <xsl:template match="programlisting">
- <programlisting language="c">
- <xsl:for-each select="codeline[position() > 1 or highlight]">
- <xsl:apply-templates select="."/>
- <xsl:text> </xsl:text>
- </xsl:for-each>
- </programlisting>
- </xsl:template>
-
- <xsl:template match="highlight">
- <emphasis role="{@class}">
- <xsl:apply-templates/>
- </emphasis>
- </xsl:template>
-
- <xsl:template match="highlight[1]/text()">
- <xsl:choose>
- <xsl:when test="substring(., 1, 1) = '*'">
- <xsl:value-of select="substring(., 2)"/>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="sp[ancestor::codeline]">
- <xsl:text> </xsl:text>
- </xsl:template>
-
- <xsl:template match="image">
- <mediaobject>
- <imageobject>
- <imagedata align="center">
- <xsl:attribute name="fileref">
- <xsl:text>images/</xsl:text>
- <xsl:value-of select="@name"/>
- </xsl:attribute>
- </imagedata>
- </imageobject>
- </mediaobject>
- </xsl:template>
-
- <xsl:template match="detaileddescription">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="sect1 | sect2 | sect3 | sect4 | sect5 | sect6 | sect7 | sect8 | sect9">
- <section>
- <xsl:if test="@id">
- <xsl:attribute name="id">
- <xsl:value-of select="@id"/>
- </xsl:attribute>
- </xsl:if>
-
- <title>
- <xsl:value-of select="title"/>
- </title>
-
- <xsl:apply-templates/>
- </section>
- </xsl:template>
-
- <xsl:template match="anchor">
- <xsl:if test="@id">
- <indexterm id="{@id}"/>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="title"/>
-
- <xsl:template match="htmlonly"/>
-
- <xsl:template match="*">
- <xsl:message>NO XSL TEMPLATE MATCH: <xsl:value-of select="local-name()"/></xsl:message>
- </xsl:template>
-
- </xsl:stylesheet>
|