VirtualBox

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

Last change on this file since 13533 was 11982, checked in by vboxsync, 16 years ago

All: license header changes for 2.0 (OSE headers, add Sun GPL/LGPL disclaimer)

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