1 <?xml version="1.0" encoding="UTF-8"?>
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4 <xsl:import href="transform_base.xsl"/>
6 <xsl:output method="xml" indent="no"/>
8 <xsl:param name="keyword.namespace" select="'Atmel.Language.C'"/>
10 <xsl:template name="generate.book.title">
11 <xsl:text>LUFA Library</xsl:text>
14 <xsl:template name="generate.book.id">
15 <xsl:param name="book.title"/>
18 <xsl:value-of select="@id"/>
21 <xsl:value-of select="translate($book.title, ' ','')"/>
26 <xsl:template name="generate.index.id">
27 <xsl:param name="name"/>
28 <xsl:variable name="book.title">
29 <xsl:call-template name="generate.book.title"/>
31 <xsl:variable name="book.id">
32 <xsl:call-template name="generate.book.id">
33 <xsl:with-param name="book.title" select="$book.title"/>
37 <indexterm id="{$keyword.namespace}.{$name}">
39 <xsl:value-of select="$book.title"/>
42 <xsl:value-of select="$name"/>
47 <xsl:template match="doxygen">
48 <xsl:variable name="book.title">
49 <xsl:call-template name="generate.book.title"/>
51 <xsl:variable name="book.id">
52 <xsl:call-template name="generate.book.id">
53 <xsl:with-param name="book.title" select="$book.title"/>
57 <book name="{$book.id}">
59 <xsl:value-of select="$book.title"/>
62 <!-- Add index chapter -->
63 <xsl:call-template name="generate.top.level.page">
64 <xsl:with-param name="top.level.page" select="compounddef[@kind = 'page' and contains(@id, 'index')]"/>
67 <!-- Add free-floating chapters -->
68 <xsl:for-each select="compounddef[@kind = 'page' and not(contains(@id, 'index'))]">
69 <xsl:if test="not(//innerpage[@refid = current()/@id])">
70 <xsl:call-template name="generate.top.level.page">
71 <xsl:with-param name="top.level.page" select="current()"/>
76 <!-- Add Module chapter -->
78 <title>Modules</title>
79 <xsl:for-each select="compounddef[@kind = 'group']">
80 <xsl:if test="not(//innergroup[@refid = current()/@id])">
81 <xsl:apply-templates select="current()"/>
88 <xsl:template name="generate.top.level.page">
89 <xsl:param name="top.level.page"/>
90 <chapter id="{$top.level.page/@id}">
92 <xsl:value-of select="$top.level.page/title"/>
94 <xsl:apply-templates select="$top.level.page/detaileddescription"/>
95 <xsl:for-each select="$top.level.page/innerpage">
96 <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
101 <xsl:template match="compounddef[@kind = 'page']">
104 <xsl:value-of select="title"/>
106 <xsl:apply-templates select="detaileddescription"/>
107 <xsl:for-each select="innerpage">
108 <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
113 <xsl:template match="compounddef[@kind = 'group']">
116 <xsl:value-of select="title"/>
119 <xsl:variable name="book.title">
120 <xsl:call-template name="generate.book.title"/>
123 <xsl:variable name="name">
125 <xsl:when test="contains(compoundname, '_')">
126 <xsl:value-of select="translate(compoundname, '_', '/')"/>
127 <xsl:text>.h</xsl:text>
130 <xsl:value-of select="compoundname"/>
131 <xsl:text>.h</xsl:text>
136 <xsl:variable name="name.escaped">
138 <xsl:when test="contains(compoundname, '_')">
139 <xsl:value-of select="translate(compoundname, '_', '.')"/>
140 <xsl:text>.h</xsl:text>
143 <xsl:value-of select="compoundname"/>
144 <xsl:text>.h</xsl:text>
149 <indexterm id="{$keyword.namespace}.{$name.escaped}">
150 <primary>Header</primary>
152 <xsl:value-of select="$name"/>
157 <xsl:value-of select="$book.title"/>
160 <xsl:value-of select="$name"/>
165 <xsl:value-of select="$name"/>
168 <xsl:apply-templates/>
169 <xsl:for-each select="innerclass">
170 <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
173 <xsl:for-each select="innergroup">
174 <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'group' and @id = current()/@refid]"/>
179 <xsl:template match="compounddef[@kind = 'struct' or @kind = 'union']">
180 <xsl:variable name="name" select="compoundname"/>
182 <section id="{@id}" xreflabel="{$name}">
184 <xsl:value-of select="@kind"/>
185 <xsl:text> </xsl:text>
186 <xsl:value-of select="$name"/>
189 <xsl:call-template name="generate.index.id">
190 <xsl:with-param name="name" select="$name"/>
193 <xsl:apply-templates select="detaileddescription"/>
195 <xsl:for-each select="sectiondef[@kind='public-attrib']">
196 <table abstyle="striped">
198 <xsl:value-of select="$name"/>
201 <colspec colnum="1" colname="start.col"/>
202 <colspec colnum="3" colname="stop.col"/>
203 <spanspec spanname="full" namest="start.col" nameend="stop.col"/>
206 <entry>Data type</entry>
207 <entry>Field name</entry>
208 <entry>Description</entry>
212 <xsl:for-each select="memberdef">
213 <row id="{@id}" xreflabel="{name}">
215 <xsl:apply-templates select="type"/>
218 <xsl:value-of select="name"/>
219 <indexterm id="{$keyword.namespace}.{$name}.{name}"/>
222 <xsl:apply-templates select="detaileddescription"/>
233 <xsl:template match="memberdef[@kind = 'function']">
234 <xsl:variable name="name" select="name"/>
236 <section id="{@id}" xreflabel="{name}">
238 <xsl:text>Function </xsl:text>
239 <xsl:value-of select="name"/>
240 <xsl:text>()</xsl:text>
243 <xsl:call-template name="generate.index.id">
244 <xsl:with-param name="name" select="$name"/>
248 <emphasis role="italic">
249 <xsl:value-of select="briefdescription"/>
253 <programlisting language="c">
254 <xsl:value-of select="definition"/>
255 <xsl:text> </xsl:text>
256 <xsl:apply-templates select="argsstring"/>
259 <xsl:apply-templates select="detaileddescription"/>
263 <xsl:template match="memberdef[@kind = 'enum']">
264 <xsl:variable name="name" select="name"/>
266 <section id="{@id}" xreflabel="{name}">
268 <xsl:text>Enum </xsl:text>
269 <xsl:value-of select="name"/>
272 <xsl:call-template name="generate.index.id">
273 <xsl:with-param name="name" select="$name"/>
276 <xsl:apply-templates select="detaileddescription"/>
278 <informaltable tabstyle="striped">
282 <entry>Enum Value</entry>
283 <entry>Description</entry>
287 <xsl:for-each select="enumvalue">
290 <para id="{@id}" xreflabel="{name}">
291 <xsl:value-of select="name"/>
295 <xsl:apply-templates select="detaileddescription"/>
305 <xsl:template match="memberdef[@kind = 'define']">
306 <xsl:variable name="name" select="name"/>
308 <section id="{@id}" xreflabel="{name}">
310 <xsl:text>Macro </xsl:text>
311 <xsl:value-of select="name"/>
314 <xsl:call-template name="generate.index.id">
315 <xsl:with-param name="name" select="$name"/>
318 <programlisting language="c">
319 <xsl:text>#define </xsl:text>
320 <xsl:value-of select="name"/>
321 <xsl:if test="count(param) > 0">
322 <xsl:text>(</xsl:text>
323 <xsl:for-each select="param/defname">
324 <xsl:if test="position() > 1">
325 <xsl:text>,</xsl:text>
327 <xsl:value-of select="."/>
329 <xsl:text>)</xsl:text>
332 <xsl:text> </xsl:text>
334 <!-- Split long macro definitions across multiple lines -->
335 <xsl:if test="(string-length(initializer) > 50) or (count(param) > 0)">
336 <xsl:text>\</xsl:text>
339 <xsl:value-of select="initializer"/>
342 <xsl:apply-templates select="detaileddescription"/>
346 <xsl:template match="memberdef[@kind = 'variable' or @kind = 'typedef']">
347 <xsl:variable name="name" select="name"/>
349 <section id="{@id}" xreflabel="{name}">
351 <!-- Doxygen gets confused and thinks function pointer type definitions
352 are variables, so we need to map them to this common section and
353 check the definition to see which of the two it is. -->
355 <xsl:when test="contains(definition,'typedef')">
356 <xsl:text>Type </xsl:text>
359 <xsl:text>Variable </xsl:text>
363 <xsl:value-of select="name"/>
366 <xsl:call-template name="generate.index.id">
367 <xsl:with-param name="name" select="$name"/>
370 <programlisting language="c">
371 <xsl:value-of select="definition"/>
374 <xsl:apply-templates select="detaileddescription"/>
378 <xsl:template match="linebreak">
379 <xsl:text> </xsl:text>
382 <xsl:template match="image">
385 <xsl:value-of select="."/>
391 <xsl:attribute name="fileref">images/<xsl:value-of select="@name"/></xsl:attribute>
398 <xsl:template match="detaileddescription">
399 <xsl:apply-templates/>
402 <xsl:template match="sect1 | sect2 | sect3 | sect4 | sect5 | sect6 | sect7 | sect8 | sect9">
405 <xsl:attribute name="id">
406 <xsl:value-of select="@id"/>
411 <xsl:value-of select="title"/>
413 <xsl:apply-templates/>
417 <xsl:template match="anchor">
419 <indexterm id="{@id}"/>
423 <xsl:template match="compoundname"/>
425 <xsl:template match="title"/>
427 <xsl:template match="indexterm"/>
429 <xsl:template match="indexentry">
430 <xsl:variable name="prim">
432 <xsl:when test="contains(primaryie, ',')">
433 <xsl:value-of select="normalize-space(substring-before(primaryie, ','))"/>
436 <xsl:value-of select="primaryie"/>
441 <xsl:variable name="sec">
443 <xsl:when test="contains(primaryie, ',')">
444 <xsl:value-of select="normalize-space(substring-after(primaryie, ','))"/>
446 <xsl:when test="seondariye">
447 <xsl:value-of select="secondaryie"/>
453 <xsl:variable name="tert">
455 <xsl:when test="contains(primaryie, ',')">
457 <xsl:when test="secondaryie">
458 <xsl:value-of select="secondaryie"/>
462 <xsl:when test="tertiaryie">
463 <xsl:value-of select="tertiaryie"/>
471 <xsl:attribute name="id">
472 <xsl:value-of select="@id"/>
475 <xsl:if test="$prim">
477 <xsl:value-of select="$prim"/>
482 <xsl:value-of select="$sec"/>
485 <xsl:if test="$tert">
487 <xsl:value-of select="$tert"/>