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 (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 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 particular, 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 | * Welcome to the <b>VirtualBox Main documentation.</b> This describes the
|
---|
289 | * so-called VirtualBox "Main API", which comprises all public COM interfaces
|
---|
290 | * and components provided by the VirtualBox server and by the VirtualBox client
|
---|
291 | * library.
|
---|
292 | *
|
---|
293 | * VirtualBox employs a client-server design, meaning that whenever any part of
|
---|
294 | * VirtualBox is running -- be it the Qt GUI, the VBoxManage command-line
|
---|
295 | * interface or any virtual machine --, a background server process named
|
---|
296 | * VBoxSVC runs in the background. This allows multiple processes to cooperate
|
---|
297 | * without conflicts. Some of the COM objects described by this Main documentation
|
---|
298 | * "live" in that server process, others "live" in the local client process. In
|
---|
299 | * any case, processes that use the Main API are using inter-process communication
|
---|
300 | * to communicate with these objects, but the details of this are hidden by the COM API.
|
---|
301 | *
|
---|
302 | * On Windows platforms, the VirtualBox Main API uses Microsoft COM, a native COM
|
---|
303 | * implementation. On all other platforms, Mozilla XPCOM, an open-source COM
|
---|
304 | * implementation, is used.
|
---|
305 | *
|
---|
306 | * All the parts that a typical VirtualBox user interacts with (the Qt GUI,
|
---|
307 | * the VBoxManage command-line interface and the VBoxVRDP server) are technically
|
---|
308 | * front-ends to the Main API and only use the interfaces that are documented
|
---|
309 | * in this Main API documentation. This ensures that, with any given release
|
---|
310 | * version of VirtualBox, all capabilities of the product that could be useful
|
---|
311 | * to an external client program are always exposed by way of this API.
|
---|
312 | *
|
---|
313 | * The complete API is described in a source IDL file, called VirtualBox.idl.
|
---|
314 | * This contains all public interfaces exposed by the Main API. Two interfaces
|
---|
315 | * are of supreme importance and will be needed in order for any front-end program
|
---|
316 | * to do anything useful: these are IVirtualBox and ISession. It is recommended
|
---|
317 | * to read the documentation of these interfaces first.
|
---|
318 | *
|
---|
319 | * @note VirtualBox.idl is automatically generated from a generic internal file
|
---|
320 | * to define all interfaces in a platform-independent way for documentation
|
---|
321 | * purposes. This generated file is not a syntactically valid IDL file and
|
---|
322 | * <i>must not</i> be used for programming.
|
---|
323 | */
|
---|
324 | <xsl:text>
</xsl:text>
|
---|
325 | <xsl:apply-templates/>
|
---|
326 | </xsl:template>
|
---|
327 |
|
---|
328 |
|
---|
329 | <!--
|
---|
330 | * accept all <if>s
|
---|
331 | -->
|
---|
332 | <xsl:template match="if">
|
---|
333 | <xsl:apply-templates/>
|
---|
334 | </xsl:template>
|
---|
335 |
|
---|
336 |
|
---|
337 | <!--
|
---|
338 | * cpp_quote (ignore)
|
---|
339 | -->
|
---|
340 | <xsl:template match="cpp">
|
---|
341 | </xsl:template>
|
---|
342 |
|
---|
343 |
|
---|
344 | <!--
|
---|
345 | * #ifdef statement (@if attribute)
|
---|
346 | -->
|
---|
347 | <xsl:template match="@if" mode="begin">
|
---|
348 | <xsl:text>#if </xsl:text>
|
---|
349 | <xsl:value-of select="."/>
|
---|
350 | <xsl:text>
</xsl:text>
|
---|
351 | </xsl:template>
|
---|
352 | <xsl:template match="@if" mode="end">
|
---|
353 | <xsl:text>#endif
</xsl:text>
|
---|
354 | </xsl:template>
|
---|
355 |
|
---|
356 |
|
---|
357 | <!--
|
---|
358 | * libraries
|
---|
359 | -->
|
---|
360 | <xsl:template match="library">
|
---|
361 | <!-- all enums go first -->
|
---|
362 | <xsl:apply-templates select="enum | if/enum"/>
|
---|
363 | <!-- everything else but enums -->
|
---|
364 | <xsl:apply-templates select="*[not(self::enum) and not(self::if[enum])]"/>
|
---|
365 | </xsl:template>
|
---|
366 |
|
---|
367 |
|
---|
368 | <!--
|
---|
369 | * interfaces
|
---|
370 | -->
|
---|
371 | <xsl:template match="interface">
|
---|
372 | <xsl:apply-templates select="desc"/>
|
---|
373 | <xsl:text>interface </xsl:text>
|
---|
374 | <xsl:value-of select="@name"/>
|
---|
375 | <xsl:text> : </xsl:text>
|
---|
376 | <xsl:value-of select="@extends"/>
|
---|
377 | <xsl:text>
{
</xsl:text>
|
---|
378 | <!-- attributes (properties) -->
|
---|
379 | <xsl:apply-templates select="attribute"/>
|
---|
380 | <!-- methods -->
|
---|
381 | <xsl:apply-templates select="method"/>
|
---|
382 | <!-- 'if' enclosed elements, unsorted -->
|
---|
383 | <xsl:apply-templates select="if"/>
|
---|
384 | <!-- -->
|
---|
385 | <xsl:text>}; /* interface </xsl:text>
|
---|
386 | <xsl:value-of select="@name"/>
|
---|
387 | <xsl:text> */

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

</xsl:text>
|
---|
455 | <!-- GetNext -->
|
---|
456 | <xsl:text> void getNext ([retval] out </xsl:text>
|
---|
457 | <xsl:apply-templates select="@type"/>
|
---|
458 | <xsl:text> next);

</xsl:text>
|
---|
459 | <!-- -->
|
---|
460 | <xsl:text>}; /* interface </xsl:text>
|
---|
461 | <xsl:value-of select="@name"/>
|
---|
462 | <xsl:text> */

