VirtualBox

source: vbox/trunk/src/VBox/Main/idl/xpidl.xsl@ 7899

Last change on this file since 7899 was 7216, checked in by vboxsync, 17 years ago

Main/xml: Ident 4 -> 2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.2 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 * A template to generate a XPCOM IDL compatible interface definition file
5 * from the generic interface definition expressed in XML.
6
7 Copyright (C) 2006-2007 innotek GmbH
8
9 This file is part of VirtualBox Open Source Edition (OSE), as
10 available from http://www.virtualbox.org. This file is free software;
11 you can redistribute it and/or modify it under the terms of the GNU
12 General Public License (GPL) as published by the Free Software
13 Foundation, in version 2 as it comes in the "COPYING" file of the
14 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16-->
17
18<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
19<xsl:output method="text"/>
20
21<xsl:strip-space elements="*"/>
22
23
24<!--
25// helper definitions
26/////////////////////////////////////////////////////////////////////////////
27-->
28
29<!--
30 * capitalizes the first letter
31-->
32<xsl:template name="capitalize">
33 <xsl:param name="str" select="."/>
34 <xsl:value-of select="
35 concat(
36 translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
37 substring($str,2)
38 )
39 "/>
40</xsl:template>
41
42<!--
43 * uncapitalizes the first letter only if the second one is not capital
44 * otherwise leaves the string unchanged
45-->
46<xsl:template name="uncapitalize">
47 <xsl:param name="str" select="."/>
48 <xsl:choose>
49 <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
50 <xsl:value-of select="
51 concat(
52 translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
53 substring($str,2)
54 )
55 "/>
56 </xsl:when>
57 <xsl:otherwise>
58 <xsl:value-of select="string($str)"/>
59 </xsl:otherwise>
60 </xsl:choose>
61</xsl:template>
62
63<!--
64 * translates the string to uppercase
65-->
66<xsl:template name="uppercase">
67 <xsl:param name="str" select="."/>
68 <xsl:value-of select="
69 translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
70 "/>
71</xsl:template>
72
73
74<!--
75// templates
76/////////////////////////////////////////////////////////////////////////////
77-->
78
79
80<!--
81 * header
82-->
83<xsl:template match="/idl">
84 <xsl:text>
85/*
86 * DO NOT EDIT! This is a generated file.
87 *
88 * XPCOM IDL (XPIDL) definition for VirualBox Main API (COM interfaces)
89 * generated from XIDL (XML interface definition).
90 *
91 * Source : src/VBox/Main/idl/VirtualBox.xidl
92 * Generator : src/VBox/Main/idl/xpidl.xsl
93 */
94
95#include "nsISupports.idl"
96#include "nsIException.idl"
97</xsl:text>
98 <!-- native typedefs for the 'mod="ptr"' attribute -->
99 <xsl:text>
100[ptr] native booeanPtr (PRBool);
101[ptr] native octetPtr (PRUint8);
102[ptr] native shortPtr (PRInt16);
103[ptr] native ushortPtr (PRUint16);
104[ptr] native longPtr (PRInt32);
105[ptr] native llongPtr (PRInt64);
106[ptr] native ulongPtr (PRUint32);
107[ptr] native ullongPtr (PRUint64);
108<!-- charPtr is already defined in nsrootidl.idl -->
109<!-- [ptr] native charPtr (char) -->
110[ptr] native stringPtr (string);
111[ptr] native wcharPtr (wchar);
112[ptr] native wstringPtr (wstring);
113
114</xsl:text>
115 <xsl:apply-templates/>
116</xsl:template>
117
118
119<!--
120 * ignore all |if|s except those for XPIDL target
121-->
122<xsl:template match="if">
123 <xsl:if test="@target='xpidl'">
124 <xsl:apply-templates/>
125 </xsl:if>
126</xsl:template>
127<xsl:template match="if" mode="forward">
128 <xsl:if test="@target='xpidl'">
129 <xsl:apply-templates mode="forward"/>
130 </xsl:if>
131</xsl:template>
132
133
134<!--
135 * cpp_quote
136-->
137<xsl:template match="cpp">
138 <xsl:if test="text()">
139 <xsl:text>%{C++</xsl:text>
140 <xsl:value-of select="text()"/>
141 <xsl:text>&#x0A;%}&#x0A;&#x0A;</xsl:text>
142 </xsl:if>
143 <xsl:if test="not(text()) and @line">
144 <xsl:text>%{C++&#x0A;</xsl:text>
145 <xsl:value-of select="@line"/>
146 <xsl:text>&#x0A;%}&#x0A;&#x0A;</xsl:text>
147 </xsl:if>
148</xsl:template>
149
150
151<!--
152 * #if statement (@if attribute)
153 * @note
154 * xpidl doesn't support any preprocessor defines other than #include
155 * (it just ignores them), so the generated IDL will most likely be
156 * invalid. So for now we forbid using @if attributes
157-->
158<xsl:template match="@if" mode="begin">
159 <xsl:message terminate="yes">
160 @if attributes are not currently allowed because xpidl lacks
161 support of #ifdef and stuff.
162 </xsl:message>
163 <xsl:text>#if </xsl:text>
164 <xsl:value-of select="."/>
165 <xsl:text>&#x0A;</xsl:text>
166</xsl:template>
167<xsl:template match="@if" mode="end">
168 <xsl:text>#endif&#x0A;</xsl:text>
169</xsl:template>
170
171
172<!--
173 * libraries
174-->
175<xsl:template match="library">
176 <!-- forward declarations -->
177 <xsl:apply-templates select="if | interface | collection | enumerator" mode="forward"/>
178 <xsl:text>&#x0A;</xsl:text>
179 <!-- all enums go first -->
180 <xsl:apply-templates select="enum | if/enum"/>
181 <!-- everything else but enums -->
182 <xsl:apply-templates select="*[not(self::enum) and not(self::if[enum])]"/>
183</xsl:template>
184
185
186<!--
187 * forward declarations
188-->
189<xsl:template match="interface | collection | enumerator" mode="forward">
190 <xsl:text>interface </xsl:text>
191 <xsl:value-of select="@name"/>
192 <xsl:text>;&#x0A;</xsl:text>
193</xsl:template>
194
195
196<!--
197 * interfaces
198-->
199<xsl:template match="interface">[
200 uuid(<xsl:value-of select="@uuid"/>),
201 scriptable
202]
203<xsl:text>interface </xsl:text>
204 <xsl:value-of select="@name"/>
205 <xsl:text> : </xsl:text>
206 <xsl:choose>
207 <xsl:when test="@extends='$unknown'">nsISupports</xsl:when>
208 <xsl:when test="@extends='$dispatched'">nsISupports</xsl:when>
209 <xsl:when test="@extends='$errorinfo'">nsIException</xsl:when>
210 <xsl:otherwise><xsl:value-of select="@extends"/></xsl:otherwise>
211 </xsl:choose>
212 <xsl:text>&#x0A;{&#x0A;</xsl:text>
213 <!-- attributes (properties) -->
214 <xsl:apply-templates select="attribute"/>
215 <!-- methods -->
216 <xsl:apply-templates select="method"/>
217 <!-- 'if' enclosed elements, unsorted -->
218 <xsl:apply-templates select="if"/>
219 <!-- -->
220 <xsl:text>}; /* interface </xsl:text>
221 <xsl:value-of select="@name"/>
222 <xsl:text> */&#x0A;&#x0A;</xsl:text>
223</xsl:template>
224
225<!--
226 * attributes
227-->
228<xsl:template match="interface//attribute | collection//attribute">
229 <xsl:if test="@array">
230 <xsl:message terminate="yes">
231 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
232 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
233 </xsl:message>
234 </xsl:if>
235 <xsl:apply-templates select="@if" mode="begin"/>
236 <xsl:if test="@mod='ptr'">
237 <!-- attributes using native types must be non-scriptable -->
238 <xsl:text> [noscript]&#x0A;</xsl:text>
239 </xsl:if>
240 <xsl:choose>
241 <!-- safearray pseudo attribute -->
242 <xsl:when test="@safearray='yes'">
243 <!-- getter -->
244 <xsl:text> void get</xsl:text>
245 <xsl:call-template name="capitalize">
246 <xsl:with-param name="str" select="@name"/>
247 </xsl:call-template>
248 <xsl:text> (&#x0A;</xsl:text>
249 <!-- array size -->
250 <xsl:text> out unsigned long </xsl:text>
251 <xsl:value-of select="@name"/>
252 <xsl:text>Size,&#x0A;</xsl:text>
253 <!-- array pointer -->
254 <xsl:text> [array, size_is(</xsl:text>
255 <xsl:value-of select="@name"/>
256 <xsl:text>Size), retval] out </xsl:text>
257 <xsl:apply-templates select="@type"/>
258 <xsl:text> </xsl:text>
259 <xsl:value-of select="@name"/>
260 <xsl:text>&#x0A; );&#x0A;</xsl:text>
261 <!-- setter -->
262 <xsl:if test="not(@readonly='yes')">
263 <xsl:text> void set</xsl:text>
264 <xsl:call-template name="capitalize">
265 <xsl:with-param name="str" select="@name"/>
266 </xsl:call-template>
267 <xsl:text> (&#x0A;</xsl:text>
268 <!-- array size -->
269 <xsl:text> in unsigned long </xsl:text>
270 <xsl:value-of select="@name"/>
271 <xsl:text>Size,&#x0A;</xsl:text>
272 <!-- array pointer -->
273 <xsl:text> [array, size_is(</xsl:text>
274 <xsl:value-of select="@name"/>
275 <xsl:text>Size)] in </xsl:text>
276 <xsl:apply-templates select="@type"/>
277 <xsl:text> </xsl:text>
278 <xsl:value-of select="@name"/>
279 <xsl:text>&#x0A; );&#x0A;</xsl:text>
280 </xsl:if>
281 </xsl:when>
282 <!-- normal attribute -->
283 <xsl:otherwise>
284 <xsl:text> </xsl:text>
285 <xsl:if test="@readonly='yes'">
286 <xsl:text>readonly </xsl:text>
287 </xsl:if>
288 <xsl:text>attribute </xsl:text>
289 <xsl:apply-templates select="@type"/>
290 <xsl:text> </xsl:text>
291 <xsl:value-of select="@name"/>
292 <xsl:text>;&#x0A;</xsl:text>
293 </xsl:otherwise>
294 </xsl:choose>
295 <xsl:apply-templates select="@if" mode="end"/>
296 <xsl:text>&#x0A;</xsl:text>
297</xsl:template>
298
299<!--
300 * methods
301-->
302<xsl:template match="interface//method | collection//method">
303 <xsl:apply-templates select="@if" mode="begin"/>
304 <xsl:if test="param/@mod='ptr'">
305 <!-- methods using native types must be non-scriptable -->
306 <xsl:text> [noscript]&#x0A;</xsl:text>
307 </xsl:if>
308 <xsl:text> void </xsl:text>
309 <xsl:value-of select="@name"/>
310 <xsl:if test="param">
311 <xsl:text> (&#x0A;</xsl:text>
312 <xsl:for-each select="param [position() != last()]">
313 <xsl:text> </xsl:text>
314 <xsl:apply-templates select="."/>
315 <xsl:text>,&#x0A;</xsl:text>
316 </xsl:for-each>
317 <xsl:text> </xsl:text>
318 <xsl:apply-templates select="param [last()]"/>
319 <xsl:text>&#x0A; );&#x0A;</xsl:text>
320 </xsl:if>
321 <xsl:if test="not(param)">
322 <xsl:text>();&#x0A;</xsl:text>
323 </xsl:if>
324 <xsl:apply-templates select="@if" mode="end"/>
325 <xsl:text>&#x0A;</xsl:text>
326</xsl:template>
327
328
329<!--
330 * co-classes
331-->
332<xsl:template match="module/class">
333 <!-- class and contract id -->
334 <xsl:text>%{C++&#x0A;</xsl:text>
335 <xsl:text>#define NS_</xsl:text>
336 <xsl:call-template name="uppercase">
337 <xsl:with-param name="str" select="@name"/>
338 </xsl:call-template>
339 <xsl:text>_CID { \&#x0A;</xsl:text>
340 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
341 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
342 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
343 <xsl:text>, \&#x0A; </xsl:text>
344 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
345 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
346 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
347 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
348 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
349 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
350 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
351 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
352 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
353 <xsl:text>#define NS_</xsl:text>
354 <xsl:call-template name="uppercase">
355 <xsl:with-param name="str" select="@name"/>
356 </xsl:call-template>
357 <!-- Contract ID -->
358 <xsl:text>_CONTRACTID &quot;@</xsl:text>
359 <xsl:value-of select="@namespace"/>
360 <xsl:text>/</xsl:text>
361 <xsl:value-of select="@name"/>
362 <xsl:text>;1&quot;&#x0A;</xsl:text>
363 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32 -->
364 <xsl:text>// for compatibility with Win32&#x0A;</xsl:text>
365 <xsl:text>#define CLSID_</xsl:text>
366 <xsl:value-of select="@name"/>
367 <xsl:text> (nsCID) NS_</xsl:text>
368 <xsl:call-template name="uppercase">
369 <xsl:with-param name="str" select="@name"/>
370 </xsl:call-template>
371 <xsl:text>_CID&#x0A;</xsl:text>
372 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
373</xsl:template>
374
375
376<!--
377 * enumerators
378-->
379<xsl:template match="enumerator">[
380 uuid(<xsl:value-of select="@uuid"/>),
381 scriptable
382]
383<xsl:text>interface </xsl:text>
384 <xsl:value-of select="@name"/>
385 <xsl:text> : nsISupports&#x0A;{&#x0A;</xsl:text>
386 <!-- HasMore -->
387 <xsl:text> void hasMore ([retval] out boolean more);&#x0A;&#x0A;</xsl:text>
388 <!-- GetNext -->
389 <xsl:text> void getNext ([retval] out </xsl:text>
390 <xsl:apply-templates select="@type"/>
391 <xsl:text> next);&#x0A;&#x0A;</xsl:text>
392 <!-- -->
393 <xsl:text>}; /* interface </xsl:text>
394 <xsl:value-of select="@name"/>
395 <xsl:text> */&#x0A;&#x0A;</xsl:text>
396</xsl:template>
397
398
399<!--
400 * collections
401-->
402<xsl:template match="collection">
403 <xsl:if test="not(@readonly='yes')">
404 <xsl:message terminate="yes">
405 <xsl:value-of select="concat(@name,': ')"/>
406 <xsl:text>non-readonly collections are not currently supported</xsl:text>
407 </xsl:message>
408 </xsl:if>[
409 uuid(<xsl:value-of select="@uuid"/>),
410 scriptable
411]
412<xsl:text>interface </xsl:text>
413 <xsl:value-of select="@name"/>
414 <xsl:text> : nsISupports&#x0A;{&#x0A;</xsl:text>
415 <!-- Count -->
416 <xsl:text> readonly attribute unsigned long count;&#x0A;&#x0A;</xsl:text>
417 <!-- GetItemAt -->
418 <xsl:text> void getItemAt (in unsigned long index, [retval] out </xsl:text>
419 <xsl:apply-templates select="@type"/>
420 <xsl:text> item);&#x0A;&#x0A;</xsl:text>
421 <!-- Enumerate -->
422 <xsl:text> void enumerate ([retval] out </xsl:text>
423 <xsl:apply-templates select="@enumerator"/>
424 <xsl:text> enumerator);&#x0A;&#x0A;</xsl:text>
425 <!-- other extra attributes (properties) -->
426 <xsl:apply-templates select="attribute"/>
427 <!-- other extra methods -->
428 <xsl:apply-templates select="method"/>
429 <!-- 'if' enclosed elements, unsorted -->
430 <xsl:apply-templates select="if"/>
431 <!-- -->
432 <xsl:text>}; /* interface </xsl:text>
433 <xsl:value-of select="@name"/>
434 <xsl:text> */&#x0A;&#x0A;</xsl:text>
435</xsl:template>
436
437
438<!--
439 * enums
440-->
441<xsl:template match="enum">[
442 uuid(<xsl:value-of select="@uuid"/>),
443 scriptable
444]
445<xsl:text>interface </xsl:text>
446 <xsl:value-of select="@name"/>
447 <xsl:text>&#x0A;{&#x0A;</xsl:text>
448 <xsl:for-each select="const">
449 <xsl:text> const PRUint32 </xsl:text>
450 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
451 <xsl:text>;&#x0A;</xsl:text>
452 </xsl:for-each>
453 <xsl:text>};&#x0A;&#x0A;</xsl:text>
454 <!-- -->
455 <xsl:value-of select="concat('/* cross-platform type name for ', @name, ' */&#x0A;')"/>
456 <xsl:text>%{C++&#x0A;</xsl:text>
457 <xsl:value-of select="concat('#define ', @name, '_T', ' ',
458 'PRUint32&#x0A;')"/>
459 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
460 <!-- -->
461 <xsl:value-of select="concat('/* cross-platform constants for ', @name, ' */&#x0A;')"/>
462 <xsl:text>%{C++&#x0A;</xsl:text>
463 <xsl:for-each select="const">
464 <xsl:value-of select="concat('#define ', ../@name, '_', @name, ' ',
465 ../@name, '::', @name, '&#x0A;')"/>
466 </xsl:for-each>
467 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
468</xsl:template>
469
470
471<!--
472 * method parameters
473-->
474<xsl:template match="method/param">
475 <xsl:choose>
476 <!-- safearray parameters -->
477 <xsl:when test="@safearray='yes'">
478 <!-- array size -->
479 <xsl:choose>
480 <xsl:when test="@dir='in'">in </xsl:when>
481 <xsl:when test="@dir='out'">out </xsl:when>
482 <xsl:when test="@dir='return'">out </xsl:when>
483 <xsl:otherwise>in </xsl:otherwise>
484 </xsl:choose>
485 <xsl:text>unsigned long </xsl:text>
486 <xsl:value-of select="@name"/>
487 <xsl:text>Size,&#x0A;</xsl:text>
488 <!-- array pointer -->
489 <xsl:text> [array, size_is(</xsl:text>
490 <xsl:value-of select="@name"/>
491 <xsl:text>Size)</xsl:text>
492 <xsl:choose>
493 <xsl:when test="@dir='in'">] in </xsl:when>
494 <xsl:when test="@dir='out'">] out </xsl:when>
495 <xsl:when test="@dir='return'"> , retval] out </xsl:when>
496 <xsl:otherwise>] in </xsl:otherwise>
497 </xsl:choose>
498 <xsl:apply-templates select="@type"/>
499 <xsl:text> </xsl:text>
500 <xsl:value-of select="@name"/>
501 </xsl:when>
502 <!-- normal and array parameters -->
503 <xsl:otherwise>
504 <xsl:if test="@array">
505 <xsl:if test="@dir='return'">
506 <xsl:message terminate="yes">
507 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
508 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text>
509 </xsl:message>
510 </xsl:if>
511 <xsl:text>[array, </xsl:text>
512 <xsl:choose>
513 <xsl:when test="../param[@name=current()/@array]">
514 <xsl:if test="../param[@name=current()/@array]/@dir != @dir">
515 <xsl:message terminate="yes">
516 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
517 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/>
518 <xsl:text> must have the same direction</xsl:text>
519 </xsl:message>
520 </xsl:if>
521 <xsl:text>size_is(</xsl:text>
522 <xsl:value-of select="@array"/>
523 <xsl:text>)</xsl:text>
524 </xsl:when>
525 <xsl:otherwise>
526 <xsl:message terminate="yes">
527 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
528 <xsl:text>array attribute refers to non-existent param: </xsl:text>
529 <xsl:value-of select="@array"/>
530 </xsl:message>
531 </xsl:otherwise>
532 </xsl:choose>
533 <xsl:text>] </xsl:text>
534 </xsl:if>
535 <xsl:choose>
536 <xsl:when test="@dir='in'">in </xsl:when>
537 <xsl:when test="@dir='out'">out </xsl:when>
538 <xsl:when test="@dir='return'">[retval] out </xsl:when>
539 <xsl:otherwise>in </xsl:otherwise>
540 </xsl:choose>
541 <xsl:apply-templates select="@type"/>
542 <xsl:text> </xsl:text>
543 <xsl:value-of select="@name"/>
544 </xsl:otherwise>
545 </xsl:choose>
546</xsl:template>
547
548
549<!--
550 * attribute/parameter type conversion
551-->
552<xsl:template match="
553 attribute/@type | param/@type |
554 enumerator/@type | collection/@type | collection/@enumerator
555">
556 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
557
558 <xsl:if test="../@array and ../@safearray='yes'">
559 <xsl:message terminate="yes">
560 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
561 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
562 </xsl:message>
563 </xsl:if>
564
565 <xsl:choose>
566 <!-- modifiers (ignored for 'enumeration' attributes)-->
567 <xsl:when test="name(current())='type' and ../@mod">
568 <xsl:choose>
569 <xsl:when test="../@mod='ptr'">
570 <xsl:choose>
571 <!-- standard types -->
572 <!--xsl:when test=".='result'">??</xsl:when-->
573 <xsl:when test=".='boolean'">booeanPtr</xsl:when>
574 <xsl:when test=".='octet'">octetPtr</xsl:when>
575 <xsl:when test=".='short'">shortPtr</xsl:when>
576 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
577 <xsl:when test=".='long'">longPtr</xsl:when>
578 <xsl:when test=".='long long'">llongPtr</xsl:when>
579 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
580 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
581 <xsl:when test=".='char'">charPtr</xsl:when>
582 <!--xsl:when test=".='string'">??</xsl:when-->
583 <xsl:when test=".='wchar'">wcharPtr</xsl:when>
584 <!--xsl:when test=".='wstring'">??</xsl:when-->
585 <xsl:otherwise>
586 <xsl:message terminate="yes">
587 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
588 <xsl:text>attribute 'mod=</xsl:text>
589 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
590 <xsl:text>' cannot be used with type </xsl:text>
591 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
592 </xsl:message>
593 </xsl:otherwise>
594 </xsl:choose>
595 </xsl:when>
596 <xsl:otherwise>
597 <xsl:message terminate="yes">
598 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
599 <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
600 <xsl:text>of attribute 'mod' is invalid!</xsl:text>
601 </xsl:message>
602 </xsl:otherwise>
603 </xsl:choose>
604 </xsl:when>
605 <!-- no modifiers -->
606 <xsl:otherwise>
607 <xsl:choose>
608 <!-- standard types -->
609 <xsl:when test=".='result'">nsresult</xsl:when>
610 <xsl:when test=".='boolean'">boolean</xsl:when>
611 <xsl:when test=".='octet'">octet</xsl:when>
612 <xsl:when test=".='short'">short</xsl:when>
613 <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
614 <xsl:when test=".='long'">long</xsl:when>
615 <xsl:when test=".='long long'">long long</xsl:when>
616 <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
617 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
618 <xsl:when test=".='char'">char</xsl:when>
619 <xsl:when test=".='wchar'">wchar</xsl:when>
620 <xsl:when test=".='string'">string</xsl:when>
621 <xsl:when test=".='wstring'">wstring</xsl:when>
622 <!-- UUID type -->
623 <xsl:when test=".='uuid'">
624 <xsl:choose>
625 <xsl:when test="name(..)='attribute'">
626 <xsl:choose>
627 <xsl:when test="../@readonly='yes'">
628 <xsl:text>nsIDPtr</xsl:text>
629 </xsl:when>
630 <xsl:otherwise>
631 <xsl:message terminate="yes">
632 <xsl:value-of select="../@name"/>
633 <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
634 </xsl:message>
635 </xsl:otherwise>
636 </xsl:choose>
637 </xsl:when>
638 <xsl:when test="name(..)='param'">
639 <xsl:choose>
640 <xsl:when test="../@dir='in'">
641 <xsl:text>nsIDRef</xsl:text>
642 </xsl:when>
643 <xsl:otherwise>
644 <xsl:text>nsIDPtr</xsl:text>
645 </xsl:otherwise>
646 </xsl:choose>
647 </xsl:when>
648 </xsl:choose>
649 </xsl:when>
650 <!-- system interface types -->
651 <xsl:when test=".='$unknown'">nsISupports</xsl:when>
652 <xsl:otherwise>
653 <xsl:choose>
654 <!-- enum types -->
655 <xsl:when test="
656 (ancestor::library/enum[@name=current()]) or
657 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
658 ">
659 <xsl:text>PRUint32</xsl:text>
660 </xsl:when>
661 <!-- custom interface types -->
662 <xsl:when test="
663 (name(current())='enumerator' and
664 ((ancestor::library/enumerator[@name=current()]) or
665 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
666 ) or
667 ((ancestor::library/interface[@name=current()]) or
668 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
669 ) or
670 ((ancestor::library/collection[@name=current()]) or
671 (ancestor::library/if[@target=$self_target]/collection[@name=current()])
672 )
673 ">
674 <xsl:value-of select="."/>
675 </xsl:when>
676 <!-- other types -->
677 <xsl:otherwise>
678 <xsl:message terminate="yes">
679 <xsl:text>Unknown parameter type: </xsl:text>
680 <xsl:value-of select="."/>
681 </xsl:message>
682 </xsl:otherwise>
683 </xsl:choose>
684 </xsl:otherwise>
685 </xsl:choose>
686 </xsl:otherwise>
687 </xsl:choose>
688</xsl:template>
689
690</xsl:stylesheet>
691
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette