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-2007 innotek GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
14 | in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | -->
|
---|
18 |
|
---|
19 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
---|
20 | <xsl:output method="html" indent="yes"/>
|
---|
21 |
|
---|
22 | <xsl:strip-space elements="*"/>
|
---|
23 |
|
---|
24 |
|
---|
25 | <!--
|
---|
26 | // helper definitions
|
---|
27 | /////////////////////////////////////////////////////////////////////////////
|
---|
28 | -->
|
---|
29 |
|
---|
30 | <!--
|
---|
31 | * uncapitalizes the first letter only if the second one is not capital
|
---|
32 | * otherwise leaves the string unchanged
|
---|
33 | -->
|
---|
34 | <xsl:template name="uncapitalize">
|
---|
35 | <xsl:param name="str" select="."/>
|
---|
36 | <xsl:choose>
|
---|
37 | <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
|
---|
38 | <xsl:value-of select="
|
---|
39 | concat(
|
---|
40 | translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
|
---|
41 | substring($str,2)
|
---|
42 | )
|
---|
43 | "/>
|
---|
44 | </xsl:when>
|
---|
45 | <xsl:otherwise>
|
---|
46 | <xsl:value-of select="string($str)"/>
|
---|
47 | </xsl:otherwise>
|
---|
48 | </xsl:choose>
|
---|
49 | </xsl:template>
|
---|
50 |
|
---|
51 | <!--
|
---|
52 | * translates the string to uppercase
|
---|
53 | -->
|
---|
54 | <xsl:template name="uppercase">
|
---|
55 | <xsl:param name="str" select="."/>
|
---|
56 | <xsl:value-of select="
|
---|
57 | translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
---|
58 | "/>
|
---|
59 | </xsl:template>
|
---|
60 |
|
---|
61 |
|
---|
62 | <!--
|
---|
63 | // Doxygen transformation rules
|
---|
64 | /////////////////////////////////////////////////////////////////////////////
|
---|
65 | -->
|
---|
66 |
|
---|
67 | <!--
|
---|
68 | * all text elements that are not explicitly matched are normalized
|
---|
69 | * (all whitespace chars are converted to single spaces)
|
---|
70 | -->
|
---|
71 | <!--xsl:template match="desc//text()">
|
---|
72 | <xsl:value-of select="concat(' ',normalize-space(.),' ')"/>
|
---|
73 | </xsl:template-->
|
---|
74 |
|
---|
75 | <!--
|
---|
76 | * all elements that are not explicitly matched are considered to be html tags
|
---|
77 | * and copied w/o modifications
|
---|
78 | -->
|
---|
79 | <xsl:template match="desc//*">
|
---|
80 | <xsl:copy>
|
---|
81 | <xsl:apply-templates/>
|
---|
82 | </xsl:copy>
|
---|
83 | </xsl:template>
|
---|
84 |
|
---|
85 | <!--
|
---|
86 | * paragraph
|
---|
87 | -->
|
---|
88 | <xsl:template match="desc//p">
|
---|
89 | <xsl:text>
</xsl:text>
|
---|
90 | <xsl:apply-templates/>
|
---|
91 | <xsl:text>
</xsl:text>
|
---|
92 | </xsl:template>
|
---|
93 |
|
---|
94 | <!--
|
---|
95 | * link
|
---|
96 | -->
|
---|
97 | <xsl:template match="desc//link">
|
---|
98 | <xsl:text>@link </xsl:text>
|
---|
99 | <!--
|
---|
100 | * sometimes Doxygen is stupid and cannot resolve global enums properly,
|
---|
101 | * thinking they are members of the current class. Fix it by adding ::
|
---|
102 | * in front of any @to value that doesn't start with #.
|
---|
103 | -->
|
---|
104 | <xsl:choose>
|
---|
105 | <xsl:when test="not(starts-with(@to, '#')) and not(contains(@to, '::'))">
|
---|
106 | <xsl:text>::</xsl:text>
|
---|
107 | </xsl:when>
|
---|
108 | </xsl:choose>
|
---|
109 | <!--
|
---|
110 | * Doxygen doesn't understand autolinks like Class::func() if Class
|
---|
111 | * doesn't actually contain a func with no arguments. Fix it.
|
---|
112 | -->
|
---|
113 | <xsl:choose>
|
---|
114 | <xsl:when test="substring(@to, string-length(@to)-1)='()'">
|
---|
115 | <xsl:value-of select="substring-before(@to, '()')"/>
|
---|
116 | </xsl:when>
|
---|
117 | <xsl:otherwise>
|
---|
118 | <xsl:value-of select="@to"/>
|
---|
119 | </xsl:otherwise>
|
---|
120 | </xsl:choose>
|
---|
121 | <xsl:text> </xsl:text>
|
---|
122 | <xsl:choose>
|
---|
123 | <xsl:when test="normalize-space(text())">
|
---|
124 | <xsl:value-of select="normalize-space(text())"/>
|
---|
125 | </xsl:when>
|
---|
126 | <xsl:otherwise>
|
---|
127 | <xsl:choose>
|
---|
128 | <xsl:when test="starts-with(@to, '#')">
|
---|
129 | <xsl:value-of select="substring-after(@to, '#')"/>
|
---|
130 | </xsl:when>
|
---|
131 | <xsl:when test="starts-with(@to, '::')">
|
---|
132 | <xsl:value-of select="substring-after(@to, '::')"/>
|
---|
133 | </xsl:when>
|
---|
134 | <xsl:otherwise>
|
---|
135 | <xsl:value-of select="@to"/>
|
---|
136 | </xsl:otherwise>
|
---|
137 | </xsl:choose>
|
---|
138 | </xsl:otherwise>
|
---|
139 | </xsl:choose>
|
---|
140 | <xsl:text>@endlink</xsl:text>
|
---|
141 | <!--
|
---|
142 | * insert a dummy empty B element to distinctly separate @endlink
|
---|
143 | * from the following text
|
---|
144 | -->
|
---|
145 | <xsl:element name="b"/>
|
---|
146 | </xsl:template>
|
---|
147 |
|
---|
148 | <!--
|
---|
149 | * note
|
---|
150 | -->
|
---|
151 | <xsl:template match="desc/note">
|
---|
152 | <xsl:text>
@note </xsl:text>
|
---|
153 | <xsl:apply-templates/>
|
---|
154 | <xsl:text>
</xsl:text>
|
---|
155 | </xsl:template>
|
---|
156 |
|
---|
157 | <!--
|
---|
158 | * see
|
---|
159 | -->
|
---|
160 | <xsl:template match="desc/see">
|
---|
161 | <xsl:text>
@see </xsl:text>
|
---|
162 | <xsl:apply-templates/>
|
---|
163 | <xsl:text>
</xsl:text>
|
---|
164 | </xsl:template>
|
---|
165 |
|
---|
166 | <!--
|
---|
167 | * comment for interfaces
|
---|
168 | -->
|
---|
169 | <xsl:template match="interface/desc">
|
---|
170 | <xsl:text>/**
</xsl:text>
|
---|
171 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
172 | <xsl:apply-templates select="note"/>
|
---|
173 | <xsl:apply-templates select="see"/>
|
---|
174 | @par Interface ID:
|
---|
175 | <tt>{<xsl:call-template name="uppercase">
|
---|
176 | <xsl:with-param name="str" select="../@uuid"/>
|
---|
177 | </xsl:call-template>}</tt>
|
---|
178 | <xsl:text>
*/
</xsl:text>
|
---|
179 | </xsl:template>
|
---|
180 |
|
---|
181 | <!--
|
---|
182 | * comment for attributes
|
---|
183 | -->
|
---|
184 | <xsl:template match="attribute/desc">
|
---|
185 | <xsl:text>/**
</xsl:text>
|
---|
186 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
187 | <xsl:apply-templates select="note"/>
|
---|
188 | <xsl:if test="../@mod='ptr'">
|
---|
189 | <xsl:text>
|
---|
190 |
|
---|
191 | @warning This attribute is non-scriptable. In particluar, this also means that an
|
---|
192 | attempt to get or set it from a process other than the process that has created and
|
---|
193 | owns the object will most likely fail or crash your application.
|
---|
194 | </xsl:text>
|
---|
195 | </xsl:if>
|
---|
196 | <xsl:apply-templates select="see"/>
|
---|
197 | <xsl:text>
*/
</xsl:text>
|
---|
198 | </xsl:template>
|
---|
199 |
|
---|
200 | <!--
|
---|
201 | * comment for methods
|
---|
202 | -->
|
---|
203 | <xsl:template match="method/desc">
|
---|
204 | <xsl:text>/**
</xsl:text>
|
---|
205 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
206 | <xsl:for-each select="../param">
|
---|
207 | <xsl:apply-templates select="desc"/>
|
---|
208 | </xsl:for-each>
|
---|
209 | <xsl:apply-templates select="note"/>
|
---|
210 | <xsl:apply-templates select="../param/desc/note"/>
|
---|
211 | <xsl:if test="../param/@mod='ptr'">
|
---|
212 | <xsl:text>
|
---|
213 |
|
---|
214 | @warning This method is non-scriptable. In particluar, this also means that an
|
---|
215 | attempt to call it from a process other than the process that has created and
|
---|
216 | owns the object will most likely fail or crash your application.
|
---|
217 | </xsl:text>
|
---|
218 | </xsl:if>
|
---|
219 | <xsl:apply-templates select="see"/>
|
---|
220 | <xsl:text>
*/
</xsl:text>
|
---|
221 | </xsl:template>
|
---|
222 |
|
---|
223 | <!--
|
---|
224 | * comment for method parameters
|
---|
225 | -->
|
---|
226 | <xsl:template match="method/param/desc">
|
---|
227 | <xsl:text>
@param </xsl:text>
|
---|
228 | <xsl:value-of select="../@name"/>
|
---|
229 | <xsl:text> </xsl:text>
|
---|
230 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
231 | <xsl:text>
</xsl:text>
|
---|
232 | </xsl:template>
|
---|
233 |
|
---|
234 | <!--
|
---|
235 | * comment for interfaces
|
---|
236 | -->
|
---|
237 | <xsl:template match="enum/desc">
|
---|
238 | <xsl:text>/**
</xsl:text>
|
---|
239 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
240 | <xsl:apply-templates select="note"/>
|
---|
241 | <xsl:apply-templates select="see"/>
|
---|
242 | @par Interface ID:
|
---|
243 | <tt>{<xsl:call-template name="uppercase">
|
---|
244 | <xsl:with-param name="str" select="../@uuid"/>
|
---|
245 | </xsl:call-template>}</tt>
|
---|
246 | <xsl:text>
*/
</xsl:text>
|
---|
247 | </xsl:template>
|
---|
248 |
|
---|
249 | <!--
|
---|
250 | * comment for enum values
|
---|
251 | -->
|
---|
252 | <xsl:template match="enum/const/desc">
|
---|
253 | <xsl:text>/** @brief </xsl:text>
|
---|
254 | <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
|
---|
255 | <xsl:apply-templates select="note"/>
|
---|
256 | <xsl:apply-templates select="see"/>
|
---|
257 | <xsl:text>
*/
</xsl:text>
|
---|
258 | </xsl:template>
|
---|
259 |
|
---|
260 | <!--
|
---|
261 | // templates
|
---|
262 | /////////////////////////////////////////////////////////////////////////////
|
---|
263 | -->
|
---|
264 |
|
---|
265 |
|
---|
266 | <!--
|
---|
267 | * header
|
---|
268 | -->
|
---|
269 | <xsl:template match="/idl">
|
---|
270 | /*
|
---|
271 | * DO NOT EDIT! This is a generated file.
|
---|
272 | *
|
---|
273 | * Doxygen IDL definition for VirualBox Main API (COM interfaces)
|
---|
274 | * generated from XIDL (XML interface definition).
|
---|
275 | *
|
---|
276 | * Source : src/VBox/Main/idl/VirtualBox.xidl
|
---|
277 | * Generator : src/VBox/Main/idl/doxygen.xsl
|
---|
278 | *
|
---|
279 | * This IDL is generated using some generic OMG IDL-like syntax SOLELY
|
---|
280 | * for the purpose of generating the documentation using Doxygen and
|
---|
281 | * is not syntactically valid.
|
---|
282 | *
|
---|
283 | * DO NOT USE THIS HEADER IN ANY OTHER WAY!
|
---|
284 | */
|
---|
285 |
|
---|
286 | /** @mainpage
|
---|
287 | *
|
---|
288 | * This documentation describes all public COM interfaces and components
|
---|
289 | * provided by the VirtualBox server and by the VirtualBox client library.
|
---|
290 | * Together, these interfaces and components comprise the so-called
|
---|
291 | * <i>VirtualBox Main API</i> intended to control both the VirtualBox server
|
---|
292 | * process and processes executing individual virtual machines using
|
---|
293 | * COM techniques.
|
---|
294 | *
|
---|
295 | * On Windows platforms, the VirtualBox Main API uses Microsoft COM, a native COM
|
---|
296 | * implementation. On all other platforms, Mozilla XPCOM, an open-source COM
|
---|
297 | * implementation, is used.
|
---|
298 | *
|
---|
299 | * @note The source IDL file (VirtualBox.idl) this documentation refers to is
|
---|
300 | * automatically generated from the generic interface definition file (used
|
---|
301 | * to define all interfaces in a platform-independent way) and uses some generic
|
---|
302 | * OMG IDL-like syntax <b>solely</b> for the purpose of generating this
|
---|
303 | * platform-independent documentation. This generated file is not a syntactically
|
---|
304 | * valid IDL file and <b>must not</b> be used for programming.
|
---|
305 | *
|
---|
306 | * @todo Later, the documentation will contain platform-dependent IDL and C++
|
---|
307 | * prototypes of methods of all interfaces, for convenience.
|
---|
308 | *
|
---|
309 | * @todo Some interfaces are completely platform-specific. This will be also
|
---|
310 | * mentioned in the documentation.
|
---|
311 | */
|
---|
312 | <xsl:text>
</xsl:text>
|
---|
313 | <xsl:apply-templates/>
|
---|
314 | </xsl:template>
|
---|
315 |
|
---|
316 |
|
---|
317 | <!--
|
---|
318 | * accept all <if>s
|
---|
319 | -->
|
---|
320 | <xsl:template match="if">
|
---|
321 | <xsl:apply-templates/>
|
---|
322 | </xsl:template>
|
---|
323 |
|
---|
324 |
|
---|
325 | <!--
|
---|
326 | * cpp_quote (ignore)
|
---|
327 | -->
|
---|
328 | <xsl:template match="cpp">
|
---|
329 | </xsl:template>
|
---|
330 |
|
---|
331 |
|
---|
332 | <!--
|
---|
333 | * #ifdef statement (@if attribute)
|
---|
334 | -->
|
---|
335 | <xsl:template match="@if" mode="begin">
|
---|
336 | <xsl:text>#if </xsl:text>
|
---|
337 | <xsl:value-of select="."/>
|
---|
338 | <xsl:text>
</xsl:text>
|
---|
339 | </xsl:template>
|
---|
340 | <xsl:template match="@if" mode="end">
|
---|
341 | <xsl:text>#endif
</xsl:text>
|
---|
342 | </xsl:template>
|
---|
343 |
|
---|
344 |
|
---|
345 | <!--
|
---|
346 | * libraries
|
---|
347 | -->
|
---|
348 | <xsl:template match="library">
|
---|
349 | <!-- all enums go first -->
|
---|
350 | <xsl:apply-templates select="enum | if/enum"/>
|
---|
351 | <!-- everything else but enums -->
|
---|
352 | <xsl:apply-templates select="*[not(self::enum) and not(self::if[enum])]"/>
|
---|
353 | </xsl:template>
|
---|
354 |
|
---|
355 |
|
---|
356 | <!--
|
---|
357 | * interfaces
|
---|
358 | -->
|
---|
359 | <xsl:template match="interface">
|
---|
360 | <xsl:apply-templates select="desc"/>
|
---|
361 | <xsl:text>interface </xsl:text>
|
---|
362 | <xsl:value-of select="@name"/>
|
---|
363 | <xsl:text> : </xsl:text>
|
---|
364 | <xsl:value-of select="@extends"/>
|
---|
365 | <xsl:text>
{
</xsl:text>
|
---|
366 | <!-- attributes (properties) -->
|
---|
367 | <xsl:apply-templates select="attribute"/>
|
---|
368 | <!-- methods -->
|
---|
369 | <xsl:apply-templates select="method"/>
|
---|
370 | <!-- 'if' enclosed elements, unsorted -->
|
---|
371 | <xsl:apply-templates select="if"/>
|
---|
372 | <!-- -->
|
---|
373 | <xsl:text>}; /* interface </xsl:text>
|
---|
374 | <xsl:value-of select="@name"/>
|
---|
375 | <xsl:text> */

</xsl:text>
|
---|
376 | </xsl:template>
|
---|
377 |
|
---|
378 |
|
---|
379 | <!--
|
---|
380 | * attributes
|
---|
381 | -->
|
---|
382 | <xsl:template match="interface//attribute | collection//attribute">
|
---|
383 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
384 | <xsl:apply-templates select="desc"/>
|
---|
385 | <xsl:text> </xsl:text>
|
---|
386 | <xsl:if test="@readonly='yes'">
|
---|
387 | <xsl:text>readonly </xsl:text>
|
---|
388 | </xsl:if>
|
---|
389 | <xsl:text>attribute </xsl:text>
|
---|
390 | <xsl:apply-templates select="@type"/>
|
---|
391 | <xsl:text> </xsl:text>
|
---|
392 | <xsl:value-of select="@name"/>
|
---|
393 | <xsl:text>;
</xsl:text>
|
---|
394 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
395 | <xsl:text>
</xsl:text>
|
---|
396 | </xsl:template>
|
---|
397 |
|
---|
398 | <!--
|
---|
399 | * methods
|
---|
400 | -->
|
---|
401 | <xsl:template match="interface//method | collection//method">
|
---|
402 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
403 | <xsl:apply-templates select="desc"/>
|
---|
404 | <xsl:text> void </xsl:text>
|
---|
405 | <xsl:value-of select="@name"/>
|
---|
406 | <xsl:if test="param">
|
---|
407 | <xsl:text> (
</xsl:text>
|
---|
408 | <xsl:for-each select="param [position() != last()]">
|
---|
409 | <xsl:text> </xsl:text>
|
---|
410 | <xsl:apply-templates select="."/>
|
---|
411 | <xsl:text>,
</xsl:text>
|
---|
412 | </xsl:for-each>
|
---|
413 | <xsl:text> </xsl:text>
|
---|
414 | <xsl:apply-templates select="param [last()]"/>
|
---|
415 | <xsl:text>
 );
</xsl:text>
|
---|
416 | </xsl:if>
|
---|
417 | <xsl:if test="not(param)">
|
---|
418 | <xsl:text>();
</xsl:text>
|
---|
419 | </xsl:if>
|
---|
420 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
421 | <xsl:text>
</xsl:text>
|
---|
422 | </xsl:template>
|
---|
423 |
|
---|
424 |
|
---|
425 | <!--
|
---|
426 | * co-classes
|
---|
427 | -->
|
---|
428 | <xsl:template match="module/class">
|
---|
429 | <!-- class and contract id: later -->
|
---|
430 | <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32: later -->
|
---|
431 | </xsl:template>
|
---|
432 |
|
---|
433 |
|
---|
434 | <!--
|
---|
435 | * enumerators
|
---|
436 | -->
|
---|
437 | <xsl:template match="enumerator">
|
---|
438 | <xsl:text>interface </xsl:text>
|
---|
439 | <xsl:value-of select="@name"/>
|
---|
440 | <xsl:text> : $unknown
{
</xsl:text>
|
---|
441 | <!-- HasMore -->
|
---|
442 | <xsl:text> void hasMore ([retval] out boolean more);

</xsl:text>
|
---|
443 | <!-- GetNext -->
|
---|
444 | <xsl:text> void getNext ([retval] out </xsl:text>
|
---|
445 | <xsl:apply-templates select="@type"/>
|
---|
446 | <xsl:text> next);

</xsl:text>
|
---|
447 | <!-- -->
|
---|
448 | <xsl:text>}; /* interface </xsl:text>
|
---|
449 | <xsl:value-of select="@name"/>
|
---|
450 | <xsl:text> */