</xsl:text>
|
---|
463 | </xsl:template>
|
---|
464 |
|
---|
465 |
|
---|
466 | <!--
|
---|
467 | * collections
|
---|
468 | -->
|
---|
469 | <xsl:template match="collection">
|
---|
470 | <xsl:if test="not(@readonly='yes')">
|
---|
471 | <xsl:message terminate="yes">
|
---|
472 | <xsl:value-of select="concat(@name,': ')"/>
|
---|
473 | <xsl:text>non-readonly collections are not currently supported</xsl:text>
|
---|
474 | </xsl:message>
|
---|
475 | </xsl:if>
|
---|
476 | <xsl:text>interface </xsl:text>
|
---|
477 | <xsl:value-of select="@name"/>
|
---|
478 | <xsl:text> : $unknown
{
</xsl:text>
|
---|
479 | <!-- Count -->
|
---|
480 | <xsl:text> readonly attribute unsigned long count;

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

</xsl:text>
|
---|
485 | <!-- Enumerate -->
|
---|
486 | <xsl:text> void enumerate ([retval] out </xsl:text>
|
---|
487 | <xsl:apply-templates select="@enumerator"/>
|
---|
488 | <xsl:text> enumerator);

</xsl:text>
|
---|
489 | <!-- other extra attributes (properties) -->
|
---|
490 | <xsl:apply-templates select="attribute"/>
|
---|
491 | <!-- other extra methods -->
|
---|
492 | <xsl:apply-templates select="method"/>
|
---|
493 | <!-- 'if' enclosed elements, unsorted -->
|
---|
494 | <xsl:apply-templates select="if"/>
|
---|
495 | <!-- -->
|
---|
496 | <xsl:text>}; /* interface </xsl:text>
|
---|
497 | <xsl:value-of select="@name"/>
|
---|
498 | <xsl:text> */

</xsl:text>
|
---|
499 | </xsl:template>
|
---|
500 |
|
---|
501 |
|
---|
502 | <!--
|
---|
503 | * enums
|
---|
504 | -->
|
---|
505 | <xsl:template match="enum">
|
---|
506 | <xsl:apply-templates select="desc"/>
|
---|
507 | <xsl:text>enum </xsl:text>
|
---|
508 | <xsl:value-of select="@name"/>
|
---|
509 | <xsl:text>
{
</xsl:text>
|
---|
510 | <xsl:for-each select="const">
|
---|
511 | <xsl:apply-templates select="desc"/>
|
---|
512 | <xsl:text> </xsl:text>
|
---|
513 | <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
|
---|
514 | <xsl:text>,
</xsl:text>
|
---|
515 | </xsl:for-each>
|
---|
516 | <xsl:text>};

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