1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <!--
|
---|
4 | * A template to generate a generic IDL file from the generic interface
|
---|
5 | * definition expressed in XML. The generated file is intended solely to
|
---|
6 | * generate the documentation using Doxygen.
|
---|
7 |
|
---|
8 | Copyright (C) 2006-2020 Oracle Corporation
|
---|
9 |
|
---|
10 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | available from http://www.virtualbox.org. This file is free software;
|
---|
12 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | General Public License (GPL) as published by the Free Software
|
---|
14 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | -->
|
---|
18 |
|
---|
19 | <xsl:stylesheet
|
---|
20 | version="1.0"
|
---|
21 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
22 | xmlns:str="http://xsltsl.org/string"
|
---|
23 | exclude-result-prefixes="str"
|
---|
24 | >
|
---|
25 | <!-- The exclude-result-prefixes attribute is needed since otherwise the <tt>
|
---|
26 | tag added for the ID in interface and enum descriptions would get the
|
---|
27 | namespace, confusing doxygen completely. -->
|
---|
28 |
|
---|
29 | <xsl:import href="string.xsl"/>
|
---|
30 |
|
---|
31 | <xsl:output method="html" indent="yes"/>
|
---|
32 |
|
---|
33 | <xsl:strip-space elements="*"/>
|
---|
34 |
|
---|
35 |
|
---|
36 | <!--
|
---|
37 | // Doxygen transformation rules
|
---|
38 | /////////////////////////////////////////////////////////////////////////////
|
---|
39 | -->
|
---|
40 |
|
---|
41 | <!--
|
---|
42 | * all text elements that are not explicitly matched are normalized
|
---|
43 | * (all whitespace chars are converted to single spaces)
|
---|
44 | -->
|
---|
45 | <!--xsl:template match="desc//text()">
|
---|
46 | <xsl:value-of select="concat(' ',normalize-space(.),' ')"/>
|
---|
47 | </xsl:template-->
|
---|
48 |
|
---|
49 | <!--
|
---|
50 | * all elements that are not explicitly matched are considered to be html tags
|
---|
51 | * and copied w/o modifications
|
---|
52 | -->
|
---|
53 | <xsl:template match="desc//*">
|
---|
54 | <xsl:copy>
|
---|
55 | <xsl:apply-templates/>
|
---|
56 | </xsl:copy>
|
---|
57 | </xsl:template>
|
---|
58 |
|
---|
59 | <!--
|
---|
60 | * special treatment of <tt>, making sure that Doxygen will not interpret its
|
---|
61 | * contents (assuming it is a leaf tag)
|
---|
62 | -->
|
---|
63 | <xsl:template match="desc//tt/text()">
|
---|
64 | <xsl:variable name="subst1">
|
---|
65 | <xsl:call-template name="str:subst">
|
---|
66 | <xsl:with-param name="text" select="." />
|
---|
67 | <xsl:with-param name="replace" select="'::'" />
|
---|
68 | <xsl:with-param name="with" select="'\::'" />
|
---|
69 | </xsl:call-template>
|
---|
70 | </xsl:variable>
|
---|
71 | <xsl:value-of select="$subst1"/>
|
---|
72 | </xsl:template>
|
---|
73 |
|
---|
74 | <!--
|
---|
75 | * same like desc//* but place <ol> at start of line otherwise Doxygen will not
|
---|
76 | * find it
|
---|
77 | -->
|
---|
78 | <xsl:template match="desc//ol">
|
---|
79 | <xsl:text>
</xsl:text>
|
---|
80 | <xsl:copy>
|
---|
81 | <xsl:apply-templates/>
|
---|
82 | </xsl:copy>
|
---|
83 | </xsl:template>
|
---|
84 |
|
---|
85 | <!--
|
---|
86 | * same like desc//* but place <ul> at start of line otherwise Doxygen will not
|
---|
87 | * find it
|
---|
88 | -->
|
---|
89 | <xsl:template match="desc//ul">
|
---|
90 | <xsl:text>
</xsl:text>
|
---|
91 | <xsl:copy>
|
---|
92 | <xsl:apply-templates/>
|
---|
93 | </xsl:copy>
|
---|
94 | </xsl:template>
|
---|
95 |
|
---|
96 | <!--
|
---|
97 | * same like desc//* but place <pre> at start of line otherwise Doxygen will not
|
---|
98 | * find it
|
---|
99 | -->
|
---|
100 | <xsl:template match="desc//pre">
|
---|
101 | <xsl:text>
</xsl:text>
|
---|
102 | <xsl:copy>
|
---|
103 | <xsl:apply-templates/>
|
---|
104 | </xsl:copy>
|
---|
105 | </xsl:template>
|
---|
106 |
|
---|
107 | <!--
|
---|
108 | * paragraph
|
---|
109 | -->
|
---|
110 | <xsl:template match="desc//p">
|
---|
111 | <xsl:text>
</xsl:text>
|
---|
112 | <xsl:apply-templates/>
|
---|
113 | <xsl:text>
</xsl:text>
|
---|
114 | </xsl:template>
|
---|
115 |
|
---|
116 | <!--
|
---|
117 | * link
|
---|
118 | -->
|
---|
119 | <xsl:template match="desc//link">
|
---|
120 | <xsl:text>@link </xsl:text>
|
---|
121 | <!--
|
---|
122 | * sometimes Doxygen is stupid and cannot resolve global enums properly,
|
---|
123 | * thinking they are members of the current class. Fix it by adding ::
|
---|
124 | * in front of any @to value that doesn't start with #.
|
---|
125 | -->
|
---|
126 | <xsl:choose>
|
---|
127 | <xsl:when test="not(starts-with(@to, '#')) and not(contains(@to, '::'))">
|
---|
128 | <xsl:text>::</xsl:text>
|
---|
129 | </xsl:when>
|
---|
130 | </xsl:choose>
|
---|
131 | <!--
|
---|
132 | * Doxygen doesn't understand autolinks like Class::func() if Class
|
---|
133 | * doesn't actually contain a func with no arguments. Fix it.
|
---|
134 | -->
|
---|
135 | <xsl:choose>
|
---|
136 | <xsl:when test="substring(@to, string-length(@to)-1)='()'">
|
---|
137 | <xsl:value-of select="substring-before(@to, '()')"/>
|
---|
138 | </xsl:when>
|
---|
139 | <xsl:otherwise>
|
---|
140 | <xsl:value-of select="@to"/>
|
---|
141 | </xsl:otherwise>
|
---|
142 | </xsl:choose>
|
---|
143 | <xsl:text> </xsl:text>
|
---|
144 | <xsl:choose>
|
---|
145 | <xsl:when test="normalize-space(text())">
|
---|
146 | <xsl:value-of select="normalize-space(text())"/>
|
---|
147 | </xsl:when>
|
---|
148 | <xsl:otherwise>
|
---|
149 | <xsl:choose>
|
---|
150 | <xsl:when test="starts-with(@to, '#')">
|
---|
151 | <xsl:value-of select="substring-after(@to, '#')"/>
|
---|
152 | </xsl:when>
|
---|
153 | <xsl:when test="starts-with(@to, '::')">
|
---|
154 | <xsl:value-of select="substring-after(@to, '::')"/>
|
---|
155 | </xsl:when>
|
---|
156 | <xsl:otherwise>
|
---|
157 | <xsl:value-of select="@to"/>
|
---|
158 | </xsl:otherwise>
|
---|
159 | </xsl:choose>
|
---|
160 | </xsl:otherwise>
|
---|
161 | </xsl:choose>
|
---|
162 | <xsl:text>@endlink</xsl:text>
|
---|
163 | <!--
|
---|
164 | * insert a dummy empty B element to distinctly separate @endlink
|
---|
165 | * from the following text
|
---|
166 | -->
|
---|
167 | <xsl:element name="b"/>
|
---|
168 | </xsl:template>
|
---|
169 |
|
---|
170 | <!--
|
---|
171 | * note
|
---|
172 | -->
|
---|
173 | <xsl:template match="desc/note">
|
---|
174 | <xsl:if test="not(@internal='yes')">
|
---|
175 | <xsl:text>
@note </xsl:text>
|
---|
176 | <xsl:apply-templates/>
|
---|
177 | <xsl:text>
</xsl:text>
|
---|
178 | </xsl:if>
|
---|
179 | </xsl:template>
|
---|
180 |
|
---|
181 | <!--
|
---|
182 | * see
|
---|
183 | -->
|
---|
184 | <xsl:template match="desc/see">
|
---|
185 | <xsl:text>
@see </xsl:text>
|
---|
186 | <xsl:apply-templates/>
|
---|
187 | <xsl:text>
</xsl:text>
|
---|
188 | </xsl:template>
|
---|
189 |
|
---|
190 |
|
---|
191 | <!--
|
---|
192 | * common comment prologue (handles group IDs)
|
---|
193 | -->
|
---|
194 | <xsl:template match="desc" mode="begin">
|
---|
195 | <xsl:param name="id" select="@group | preceding::descGroup[1]/@id"/>
|
---|
196 | <xsl:text>/**
</xsl:text>
|
---|
197 | <xsl:if test="$id">
|
---|
198 | <xsl:value-of select="concat(' @ingroup ',$id,'
')"/>
|
---|
199 | </xsl:if>
|
---|
200 | </xsl:template>
|
---|
201 |
|
---|
202 | <!--
|
---|
203 | * common brief comment prologue (handles group IDs)
|
---|
204 | -->
|
---|
205 | <xsl:template match="desc" mode="begin_brief">
|
---|
206 | <xsl:param name="id" select="@group | preceding::descGroup[1]/@id"/>
|
---|
207 | <xsl:text>/**
</xsl:text>
|
---|
208 | <xsl:if test="$id">
|
---|
209 | <xsl:value-of select="concat(' @ingroup ',$id,'
')"/>
|
---|
210 | </xsl:if>
|
---|
211 | <xsl:text> @brief
</xsl:text>
|
---|
212 | </xsl:template>
|
---|
213 |
|
---|
214 | <!--
|
---|
215 | * common middle part of the comment block
|
---|
216 | -->
|
---|
217 | <xsl:template match="desc" mode="middle">
|
---|
218 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
219 | <xsl:apply-templates select="note"/>
|
---|
220 | <xsl:apply-templates select="see"/>
|
---|
221 | </xsl:template>
|
---|
222 |
|
---|
223 | <!--
|
---|
224 | * result part of the comment block
|
---|
225 | -->
|
---|
226 | <xsl:template match="desc" mode="results">
|
---|
227 | <xsl:if test="result">
|
---|
228 | <xsl:text>
|
---|
229 | @par Expected result codes:
|
---|
230 | </xsl:text>
|
---|
231 | <table>
|
---|
232 | <xsl:for-each select="result">
|
---|
233 | <tr>
|
---|
234 | <xsl:choose>
|
---|
235 | <xsl:when test="ancestor::library/result[@name=current()/@name]">
|
---|
236 | <td><xsl:value-of select=
|
---|
237 | "concat('@link ::',@name,' ',@name,' @endlink')"/></td>
|
---|
238 | </xsl:when>
|
---|
239 | <xsl:otherwise>
|
---|
240 | <td><xsl:value-of select="@name"/></td>
|
---|
241 | </xsl:otherwise>
|
---|
242 | </xsl:choose>
|
---|
243 | <td>
|
---|
244 | <xsl:apply-templates select="text() | *[not(self::note or self::see or
|
---|
245 | self::result)]"/>
|
---|
246 | </td>
|
---|
247 | </tr>
|
---|
248 | </xsl:for-each>
|
---|
249 | </table>
|
---|
250 | </xsl:if>
|
---|
251 | </xsl:template>
|
---|
252 |
|
---|
253 |
|
---|
254 | <!--
|
---|
255 | * comment for interfaces
|
---|
256 | -->
|
---|
257 | <xsl:template match="interface/desc">
|
---|
258 | <xsl:apply-templates select="." mode="begin"/>
|
---|
259 | <xsl:apply-templates select="." mode="middle"/>
|
---|
260 | @par Interface ID:
|
---|
261 | <tt>{<xsl:call-template name="str:to-upper">
|
---|
262 | <xsl:with-param name="text" select="../@uuid"/>
|
---|
263 | </xsl:call-template>}</tt>
|
---|
264 | <xsl:text>
*/
</xsl:text>
|
---|
265 | </xsl:template>
|
---|
266 |
|
---|
267 | <!--
|
---|
268 | * comment for attributes
|
---|
269 | -->
|
---|
270 | <xsl:template match="attribute/desc">
|
---|
271 | <xsl:apply-templates select="." mode="begin"/>
|
---|
272 | <xsl:apply-templates select="text() | *[not(self::note or self::see or self::result)]"/>
|
---|
273 | <xsl:apply-templates select="." mode="results"/>
|
---|
274 | <xsl:apply-templates select="note"/>
|
---|
275 | <xsl:if test="../@mod='ptr'">
|
---|
276 | <xsl:text>
|
---|
277 |
|
---|
278 | @warning This attribute is non-scriptable. In particular, this also means that an
|
---|
279 | attempt to get or set it from a process other than the process that has created and
|
---|
280 | owns the object will most likely fail or crash your application.
|
---|
281 | </xsl:text>
|
---|
282 | </xsl:if>
|
---|
283 | <xsl:apply-templates select="see"/>
|
---|
284 | <xsl:text>
*/
</xsl:text>
|
---|
285 | </xsl:template>
|
---|
286 |
|
---|
287 | <!--
|
---|
288 | * comment for methods
|
---|
289 | -->
|
---|
290 | <xsl:template match="method/desc">
|
---|
291 | <xsl:apply-templates select="." mode="begin"/>
|
---|
292 | <xsl:apply-templates select="text() | *[not(self::note or self::see or self::result)]"/>
|
---|
293 | <xsl:for-each select="../param">
|
---|
294 | <xsl:apply-templates select="desc"/>
|
---|
295 | </xsl:for-each>
|
---|
296 | <xsl:apply-templates select="." mode="results"/>
|
---|
297 | <xsl:apply-templates select="note"/>
|
---|
298 | <xsl:apply-templates select="../param/desc/note"/>
|
---|
299 | <xsl:if test="../param/@mod='ptr'">
|
---|
300 | <xsl:text>
|
---|
301 |
|
---|
302 | @warning This method is non-scriptable. In particular, this also means that an
|
---|
303 | attempt to call it from a process other than the process that has created and
|
---|
304 | owns the object will most likely fail or crash your application.
|
---|
305 | </xsl:text>
|
---|
306 | </xsl:if>
|
---|
307 | <xsl:apply-templates select="see"/>
|
---|
308 | <xsl:text>
*/
</xsl:text>
|
---|
309 | </xsl:template>
|
---|
310 |
|
---|
311 | <!--
|
---|
312 | * comment for method parameters
|
---|
313 | -->
|
---|
314 | <xsl:template match="method/param/desc">
|
---|
315 | <xsl:text>
@param </xsl:text>
|
---|
316 | <xsl:value-of select="../@name"/>
|
---|
317 | <xsl:text> </xsl:text>
|
---|
318 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
319 | <xsl:text>
</xsl:text>
|
---|
320 | </xsl:template>
|
---|
321 |
|
---|
322 | <!--
|
---|
323 | * comment for enums
|
---|
324 | -->
|
---|
325 | <xsl:template match="enum/desc">
|
---|
326 | <xsl:apply-templates select="." mode="begin"/>
|
---|
327 | <xsl:apply-templates select="." mode="middle"/>
|
---|
328 | @par Interface ID:
|
---|
329 | <tt>{<xsl:call-template name="str:to-upper">
|
---|
330 | <xsl:with-param name="text" select="../@uuid"/>
|
---|
331 | </xsl:call-template>}</tt>
|
---|
332 | <xsl:text>
*/
</xsl:text>
|
---|
333 | </xsl:template>
|
---|
334 |
|
---|
335 | <!--
|
---|
336 | * comment for enum values
|
---|
337 | -->
|
---|
338 | <xsl:template match="enum/const/desc">
|
---|
339 | <xsl:apply-templates select="." mode="begin_brief"/>
|
---|
340 | <xsl:apply-templates select="." mode="middle"/>
|
---|
341 | <xsl:text>
*/
</xsl:text>
|
---|
342 | </xsl:template>
|
---|
343 |
|
---|
344 | <!--
|
---|
345 | * comment for result codes
|
---|
346 | -->
|
---|
347 | <xsl:template match="result/desc">
|
---|
348 | <xsl:apply-templates select="." mode="begin_brief"/>
|
---|
349 | <xsl:apply-templates select="." mode="middle"/>
|
---|
350 | <xsl:text>
*/
</xsl:text>
|
---|
351 | </xsl:template>
|
---|
352 |
|
---|
353 | <!--
|
---|
354 | * ignore descGroups by default (processed in /idl)
|
---|
355 | -->
|
---|
356 | <xsl:template match="descGroup"/>
|
---|
357 |
|
---|
358 | <!--
|
---|
359 | // templates
|
---|
360 | /////////////////////////////////////////////////////////////////////////////
|
---|
361 | -->
|
---|
362 |
|
---|
363 |
|
---|
364 | <!--
|
---|
365 | * header
|
---|
366 | -->
|
---|
367 | <xsl:template match="/idl">
|
---|
368 | /*
|
---|
369 | * DO NOT EDIT! This is a generated file.
|
---|
370 | *
|
---|
371 | * Doxygen IDL definition for VirtualBox Main API (COM interfaces)
|
---|
372 | * generated from XIDL (XML interface definition).
|
---|
373 | *
|
---|
374 | * Source : src/VBox/Main/idl/VirtualBox.xidl
|
---|
375 | * Generator : src/VBox/Main/idl/doxygen.xsl
|
---|
376 | *
|
---|
377 | * This IDL is generated using some generic OMG IDL-like syntax SOLELY
|
---|
378 | * for the purpose of generating the documentation using Doxygen and
|
---|
379 | * is not syntactically valid.
|
---|
380 | *
|
---|
381 | * DO NOT USE THIS HEADER IN ANY OTHER WAY!
|
---|
382 | */
|
---|
383 |
|
---|
384 | <!-- general description -->
|
---|
385 | <xsl:text>/** @mainpage 
</xsl:text>
|
---|
386 | <xsl:apply-templates select="desc" mode="middle"/>
|
---|
387 | <xsl:text>
*/
</xsl:text>
|
---|
388 |
|
---|
389 | <!-- group (module) definitions -->
|
---|
390 | <xsl:for-each select="//descGroup">
|
---|
391 | <xsl:if test="@id and (@title or desc)">
|
---|
392 | <xsl:value-of select="concat('/** @defgroup ',@id,' ',@title)"/>
|
---|
393 | <xsl:apply-templates select="desc" mode="middle"/>
|
---|
394 | <xsl:text>
*/
</xsl:text>
|
---|
395 | </xsl:if>
|
---|
396 | </xsl:for-each>
|
---|
397 |
|
---|
398 | <!-- everything else -->
|
---|
399 | <xsl:apply-templates select="*[not(self::desc)]"/>
|
---|
400 |
|
---|
401 | </xsl:template>
|
---|
402 |
|
---|
403 |
|
---|
404 | <!--
|
---|
405 | * accept all <if>s
|
---|
406 | -->
|
---|
407 | <xsl:template match="if">
|
---|
408 | <xsl:apply-templates/>
|
---|
409 | </xsl:template>
|
---|
410 |
|
---|
411 |
|
---|
412 | <!--
|
---|
413 | * cpp_quote (ignore)
|
---|
414 | -->
|
---|
415 | <xsl:template match="cpp">
|
---|
416 | </xsl:template>
|
---|
417 |
|
---|
418 |
|
---|
419 | <!--
|
---|
420 | * #ifdef statement (@if attribute)
|
---|
421 | -->
|
---|
422 | <xsl:template match="@if" mode="begin">
|
---|
423 | <xsl:text>#if </xsl:text>
|
---|
424 | <xsl:value-of select="."/>
|
---|
425 | <xsl:text>
</xsl:text>
|
---|
426 | </xsl:template>
|
---|
427 | <xsl:template match="@if" mode="end">
|
---|
428 | <xsl:text>#endif
</xsl:text>
|
---|
429 | </xsl:template>
|
---|
430 |
|
---|
431 |
|
---|
432 | <!--
|
---|
433 | * libraries
|
---|
434 | -->
|
---|
435 | <xsl:template match="application">
|
---|
436 | <!-- result codes -->
|
---|
437 | <xsl:for-each select="result">
|
---|
438 | <xsl:apply-templates select="."/>
|
---|
439 | </xsl:for-each>
|
---|
440 | <!-- all enums go first -->
|
---|
441 | <xsl:apply-templates select="enum | if/enum"/>
|
---|
442 | <!-- everything else but result codes and enums -->
|
---|
443 | <xsl:apply-templates select="*[not(self::result or self::enum) and
|
---|
444 | not(self::if[result] or self::if[enum])]"/>
|
---|
445 | </xsl:template>
|
---|
446 |
|
---|
447 |
|
---|
448 | <!--
|
---|
449 | * result codes
|
---|
450 | -->
|
---|
451 | <xsl:template match="application//result">
|
---|
452 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
453 | <xsl:apply-templates select="desc"/>
|
---|
454 | <xsl:value-of select="concat('const HRESULT ',@name,' = ',@value,';')"/>
|
---|
455 | <xsl:text>
</xsl:text>
|
---|
456 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
457 | </xsl:template>
|
---|
458 |
|
---|
459 |
|
---|
460 | <!--
|
---|
461 | * interfaces
|
---|
462 | -->
|
---|
463 | <xsl:template match="interface">
|
---|
464 | <xsl:apply-templates select="desc"/>
|
---|
465 | <xsl:text>interface </xsl:text>
|
---|
466 | <xsl:value-of select="@name"/>
|
---|
467 | <xsl:text> : </xsl:text>
|
---|
468 | <xsl:value-of select="@extends"/>
|
---|
469 | <xsl:text>
{
</xsl:text>
|
---|
470 | <!-- attributes (properties) -->
|
---|
471 | <xsl:apply-templates select="attribute"/>
|
---|
472 | <!-- methods -->
|
---|
473 | <xsl:apply-templates select="method"/>
|
---|
474 | <!-- 'if' enclosed elements, unsorted -->
|
---|
475 | <xsl:apply-templates select="if"/>
|
---|
476 | <!-- -->
|
---|
477 | <xsl:text>}; /* interface </xsl:text>
|
---|
478 | <xsl:value-of select="@name"/>
|
---|
479 | <xsl:text> */

</xsl:text>
|
---|
480 | </xsl:template>
|
---|
481 |
|
---|
482 |
|
---|
483 | <!--
|
---|
484 | * attributes
|
---|
485 | -->
|
---|
486 | <xsl:template match="interface//attribute">
|
---|
487 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
488 | <xsl:apply-templates select="desc"/>
|
---|
489 | <xsl:text> </xsl:text>
|
---|
490 | <xsl:if test="@readonly='yes'">
|
---|
491 | <xsl:text>readonly </xsl:text>
|
---|
492 | </xsl:if>
|
---|
493 | <xsl:text>attribute </xsl:text>
|
---|
494 | <xsl:apply-templates select="@type"/>
|
---|
495 | <xsl:text> </xsl:text>
|
---|
496 | <xsl:value-of select="@name"/>
|
---|
497 | <xsl:text>;
</xsl:text>
|
---|
498 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
499 | <xsl:text>
</xsl:text>
|
---|
500 | </xsl:template>
|
---|
501 |
|
---|
502 | <!--
|
---|
503 | * methods
|
---|
504 | -->
|
---|
505 | <xsl:template match="interface//method">
|
---|
506 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
507 | <xsl:apply-templates select="desc"/>
|
---|
508 | <xsl:text> void </xsl:text>
|
---|
509 | <xsl:value-of select="@name"/>
|
---|
510 | <xsl:if test="param">
|
---|
511 | <xsl:text> (
</xsl:text>
|
---|
512 | <xsl:for-each select="param [position() != last()]">
|
---|
513 | <xsl:text> </xsl:text>
|
---|
514 | <xsl:apply-templates select="."/>
|
---|
515 | <xsl:text>,
</xsl:text>
|
---|
516 | </xsl:for-each>
|
---|
517 | <xsl:text> </xsl:text>
|
---|
518 | <xsl:apply-templates select="param [last()]"/>
|
---|
519 | <xsl:text>
 );
</xsl:text>
|
---|
520 | </xsl:if>
|
---|
521 | <xsl:if test="not(param)">
|
---|
522 | <xsl:text>();
</xsl:text>
|
---|
523 | </xsl:if>
|
---|
524 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
525 | <xsl:text>
</xsl:text>
|
---|
526 | </xsl:template>
|
---|
527 |
|
---|
528 |
|
---|
529 | <!--
|
---|
530 | * co-classes
|
---|
531 | -->
|
---|
532 | <xsl:template match="module/class">
|
---|
533 | <!-- class and contract id: later -->
|
---|
534 | <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32: later -->
|
---|
535 | </xsl:template>
|
---|
536 |
|
---|
537 |
|
---|
538 | <!--
|
---|
539 | * enums
|
---|
540 | -->
|
---|
541 | <xsl:template match="enum">
|
---|
542 | <xsl:apply-templates select="desc"/>
|
---|
543 | <xsl:text>enum </xsl:text>
|
---|
544 | <xsl:value-of select="@name"/>
|
---|
545 | <xsl:text>
{
</xsl:text>
|
---|
546 | <xsl:for-each select="const">
|
---|
547 | <xsl:apply-templates select="desc"/>
|
---|
548 | <xsl:text> </xsl:text>
|
---|
549 | <xsl:value-of select="../@name"/>
|
---|
550 | <xsl:text>_</xsl:text>
|
---|
551 | <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
|
---|
552 | <xsl:text>,
</xsl:text>
|
---|
553 | </xsl:for-each>
|
---|
554 | <xsl:text>};