</xsl:text>
|
---|
451 | </xsl:template>
|
---|
452 |
|
---|
453 |
|
---|
454 | <!--
|
---|
455 | * collections
|
---|
456 | -->
|
---|
457 | <xsl:template match="collection">
|
---|
458 | <xsl:if test="not(@readonly='yes')">
|
---|
459 | <xsl:message terminate="yes">
|
---|
460 | <xsl:value-of select="concat(@name,': ')"/>
|
---|
461 | <xsl:text>non-readonly collections are not currently supported</xsl:text>
|
---|
462 | </xsl:message>
|
---|
463 | </xsl:if>
|
---|
464 | <xsl:text>interface </xsl:text>
|
---|
465 | <xsl:value-of select="@name"/>
|
---|
466 | <xsl:text> : $unknown
{
</xsl:text>
|
---|
467 | <!-- Count -->
|
---|
468 | <xsl:text> readonly attribute unsigned long count;

</xsl:text>
|
---|
469 | <!-- GetItemAt -->
|
---|
470 | <xsl:text> void getItemAt (in unsigned long index, [retval] out </xsl:text>
|
---|
471 | <xsl:apply-templates select="@type"/>
|
---|
472 | <xsl:text> item);

</xsl:text>
|
---|
473 | <!-- Enumerate -->
|
---|
474 | <xsl:text> void enumerate ([retval] out </xsl:text>
|
---|
475 | <xsl:apply-templates select="@enumerator"/>
|
---|
476 | <xsl:text> enumerator);

</xsl:text>
|
---|
477 | <!-- other extra attributes (properties) -->
|
---|
478 | <xsl:apply-templates select="attribute"/>
|
---|
479 | <!-- other extra methods -->
|
---|
480 | <xsl:apply-templates select="method"/>
|
---|
481 | <!-- 'if' enclosed elements, unsorted -->
|
---|
482 | <xsl:apply-templates select="if"/>
|
---|
483 | <!-- -->
|
---|
484 | <xsl:text>}; /* interface </xsl:text>
|
---|
485 | <xsl:value-of select="@name"/>
|
---|
486 | <xsl:text> */

</xsl:text>
|
---|
487 | </xsl:template>
|
---|
488 |
|
---|
489 |
|
---|
490 | <!--
|
---|
491 | * enums
|
---|
492 | -->
|
---|
493 | <xsl:template match="enum">
|
---|
494 | <xsl:apply-templates select="desc"/>
|
---|
495 | <xsl:text>enum </xsl:text>
|
---|
496 | <xsl:value-of select="@name"/>
|
---|
497 | <xsl:text>
{
</xsl:text>
|
---|
498 | <xsl:for-each select="const">
|
---|
499 | <xsl:apply-templates select="desc"/>
|
---|
500 | <xsl:text> </xsl:text>
|
---|
501 | <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
|
---|
502 | <xsl:text>,
</xsl:text>
|
---|
503 | </xsl:for-each>
|
---|
504 | <xsl:text>};

</xsl:text>
|
---|
505 | </xsl:template>
|
---|
506 |
|
---|
507 |
|
---|
508 | <!--
|
---|
509 | * method parameters
|
---|
510 | -->
|
---|
511 | <xsl:template match="method/param">
|
---|
512 | <xsl:if test="@array">
|
---|
513 | <xsl:if test="@dir='return'">
|
---|
514 | <xsl:message terminate="yes">
|
---|
515 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
516 | <xsl:text>return array parameters are not currently supported</xsl:text>
|
---|
517 | </xsl:message>
|
---|
518 | </xsl:if>
|
---|
519 | <xsl:text>[array, </xsl:text>
|
---|
520 | <xsl:choose>
|
---|
521 | <xsl:when test="../param[@name=current()/@array]">
|
---|
522 | <xsl:if test="../param[@name=current()/@array]/@dir != @dir">
|
---|
523 | <xsl:message terminate="yes">
|
---|
524 | <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
|
---|
525 | <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/>
|
---|
526 | <xsl:text> must have the same direction</xsl:text>
|
---|
527 | </xsl:message>
|
---|
528 | </xsl:if>
|
---|
529 | <xsl:text>size_is(</xsl:text>
|
---|
530 | <xsl:if test="@dir='out'">
|
---|
531 | <xsl:text>, </xsl:text>
|
---|
532 | </xsl:if>
|
---|
533 | <xsl:if test="../param[@name=current()/@array]/@dir='out'">
|
---|
534 | <xsl:text>*</xsl:text>
|
---|
535 | </xsl:if>
|
---|
536 | <xsl:value-of select="@array"/>
|
---|
537 | <xsl:text>)</xsl:text>
|
---|
538 | </xsl:when>
|
---|
539 | <xsl:otherwise>
|
---|
540 | <xsl:message terminate="yes">
|
---|
541 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
542 | <xsl:text>array attribute refers to non-existent param: </xsl:text>
|
---|
543 | <xsl:value-of select="@array"/>
|
---|
544 | </xsl:message>
|
---|
545 | </xsl:otherwise>
|
---|
546 | </xsl:choose>
|
---|
547 | <xsl:text>] </xsl:text>
|
---|
548 | </xsl:if>
|
---|
549 | <xsl:choose>
|
---|
550 | <xsl:when test="@dir='in'">in </xsl:when>
|
---|
551 | <xsl:when test="@dir='out'">out </xsl:when>
|
---|
552 | <xsl:when test="@dir='return'">[retval] out </xsl:when>
|
---|
553 | <xsl:otherwise>in</xsl:otherwise>
|
---|
554 | </xsl:choose>
|
---|
555 | <xsl:apply-templates select="@type"/>
|
---|
556 | <xsl:text> </xsl:text>
|
---|
557 | <xsl:value-of select="@name"/>
|
---|
558 | </xsl:template>
|
---|
559 |
|
---|
560 |
|
---|
561 | <!--
|
---|
562 | * attribute/parameter type conversion
|
---|
563 | -->
|
---|
564 | <xsl:template match="
|
---|
565 | attribute/@type | param/@type |
|
---|
566 | enumerator/@type | collection/@type | collection/@enumerator
|
---|
567 | ">
|
---|
568 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
569 |
|
---|
570 | <xsl:choose>
|
---|
571 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
572 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
573 | <xsl:if test="../@array">
|
---|
574 | <xsl:message terminate="yes">
|
---|
575 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
576 | <xsl:text>either 'array' or 'mod' attribute is allowed, but not both!</xsl:text>
|
---|
577 | </xsl:message>
|
---|
578 | </xsl:if>
|
---|
579 | <xsl:choose>
|
---|
580 | <xsl:when test="../@mod='ptr'">
|
---|
581 | <xsl:choose>
|
---|
582 | <!-- standard types -->
|
---|
583 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
584 | <xsl:when test=".='boolean'">booeanPtr</xsl:when>
|
---|
585 | <xsl:when test=".='octet'">octetPtr</xsl:when>
|
---|
586 | <xsl:when test=".='short'">shortPtr</xsl:when>
|
---|
587 | <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
|
---|
588 | <xsl:when test=".='long'">longPtr</xsl:when>
|
---|
589 | <xsl:when test=".='long long'">llongPtr</xsl:when>
|
---|
590 | <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
|
---|
591 | <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
|
---|
592 | <xsl:when test=".='char'">charPtr</xsl:when>
|
---|
593 | <!--xsl:when test=".='string'">??</xsl:when-->
|
---|
594 | <xsl:when test=".='wchar'">wcharPtr</xsl:when>
|
---|
595 | <!--xsl:when test=".='wstring'">??</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:otherwise>
|
---|
608 | <xsl:message terminate="yes">
|
---|
609 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
610 | <xsl:value-of select="concat('value "',../@mod,'" ')"/>
|
---|
611 | <xsl:text>of attibute 'mod' is invalid!</xsl:text>
|
---|
612 | </xsl:message>
|
---|
613 | </xsl:otherwise>
|
---|
614 | </xsl:choose>
|
---|
615 | </xsl:when>
|
---|
616 | <!-- no modifiers -->
|
---|
617 | <xsl:otherwise>
|
---|
618 | <xsl:choose>
|
---|
619 | <!-- standard types -->
|
---|
620 | <xsl:when test=".='result'">result</xsl:when>
|
---|
621 | <xsl:when test=".='boolean'">boolean</xsl:when>
|
---|
622 | <xsl:when test=".='octet'">octet</xsl:when>
|
---|
623 | <xsl:when test=".='short'">short</xsl:when>
|
---|
624 | <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
|
---|
625 | <xsl:when test=".='long'">long</xsl:when>
|
---|
626 | <xsl:when test=".='long long'">long long</xsl:when>
|
---|
627 | <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
|
---|
628 | <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
|
---|
629 | <xsl:when test=".='char'">char</xsl:when>
|
---|
630 | <xsl:when test=".='wchar'">wchar</xsl:when>
|
---|
631 | <xsl:when test=".='string'">string</xsl:when>
|
---|
632 | <xsl:when test=".='wstring'">wstring</xsl:when>
|
---|
633 | <!-- UUID type -->
|
---|
634 | <xsl:when test=".='uuid'">uuid</xsl:when>
|
---|
635 | <!-- system interface types -->
|
---|
636 | <xsl:when test=".='$unknown'">$unknown</xsl:when>
|
---|
637 | <xsl:otherwise>
|
---|
638 | <xsl:choose>
|
---|
639 | <!-- enum types -->
|
---|
640 | <xsl:when test="
|
---|
641 | (ancestor::library/enum[@name=current()]) or
|
---|
642 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
643 | ">
|
---|
644 | <xsl:value-of select="."/>
|
---|
645 | </xsl:when>
|
---|
646 | <!-- custom interface types -->
|
---|
647 | <xsl:when test="
|
---|
648 | (name(current())='enumerator' and
|
---|
649 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
650 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
651 | ) or
|
---|
652 | ((ancestor::library/interface[@name=current()]) or
|
---|
653 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
654 | ) or
|
---|
655 | ((ancestor::library/collection[@name=current()]) or
|
---|
656 | (ancestor::library/if[@target=$self_target]/collection[@name=current()])
|
---|
657 | )
|
---|
658 | ">
|
---|
659 | <xsl:value-of select="."/>
|
---|
660 | </xsl:when>
|
---|
661 | <!-- other types -->
|
---|
662 | <xsl:otherwise>
|
---|
663 | <xsl:message terminate="yes">
|
---|
664 | <xsl:text>Unknown parameter type: </xsl:text>
|
---|
665 | <xsl:value-of select="."/>
|
---|
666 | </xsl:message>
|
---|
667 | </xsl:otherwise>
|
---|
668 | </xsl:choose>
|
---|
669 | </xsl:otherwise>
|
---|
670 | </xsl:choose>
|
---|
671 | </xsl:otherwise>
|
---|
672 | </xsl:choose>
|
---|
673 | </xsl:template>
|
---|
674 |
|
---|
675 | </xsl:stylesheet>
|
---|
676 |
|
---|