</xsl:text>
|
---|
555 | </xsl:template>
|
---|
556 |
|
---|
557 |
|
---|
558 | <!--
|
---|
559 | * method parameters
|
---|
560 | -->
|
---|
561 | <xsl:template match="method/param">
|
---|
562 | <xsl:choose>
|
---|
563 | <xsl:when test="@dir='in'">in </xsl:when>
|
---|
564 | <xsl:when test="@dir='out'">out </xsl:when>
|
---|
565 | <xsl:when test="@dir='return'">[retval] out </xsl:when>
|
---|
566 | <xsl:otherwise>in</xsl:otherwise>
|
---|
567 | </xsl:choose>
|
---|
568 | <xsl:apply-templates select="@type"/>
|
---|
569 | <xsl:text> </xsl:text>
|
---|
570 | <xsl:value-of select="@name"/>
|
---|
571 | </xsl:template>
|
---|
572 |
|
---|
573 |
|
---|
574 | <!--
|
---|
575 | * attribute/parameter type conversion
|
---|
576 | -->
|
---|
577 | <xsl:template match="attribute/@type | param/@type">
|
---|
578 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
579 |
|
---|
580 | <xsl:choose>
|
---|
581 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
582 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
583 | <xsl:choose>
|
---|
584 | <xsl:when test="../@mod='ptr'">
|
---|
585 | <xsl:choose>
|
---|
586 | <!-- standard types -->
|
---|
587 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
588 | <xsl:when test=".='boolean'">booleanPtr</xsl:when>
|
---|
589 | <xsl:when test=".='octet'">octetPtr</xsl:when>
|
---|
590 | <xsl:when test=".='short'">shortPtr</xsl:when>
|
---|
591 | <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
|
---|
592 | <xsl:when test=".='long'">longPtr</xsl:when>
|
---|
593 | <xsl:when test=".='long long'">llongPtr</xsl:when>
|
---|
594 | <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
|
---|
595 | <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
|
---|
596 | <xsl:otherwise>
|
---|
597 | <xsl:message terminate="yes">
|
---|
598 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
599 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
600 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
601 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
602 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
603 | </xsl:message>
|
---|
604 | </xsl:otherwise>
|
---|
605 | </xsl:choose>
|
---|
606 | </xsl:when>
|
---|
607 | <xsl:when test="../@mod='string'">
|
---|
608 | <xsl:choose>
|
---|
609 | <!-- standard types -->
|
---|
610 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
611 | <xsl:when test=".='uuid'">wstringUUID</xsl:when>
|
---|
612 | <xsl:otherwise>
|
---|
613 | <xsl:message terminate="yes">
|
---|
614 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
615 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
616 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
617 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
618 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
619 | </xsl:message>
|
---|
620 | </xsl:otherwise>
|
---|
621 | </xsl:choose>
|
---|
622 | </xsl:when>
|
---|
623 | <xsl:otherwise>
|
---|
624 | <xsl:message terminate="yes">
|
---|
625 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
626 | <xsl:value-of select="concat('value "',../@mod,'" ')"/>
|
---|
627 | <xsl:text>of attribute 'mod' is invalid!</xsl:text>
|
---|
628 | </xsl:message>
|
---|
629 | </xsl:otherwise>
|
---|
630 | </xsl:choose>
|
---|
631 | </xsl:when>
|
---|
632 | <!-- no modifiers -->
|
---|
633 | <xsl:otherwise>
|
---|
634 | <xsl:choose>
|
---|
635 | <!-- standard types -->
|
---|
636 | <xsl:when test=".='result'">result</xsl:when>
|
---|
637 | <xsl:when test=".='boolean'">boolean</xsl:when>
|
---|
638 | <xsl:when test=".='octet'">octet</xsl:when>
|
---|
639 | <xsl:when test=".='short'">short</xsl:when>
|
---|
640 | <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
|
---|
641 | <xsl:when test=".='long'">long</xsl:when>
|
---|
642 | <xsl:when test=".='long long'">long long</xsl:when>
|
---|
643 | <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
|
---|
644 | <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
|
---|
645 | <xsl:when test=".='char'">char</xsl:when>
|
---|
646 | <xsl:when test=".='wchar'">wchar</xsl:when>
|
---|
647 | <xsl:when test=".='string'">string</xsl:when>
|
---|
648 | <xsl:when test=".='wstring'">wstring</xsl:when>
|
---|
649 | <!-- UUID type -->
|
---|
650 | <xsl:when test=".='uuid'">uuid</xsl:when>
|
---|
651 | <!-- system interface types -->
|
---|
652 | <xsl:when test=".='$unknown'">$unknown</xsl:when>
|
---|
653 | <xsl:otherwise>
|
---|
654 | <xsl:choose>
|
---|
655 | <!-- enum types -->
|
---|
656 | <xsl:when test="
|
---|
657 | (ancestor::library/application/enum[@name=current()])
|
---|
658 | or (ancestor::library/if/application/enum[@name=current()])
|
---|
659 | or (ancestor::library/application/if[@target=$self_target]/enum[@name=current()])
|
---|
660 | or (ancestor::library/if/application/if[@target=$self_target]/enum[@name=current()])
|
---|
661 | ">
|
---|
662 | <xsl:value-of select="."/>
|
---|
663 | </xsl:when>
|
---|
664 | <!-- custom interface types -->
|
---|
665 | <xsl:when test="
|
---|
666 | ( (ancestor::library/application/interface[@name=current()])
|
---|
667 | or (ancestor::library/if/application/interface[@name=current()])
|
---|
668 | or (ancestor::library/application/if[@target=$self_target]/interface[@name=current()])
|
---|
669 | or (ancestor::library/if/application/if[@target=$self_target]/interface[@name=current()])
|
---|
670 | )
|
---|
671 | ">
|
---|
672 | <xsl:value-of select="."/>
|
---|
673 | </xsl:when>
|
---|
674 | <!-- other types -->
|
---|
675 | <xsl:otherwise>
|
---|
676 | <xsl:message terminate="yes">
|
---|
677 | <xsl:text>Unknown parameter type: </xsl:text>
|
---|
678 | <xsl:value-of select="."/>
|
---|
679 | </xsl:message>
|
---|
680 | </xsl:otherwise>
|
---|
681 | </xsl:choose>
|
---|
682 | </xsl:otherwise>
|
---|
683 | </xsl:choose>
|
---|
684 | </xsl:otherwise>
|
---|
685 | </xsl:choose>
|
---|
686 | <xsl:if test="../@safearray='yes'">
|
---|
687 | <xsl:text>[]</xsl:text>
|
---|
688 | </xsl:if>
|
---|
689 | </xsl:template>
|
---|
690 |
|
---|
691 | </xsl:stylesheet>
|
---|
692 |
|
---|