VirtualBox

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

Last change on this file since 20988 was 14572, checked in by vboxsync, 16 years ago

Main/XIDL: Added recognition of the following new tags:

  • <desc>/<result> in <method> and <attribute>;
  • <descGroup> everywhere to define logical description groups (modules in doxygen);
  • <desc> in <idl> to generat main documentation page.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 39.6 KB
Line 
1<?xml version="1.0"?>
2<!-- $Id: xpidl.xsl 14572 2008-11-25 13:37:40Z vboxsync $ -->
3
4<!--
5 * A template to generate a XPCOM IDL compatible interface definition file
6 * from the generic interface definition expressed in XML.
7
8 Copyright (C) 2006-2008 Sun Microsystems, Inc.
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 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 Clara, CA 95054 USA or visit http://www.sun.com if you need
20 additional information or have any questions.
21-->
22
23<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
24<xsl:output method="text"/>
25
26<xsl:strip-space elements="*"/>
27
28
29<!--
30// helper definitions
31/////////////////////////////////////////////////////////////////////////////
32-->
33
34<!--
35 * capitalizes the first letter
36-->
37<xsl:template name="capitalize">
38 <xsl:param name="str" select="."/>
39 <xsl:value-of select="
40 concat(
41 translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
42 substring($str,2)
43 )
44 "/>
45</xsl:template>
46
47<!--
48 * uncapitalizes the first letter only if the second one is not capital
49 * otherwise leaves the string unchanged
50-->
51<xsl:template name="uncapitalize">
52 <xsl:param name="str" select="."/>
53 <xsl:choose>
54 <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
55 <xsl:value-of select="
56 concat(
57 translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
58 substring($str,2)
59 )
60 "/>
61 </xsl:when>
62 <xsl:otherwise>
63 <xsl:value-of select="string($str)"/>
64 </xsl:otherwise>
65 </xsl:choose>
66</xsl:template>
67
68<!--
69 * translates the string to uppercase
70-->
71<xsl:template name="uppercase">
72 <xsl:param name="str" select="."/>
73 <xsl:value-of select="
74 translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
75 "/>
76</xsl:template>
77
78
79<!--
80// templates
81/////////////////////////////////////////////////////////////////////////////
82-->
83
84
85<!--
86 * not explicitly matched elements and attributes
87-->
88<xsl:template match="*"/>
89
90
91<!--
92 * header
93-->
94<xsl:template match="/idl">
95 <xsl:text>
96/*
97 * DO NOT EDIT! This is a generated file.
98 *
99 * XPCOM IDL (XPIDL) definition for VirtualBox Main API (COM interfaces)
100 * generated from XIDL (XML interface definition).
101 *
102 * Source : src/VBox/Main/idl/VirtualBox.xidl
103 * Generator : src/VBox/Main/idl/xpidl.xsl
104 */
105
106#include "nsISupports.idl"
107#include "nsIException.idl"
108</xsl:text>
109 <!-- native typedefs for the 'mod="ptr"' attribute -->
110 <xsl:text>
111[ptr] native booleanPtr (PRBool);
112[ptr] native octetPtr (PRUint8);
113[ptr] native shortPtr (PRInt16);
114[ptr] native ushortPtr (PRUint16);
115[ptr] native longPtr (PRInt32);
116[ptr] native llongPtr (PRInt64);
117[ptr] native ulongPtr (PRUint32);
118[ptr] native ullongPtr (PRUint64);
119<!-- charPtr is already defined in nsrootidl.idl -->
120<!-- [ptr] native charPtr (char) -->
121[ptr] native stringPtr (string);
122[ptr] native wcharPtr (wchar);
123[ptr] native wstringPtr (wstring);
124
125</xsl:text>
126 <xsl:apply-templates/>
127</xsl:template>
128
129
130<!--
131 * ignore all |if|s except those for XPIDL target
132-->
133<xsl:template match="if">
134 <xsl:if test="@target='xpidl'">
135 <xsl:apply-templates/>
136 </xsl:if>
137</xsl:template>
138<xsl:template match="if" mode="forward">
139 <xsl:if test="@target='xpidl'">
140 <xsl:apply-templates mode="forward"/>
141 </xsl:if>
142</xsl:template>
143<xsl:template match="if" mode="forwarder">
144 <xsl:if test="@target='midl'">
145 <xsl:apply-templates mode="forwarder"/>
146 </xsl:if>
147</xsl:template>
148
149
150<!--
151 * cpp_quote
152-->
153<xsl:template match="cpp">
154 <xsl:if test="text()">
155 <xsl:text>%{C++</xsl:text>
156 <xsl:value-of select="text()"/>
157 <xsl:text>&#x0A;%}&#x0A;&#x0A;</xsl:text>
158 </xsl:if>
159 <xsl:if test="not(text()) and @line">
160 <xsl:text>%{C++&#x0A;</xsl:text>
161 <xsl:value-of select="@line"/>
162 <xsl:text>&#x0A;%}&#x0A;&#x0A;</xsl:text>
163 </xsl:if>
164</xsl:template>
165
166
167<!--
168 * #if statement (@if attribute)
169 * @note
170 * xpidl doesn't support any preprocessor defines other than #include
171 * (it just ignores them), so the generated IDL will most likely be
172 * invalid. So for now we forbid using @if attributes
173-->
174<xsl:template match="@if" mode="begin">
175 <xsl:message terminate="yes">
176 @if attributes are not currently allowed because xpidl lacks
177 support for #ifdef and stuff.
178 </xsl:message>
179 <xsl:text>#if </xsl:text>
180 <xsl:value-of select="."/>
181 <xsl:text>&#x0A;</xsl:text>
182</xsl:template>
183<xsl:template match="@if" mode="end">
184 <xsl:text>#endif&#x0A;</xsl:text>
185</xsl:template>
186
187
188<!--
189 * libraries
190-->
191<xsl:template match="library">
192 <!-- result codes -->
193 <xsl:text>%{C++&#x0A;</xsl:text>
194 <xsl:for-each select="result">
195 <xsl:apply-templates select="."/>
196 </xsl:for-each>
197 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
198 <!-- forward declarations -->
199 <xsl:apply-templates select="if | interface | collection | enumerator" mode="forward"/>
200 <xsl:text>&#x0A;</xsl:text>
201 <!-- all enums go first -->
202 <xsl:apply-templates select="enum | if/enum"/>
203 <!-- everything else but result codes and enums -->
204 <xsl:apply-templates select="*[not(self::result or self::enum) and
205 not(self::if[result] or self::if[enum])]"/>
206 <!-- -->
207</xsl:template>
208
209
210<!--
211 * result codes
212-->
213<xsl:template match="result">
214 <xsl:value-of select="concat('#define ',@name,' ',@value)"/>
215 <xsl:text>&#x0A;</xsl:text>
216</xsl:template>
217
218
219<!--
220 * forward declarations
221-->
222<xsl:template match="interface | collection | enumerator" mode="forward">
223 <xsl:text>interface </xsl:text>
224 <xsl:value-of select="@name"/>
225 <xsl:text>;&#x0A;</xsl:text>
226</xsl:template>
227
228
229<!--
230 * interfaces
231-->
232<xsl:template match="interface">[
233 uuid(<xsl:value-of select="@uuid"/>),
234 scriptable
235]
236<xsl:text>interface </xsl:text>
237 <xsl:value-of select="@name"/>
238 <xsl:text> : </xsl:text>
239 <xsl:choose>
240 <xsl:when test="@extends='$unknown'">nsISupports</xsl:when>
241 <xsl:when test="@extends='$dispatched'">nsISupports</xsl:when>
242 <xsl:when test="@extends='$errorinfo'">nsIException</xsl:when>
243 <xsl:otherwise><xsl:value-of select="@extends"/></xsl:otherwise>
244 </xsl:choose>
245 <xsl:text>&#x0A;{&#x0A;</xsl:text>
246 <!-- attributes (properties) -->
247 <xsl:apply-templates select="attribute"/>
248 <!-- methods -->
249 <xsl:apply-templates select="method"/>
250 <!-- 'if' enclosed elements, unsorted -->
251 <xsl:apply-templates select="if"/>
252 <!-- -->
253 <xsl:text>}; /* interface </xsl:text>
254 <xsl:value-of select="@name"/>
255 <xsl:text> */&#x0A;&#x0A;</xsl:text>
256 <!-- Interface implementation forwarder macro -->
257 <xsl:text>/* Interface implementation forwarder macro */&#x0A;</xsl:text>
258 <xsl:text>%{C++&#x0A;</xsl:text>
259 <!-- 1) individual methods -->
260 <xsl:apply-templates select="attribute" mode="forwarder"/>
261 <xsl:apply-templates select="method" mode="forwarder"/>
262 <xsl:apply-templates select="if" mode="forwarder"/>
263 <!-- 2) COM_FORWARD_Interface_TO(smth) -->
264 <xsl:text>#define COM_FORWARD_</xsl:text>
265 <xsl:value-of select="@name"/>
266 <xsl:text>_TO(smth) NS_FORWARD_</xsl:text>
267 <xsl:call-template name="uppercase">
268 <xsl:with-param name="str" select="@name"/>
269 </xsl:call-template>
270 <xsl:text> (smth)&#x0A;</xsl:text>
271 <!-- 3) COM_FORWARD_Interface_TO_OBJ(obj) -->
272 <xsl:text>#define COM_FORWARD_</xsl:text>
273 <xsl:value-of select="@name"/>
274 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
275 <xsl:value-of select="@name"/>
276 <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
277 <!-- 4) COM_FORWARD_Interface_TO_BASE(base) -->
278 <xsl:text>#define COM_FORWARD_</xsl:text>
279 <xsl:value-of select="@name"/>
280 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
281 <xsl:value-of select="@name"/>
282 <xsl:text>_TO (base::)&#x0A;</xsl:text>
283 <!-- -->
284 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
285 <!-- end -->
286</xsl:template>
287
288
289<!--
290 * attributes
291-->
292<xsl:template match="interface//attribute | collection//attribute">
293 <xsl:if test="@array">
294 <xsl:message terminate="yes">
295 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
296 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
297 </xsl:message>
298 </xsl:if>
299 <xsl:apply-templates select="@if" mode="begin"/>
300 <xsl:if test="@mod='ptr'">
301 <!-- attributes using native types must be non-scriptable -->
302 <xsl:text> [noscript]&#x0A;</xsl:text>
303 </xsl:if>
304 <xsl:choose>
305 <!-- safearray pseudo attribute -->
306 <xsl:when test="@safearray='yes'">
307 <!-- getter -->
308 <xsl:text> void get</xsl:text>
309 <xsl:call-template name="capitalize">
310 <xsl:with-param name="str" select="@name"/>
311 </xsl:call-template>
312 <xsl:text> (&#x0A;</xsl:text>
313 <!-- array size -->
314 <xsl:text> out unsigned long </xsl:text>
315 <xsl:value-of select="@name"/>
316 <xsl:text>Size,&#x0A;</xsl:text>
317 <!-- array pointer -->
318 <xsl:text> [array, size_is(</xsl:text>
319 <xsl:value-of select="@name"/>
320 <xsl:text>Size), retval] out </xsl:text>
321 <xsl:apply-templates select="@type"/>
322 <xsl:text> </xsl:text>
323 <xsl:value-of select="@name"/>
324 <xsl:text>&#x0A; );&#x0A;</xsl:text>
325 <!-- setter -->
326 <xsl:if test="not(@readonly='yes')">
327 <xsl:text> void set</xsl:text>
328 <xsl:call-template name="capitalize">
329 <xsl:with-param name="str" select="@name"/>
330 </xsl:call-template>
331 <xsl:text> (&#x0A;</xsl:text>
332 <!-- array size -->
333 <xsl:text> in unsigned long </xsl:text>
334 <xsl:value-of select="@name"/>
335 <xsl:text>Size,&#x0A;</xsl:text>
336 <!-- array pointer -->
337 <xsl:text> [array, size_is(</xsl:text>
338 <xsl:value-of select="@name"/>
339 <xsl:text>Size)] in </xsl:text>
340 <xsl:apply-templates select="@type"/>
341 <xsl:text> </xsl:text>
342 <xsl:value-of select="@name"/>
343 <xsl:text>&#x0A; );&#x0A;</xsl:text>
344 </xsl:if>
345 </xsl:when>
346 <!-- normal attribute -->
347 <xsl:otherwise>
348 <xsl:text> </xsl:text>
349 <xsl:if test="@readonly='yes'">
350 <xsl:text>readonly </xsl:text>
351 </xsl:if>
352 <xsl:text>attribute </xsl:text>
353 <xsl:apply-templates select="@type"/>
354 <xsl:text> </xsl:text>
355 <xsl:value-of select="@name"/>
356 <xsl:text>;&#x0A;</xsl:text>
357 </xsl:otherwise>
358 </xsl:choose>
359 <xsl:apply-templates select="@if" mode="end"/>
360 <xsl:text>&#x0A;</xsl:text>
361</xsl:template>
362
363<xsl:template match="interface//attribute | collection//attribute" mode="forwarder">
364
365 <xsl:variable name="parent" select="ancestor::interface | ancestor::collection"/>
366
367 <xsl:apply-templates select="@if" mode="begin"/>
368
369 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO(smth) -->
370 <xsl:text>#define COM_FORWARD_</xsl:text>
371 <xsl:value-of select="$parent/@name"/>
372 <xsl:text>_GETTER_</xsl:text>
373 <xsl:call-template name="capitalize">
374 <xsl:with-param name="str" select="@name"/>
375 </xsl:call-template>
376 <xsl:text>_TO(smth) NS_IMETHOD Get</xsl:text>
377 <xsl:call-template name="capitalize">
378 <xsl:with-param name="str" select="@name"/>
379 </xsl:call-template>
380 <xsl:text> (</xsl:text>
381 <xsl:if test="@safearray='yes'">
382 <xsl:text>PRUint32 * a</xsl:text>
383 <xsl:call-template name="capitalize">
384 <xsl:with-param name="str" select="@name"/>
385 </xsl:call-template>
386 <xsl:text>Size, </xsl:text>
387 </xsl:if>
388 <xsl:apply-templates select="@type" mode="forwarder"/>
389 <xsl:if test="@safearray='yes'">
390 <xsl:text> *</xsl:text>
391 </xsl:if>
392 <xsl:text> * a</xsl:text>
393 <xsl:call-template name="capitalize">
394 <xsl:with-param name="str" select="@name"/>
395 </xsl:call-template>
396 <xsl:text>) { return smth Get</xsl:text>
397 <xsl:call-template name="capitalize">
398 <xsl:with-param name="str" select="@name"/>
399 </xsl:call-template>
400 <xsl:text> (</xsl:text>
401 <xsl:if test="@safearray='yes'">
402 <xsl:text>a</xsl:text>
403 <xsl:call-template name="capitalize">
404 <xsl:with-param name="str" select="@name"/>
405 </xsl:call-template>
406 <xsl:text>Size, </xsl:text>
407 </xsl:if>
408 <xsl:text>a</xsl:text>
409 <xsl:call-template name="capitalize">
410 <xsl:with-param name="str" select="@name"/>
411 </xsl:call-template>
412 <xsl:text>); }&#x0A;</xsl:text>
413 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_OBJ(obj) -->
414 <xsl:text>#define COM_FORWARD_</xsl:text>
415 <xsl:value-of select="$parent/@name"/>
416 <xsl:text>_GETTER_</xsl:text>
417 <xsl:call-template name="capitalize">
418 <xsl:with-param name="str" select="@name"/>
419 </xsl:call-template>
420 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
421 <xsl:value-of select="$parent/@name"/>
422 <xsl:text>_GETTER_</xsl:text>
423 <xsl:call-template name="capitalize">
424 <xsl:with-param name="str" select="@name"/>
425 </xsl:call-template>
426 <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
427 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_BASE(base) -->
428 <xsl:text>#define COM_FORWARD_</xsl:text>
429 <xsl:value-of select="$parent/@name"/>
430 <xsl:text>_GETTER_</xsl:text>
431 <xsl:call-template name="capitalize">
432 <xsl:with-param name="str" select="@name"/>
433 </xsl:call-template>
434 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
435 <xsl:value-of select="$parent/@name"/>
436 <xsl:text>_GETTER_</xsl:text>
437 <xsl:call-template name="capitalize">
438 <xsl:with-param name="str" select="@name"/>
439 </xsl:call-template>
440 <xsl:text>_TO (base::)&#x0A;</xsl:text>
441 <!-- -->
442 <xsl:if test="not(@readonly='yes')">
443 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO(smth) -->
444 <xsl:text>#define COM_FORWARD_</xsl:text>
445 <xsl:value-of select="$parent/@name"/>
446 <xsl:text>_SETTER_</xsl:text>
447 <xsl:call-template name="capitalize">
448 <xsl:with-param name="str" select="@name"/>
449 </xsl:call-template>
450 <xsl:text>_TO(smth) NS_IMETHOD Set</xsl:text>
451 <xsl:call-template name="capitalize">
452 <xsl:with-param name="str" select="@name"/>
453 </xsl:call-template>
454 <xsl:text> (</xsl:text>
455 <xsl:if test="@safearray='yes'">
456 <xsl:text>PRUint32 a</xsl:text>
457 <xsl:call-template name="capitalize">
458 <xsl:with-param name="str" select="@name"/>
459 </xsl:call-template>
460 <xsl:text>Size, </xsl:text>
461 </xsl:if>
462 <xsl:if test="not(@safearray='yes') and (@type='string' or @type='wstring')">
463 <xsl:text>const </xsl:text>
464 </xsl:if>
465 <xsl:apply-templates select="@type" mode="forwarder"/>
466 <xsl:if test="@safearray='yes'">
467 <xsl:text> *</xsl:text>
468 </xsl:if>
469 <xsl:text> a</xsl:text>
470 <xsl:call-template name="capitalize">
471 <xsl:with-param name="str" select="@name"/>
472 </xsl:call-template>
473 <xsl:text>) { return smth Set</xsl:text>
474 <xsl:call-template name="capitalize">
475 <xsl:with-param name="str" select="@name"/>
476 </xsl:call-template>
477 <xsl:text> (a</xsl:text>
478 <xsl:call-template name="capitalize">
479 <xsl:with-param name="str" select="@name"/>
480 </xsl:call-template>
481 <xsl:text>); }&#x0A;</xsl:text>
482 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_OBJ(obj) -->
483 <xsl:text>#define COM_FORWARD_</xsl:text>
484 <xsl:value-of select="$parent/@name"/>
485 <xsl:text>_SETTER_</xsl:text>
486 <xsl:call-template name="capitalize">
487 <xsl:with-param name="str" select="@name"/>
488 </xsl:call-template>
489 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
490 <xsl:value-of select="$parent/@name"/>
491 <xsl:text>_SETTER_</xsl:text>
492 <xsl:call-template name="capitalize">
493 <xsl:with-param name="str" select="@name"/>
494 </xsl:call-template>
495 <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
496 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_BASE(base) -->
497 <xsl:text>#define COM_FORWARD_</xsl:text>
498 <xsl:value-of select="$parent/@name"/>
499 <xsl:text>_SETTER_</xsl:text>
500 <xsl:call-template name="capitalize">
501 <xsl:with-param name="str" select="@name"/>
502 </xsl:call-template>
503 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
504 <xsl:value-of select="$parent/@name"/>
505 <xsl:text>_SETTER_</xsl:text>
506 <xsl:call-template name="capitalize">
507 <xsl:with-param name="str" select="@name"/>
508 </xsl:call-template>
509 <xsl:text>_TO (base::)&#x0A;</xsl:text>
510 </xsl:if>
511
512 <xsl:apply-templates select="@if" mode="end"/>
513
514</xsl:template>
515
516
517<!--
518 * methods
519-->
520<xsl:template match="interface//method | collection//method">
521 <xsl:apply-templates select="@if" mode="begin"/>
522 <xsl:if test="param/@mod='ptr'">
523 <!-- methods using native types must be non-scriptable -->
524 <xsl:text> [noscript]&#x0A;</xsl:text>
525 </xsl:if>
526 <xsl:text> void </xsl:text>
527 <xsl:value-of select="@name"/>
528 <xsl:if test="param">
529 <xsl:text> (&#x0A;</xsl:text>
530 <xsl:for-each select="param [position() != last()]">
531 <xsl:text> </xsl:text>
532 <xsl:apply-templates select="."/>
533 <xsl:text>,&#x0A;</xsl:text>
534 </xsl:for-each>
535 <xsl:text> </xsl:text>
536 <xsl:apply-templates select="param [last()]"/>
537 <xsl:text>&#x0A; );&#x0A;</xsl:text>
538 </xsl:if>
539 <xsl:if test="not(param)">
540 <xsl:text>();&#x0A;</xsl:text>
541 </xsl:if>
542 <xsl:apply-templates select="@if" mode="end"/>
543 <xsl:text>&#x0A;</xsl:text>
544</xsl:template>
545
546<xsl:template match="interface//method | collection//method" mode="forwarder">
547
548 <xsl:variable name="parent" select="ancestor::interface | ancestor::collection"/>
549
550 <xsl:apply-templates select="@if" mode="begin"/>
551
552 <xsl:text>#define COM_FORWARD_</xsl:text>
553 <xsl:value-of select="$parent/@name"/>
554 <xsl:text>_</xsl:text>
555 <xsl:call-template name="capitalize">
556 <xsl:with-param name="str" select="@name"/>
557 </xsl:call-template>
558 <xsl:text>_TO(smth) NS_IMETHOD </xsl:text>
559 <xsl:call-template name="capitalize">
560 <xsl:with-param name="str" select="@name"/>
561 </xsl:call-template>
562 <xsl:choose>
563 <xsl:when test="param">
564 <xsl:text> (</xsl:text>
565 <xsl:for-each select="param [position() != last()]">
566 <xsl:apply-templates select="." mode="forwarder"/>
567 <xsl:text>, </xsl:text>
568 </xsl:for-each>
569 <xsl:apply-templates select="param [last()]" mode="forwarder"/>
570 <xsl:text>) { return smth </xsl:text>
571 <xsl:call-template name="capitalize">
572 <xsl:with-param name="str" select="@name"/>
573 </xsl:call-template>
574 <xsl:text> (</xsl:text>
575 <xsl:for-each select="param [position() != last()]">
576 <xsl:if test="@safearray='yes'">
577 <xsl:text>a</xsl:text>
578 <xsl:call-template name="capitalize">
579 <xsl:with-param name="str" select="@name"/>
580 </xsl:call-template>
581 <xsl:text>Size+++, </xsl:text>
582 </xsl:if>
583 <xsl:text>a</xsl:text>
584 <xsl:call-template name="capitalize">
585 <xsl:with-param name="str" select="@name"/>
586 </xsl:call-template>
587 <xsl:text>, </xsl:text>
588 </xsl:for-each>
589 <xsl:if test="param [last()]/@safearray='yes'">
590 <xsl:text>a</xsl:text>
591 <xsl:call-template name="capitalize">
592 <xsl:with-param name="str" select="param [last()]/@name"/>
593 </xsl:call-template>
594 <xsl:text>Size, </xsl:text>
595 </xsl:if>
596 <xsl:text>a</xsl:text>
597 <xsl:call-template name="capitalize">
598 <xsl:with-param name="str" select="param [last()]/@name"/>
599 </xsl:call-template>
600 <xsl:text>); }</xsl:text>
601 </xsl:when>
602 <xsl:otherwise test="not(param)">
603 <xsl:text>() { return smth </xsl:text>
604 <xsl:call-template name="capitalize">
605 <xsl:with-param name="str" select="@name"/>
606 </xsl:call-template>
607 <xsl:text>(); }</xsl:text>
608 </xsl:otherwise>
609 </xsl:choose>
610 <xsl:text>&#x0A;</xsl:text>
611 <!-- COM_FORWARD_Interface_Method_TO_OBJ(obj) -->
612 <xsl:text>#define COM_FORWARD_</xsl:text>
613 <xsl:value-of select="$parent/@name"/>
614 <xsl:text>_</xsl:text>
615 <xsl:call-template name="capitalize">
616 <xsl:with-param name="str" select="@name"/>
617 </xsl:call-template>
618 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
619 <xsl:value-of select="$parent/@name"/>
620 <xsl:text>_</xsl:text>
621 <xsl:call-template name="capitalize">
622 <xsl:with-param name="str" select="@name"/>
623 </xsl:call-template>
624 <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
625 <!-- COM_FORWARD_Interface_Method_TO_BASE(base) -->
626 <xsl:text>#define COM_FORWARD_</xsl:text>
627 <xsl:value-of select="$parent/@name"/>
628 <xsl:text>_</xsl:text>
629 <xsl:call-template name="capitalize">
630 <xsl:with-param name="str" select="@name"/>
631 </xsl:call-template>
632 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
633 <xsl:value-of select="$parent/@name"/>
634 <xsl:text>_</xsl:text>
635 <xsl:call-template name="capitalize">
636 <xsl:with-param name="str" select="@name"/>
637 </xsl:call-template>
638 <xsl:text>_TO (base::)&#x0A;</xsl:text>
639
640 <xsl:apply-templates select="@if" mode="end"/>
641
642</xsl:template>
643
644
645<!--
646 * modules
647-->
648<xsl:template match="module">
649 <xsl:apply-templates select="class"/>
650</xsl:template>
651
652
653<!--
654 * co-classes
655-->
656<xsl:template match="module/class">
657 <!-- class and contract id -->
658 <xsl:text>%{C++&#x0A;</xsl:text>
659 <xsl:text>#define NS_</xsl:text>
660 <xsl:call-template name="uppercase">
661 <xsl:with-param name="str" select="@name"/>
662 </xsl:call-template>
663 <xsl:text>_CID { \&#x0A;</xsl:text>
664 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
665 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
666 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
667 <xsl:text>, \&#x0A; </xsl:text>
668 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
669 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
670 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
671 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
672 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
673 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
674 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
675 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
676 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
677 <xsl:text>#define NS_</xsl:text>
678 <xsl:call-template name="uppercase">
679 <xsl:with-param name="str" select="@name"/>
680 </xsl:call-template>
681 <!-- Contract ID -->
682 <xsl:text>_CONTRACTID &quot;@</xsl:text>
683 <xsl:value-of select="@namespace"/>
684 <xsl:text>/</xsl:text>
685 <xsl:value-of select="@name"/>
686 <xsl:text>;1&quot;&#x0A;</xsl:text>
687 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32 -->
688 <xsl:text>// for compatibility with Win32&#x0A;</xsl:text>
689 <xsl:text>#define CLSID_</xsl:text>
690 <xsl:value-of select="@name"/>
691 <xsl:text> (nsCID) NS_</xsl:text>
692 <xsl:call-template name="uppercase">
693 <xsl:with-param name="str" select="@name"/>
694 </xsl:call-template>
695 <xsl:text>_CID&#x0A;</xsl:text>
696 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
697</xsl:template>
698
699
700<!--
701 * enumerators
702-->
703<xsl:template match="enumerator">[
704 uuid(<xsl:value-of select="@uuid"/>),
705 scriptable
706]
707<xsl:text>interface </xsl:text>
708 <xsl:value-of select="@name"/>
709 <xsl:text> : nsISupports&#x0A;{&#x0A;</xsl:text>
710 <!-- HasMore -->
711 <xsl:text> void hasMore ([retval] out boolean more);&#x0A;&#x0A;</xsl:text>
712 <!-- GetNext -->
713 <xsl:text> void getNext ([retval] out </xsl:text>
714 <xsl:apply-templates select="@type"/>
715 <xsl:text> next);&#x0A;&#x0A;</xsl:text>
716 <!-- -->
717 <xsl:text>}; /* interface </xsl:text>
718 <xsl:value-of select="@name"/>
719 <xsl:text> */&#x0A;&#x0A;</xsl:text>
720</xsl:template>
721
722
723<!--
724 * collections
725-->
726<xsl:template match="collection">
727 <xsl:if test="not(@readonly='yes')">
728 <xsl:message terminate="yes">
729 <xsl:value-of select="concat(@name,': ')"/>
730 <xsl:text>non-readonly collections are not currently supported</xsl:text>
731 </xsl:message>
732 </xsl:if>[
733 uuid(<xsl:value-of select="@uuid"/>),
734 scriptable
735]
736<xsl:text>interface </xsl:text>
737 <xsl:value-of select="@name"/>
738 <xsl:text> : nsISupports&#x0A;{&#x0A;</xsl:text>
739 <!-- Count -->
740 <xsl:text> readonly attribute unsigned long count;&#x0A;&#x0A;</xsl:text>
741 <!-- GetItemAt -->
742 <xsl:text> void getItemAt (in unsigned long index, [retval] out </xsl:text>
743 <xsl:apply-templates select="@type"/>
744 <xsl:text> item);&#x0A;&#x0A;</xsl:text>
745 <!-- Enumerate -->
746 <xsl:text> void enumerate ([retval] out </xsl:text>
747 <xsl:apply-templates select="@enumerator"/>
748 <xsl:text> enumerator);&#x0A;&#x0A;</xsl:text>
749 <!-- other extra attributes (properties) -->
750 <xsl:apply-templates select="attribute"/>
751 <!-- other extra methods -->
752 <xsl:apply-templates select="method"/>
753 <!-- 'if' enclosed elements, unsorted -->
754 <xsl:apply-templates select="if"/>
755 <!-- -->
756 <xsl:text>}; /* interface </xsl:text>
757 <xsl:value-of select="@name"/>
758 <xsl:text> */&#x0A;&#x0A;</xsl:text>
759</xsl:template>
760
761
762<!--
763 * enums
764-->
765<xsl:template match="enum">[
766 uuid(<xsl:value-of select="@uuid"/>),
767 scriptable
768]
769<xsl:text>interface </xsl:text>
770 <xsl:value-of select="@name"/>
771 <xsl:text>&#x0A;{&#x0A;</xsl:text>
772 <xsl:for-each select="const">
773 <xsl:text> const PRUint32 </xsl:text>
774 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
775 <xsl:text>;&#x0A;</xsl:text>
776 </xsl:for-each>
777 <xsl:text>};&#x0A;&#x0A;</xsl:text>
778 <!-- -->
779 <xsl:value-of select="concat('/* cross-platform type name for ', @name, ' */&#x0A;')"/>
780 <xsl:text>%{C++&#x0A;</xsl:text>
781 <xsl:value-of select="concat('#define ', @name, '_T', ' ',
782 'PRUint32&#x0A;')"/>
783 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
784 <!-- -->
785 <xsl:value-of select="concat('/* cross-platform constants for ', @name, ' */&#x0A;')"/>
786 <xsl:text>%{C++&#x0A;</xsl:text>
787 <xsl:for-each select="const">
788 <xsl:value-of select="concat('#define ', ../@name, '_', @name, ' ',
789 ../@name, '::', @name, '&#x0A;')"/>
790 </xsl:for-each>
791 <xsl:text>%}&#x0A;&#x0A;</xsl:text>
792</xsl:template>
793
794
795<!--
796 * method parameters
797-->
798<xsl:template match="method/param">
799 <xsl:choose>
800 <!-- safearray parameters -->
801 <xsl:when test="@safearray='yes'">
802 <!-- array size -->
803 <xsl:choose>
804 <xsl:when test="@dir='in'">in </xsl:when>
805 <xsl:when test="@dir='out'">out </xsl:when>
806 <xsl:when test="@dir='return'">out </xsl:when>
807 <xsl:otherwise>in </xsl:otherwise>
808 </xsl:choose>
809 <xsl:text>unsigned long </xsl:text>
810 <xsl:value-of select="@name"/>
811 <xsl:text>Size,&#x0A;</xsl:text>
812 <!-- array pointer -->
813 <xsl:text> [array, size_is(</xsl:text>
814 <xsl:value-of select="@name"/>
815 <xsl:text>Size)</xsl:text>
816 <xsl:choose>
817 <xsl:when test="@dir='in'">] in </xsl:when>
818 <xsl:when test="@dir='out'">] out </xsl:when>
819 <xsl:when test="@dir='return'"> , retval] out </xsl:when>
820 <xsl:otherwise>] in </xsl:otherwise>
821 </xsl:choose>
822 <xsl:apply-templates select="@type"/>
823 <xsl:text> </xsl:text>
824 <xsl:value-of select="@name"/>
825 </xsl:when>
826 <!-- normal and array parameters -->
827 <xsl:otherwise>
828 <xsl:if test="@array">
829 <xsl:if test="@dir='return'">
830 <xsl:message terminate="yes">
831 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
832 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text>
833 </xsl:message>
834 </xsl:if>
835 <xsl:text>[array, </xsl:text>
836 <xsl:choose>
837 <xsl:when test="../param[@name=current()/@array]">
838 <xsl:if test="../param[@name=current()/@array]/@dir != @dir">
839 <xsl:message terminate="yes">
840 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
841 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/>
842 <xsl:text> must have the same direction</xsl:text>
843 </xsl:message>
844 </xsl:if>
845 <xsl:text>size_is(</xsl:text>
846 <xsl:value-of select="@array"/>
847 <xsl:text>)</xsl:text>
848 </xsl:when>
849 <xsl:otherwise>
850 <xsl:message terminate="yes">
851 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
852 <xsl:text>array attribute refers to non-existent param: </xsl:text>
853 <xsl:value-of select="@array"/>
854 </xsl:message>
855 </xsl:otherwise>
856 </xsl:choose>
857 <xsl:text>] </xsl:text>
858 </xsl:if>
859 <xsl:choose>
860 <xsl:when test="@dir='in'">in </xsl:when>
861 <xsl:when test="@dir='out'">out </xsl:when>
862 <xsl:when test="@dir='return'">[retval] out </xsl:when>
863 <xsl:otherwise>in </xsl:otherwise>
864 </xsl:choose>
865 <xsl:apply-templates select="@type"/>
866 <xsl:text> </xsl:text>
867 <xsl:value-of select="@name"/>
868 </xsl:otherwise>
869 </xsl:choose>
870</xsl:template>
871
872<xsl:template match="method/param" mode="forwarder">
873 <xsl:if test="@safearray='yes'">
874 <xsl:text>PRUint32</xsl:text>
875 <xsl:if test="@dir='out' or @dir='return'">
876 <xsl:text> *</xsl:text>
877 </xsl:if>
878 <xsl:text> a</xsl:text>
879 <xsl:call-template name="capitalize">
880 <xsl:with-param name="str" select="@name"/>
881 </xsl:call-template>
882 <xsl:text>Size, </xsl:text>
883 </xsl:if>
884 <xsl:apply-templates select="@type" mode="forwarder"/>
885 <xsl:if test="@dir='out' or @dir='return'">
886 <xsl:text> *</xsl:text>
887 </xsl:if>
888 <xsl:if test="@safearray='yes'">
889 <xsl:text> *</xsl:text>
890 </xsl:if>
891 <xsl:text> a</xsl:text>
892 <xsl:call-template name="capitalize">
893 <xsl:with-param name="str" select="@name"/>
894 </xsl:call-template>
895</xsl:template>
896
897
898<!--
899 * attribute/parameter type conversion
900-->
901<xsl:template match="
902 attribute/@type | param/@type |
903 enumerator/@type | collection/@type | collection/@enumerator
904">
905 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
906
907 <xsl:if test="../@array and ../@safearray='yes'">
908 <xsl:message terminate="yes">
909 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
910 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
911 </xsl:message>
912 </xsl:if>
913
914 <xsl:choose>
915 <!-- modifiers (ignored for 'enumeration' attributes)-->
916 <xsl:when test="name(current())='type' and ../@mod">
917 <xsl:choose>
918 <xsl:when test="../@mod='ptr'">
919 <xsl:choose>
920 <!-- standard types -->
921 <!--xsl:when test=".='result'">??</xsl:when-->
922 <xsl:when test=".='boolean'">booleanPtr</xsl:when>
923 <xsl:when test=".='octet'">octetPtr</xsl:when>
924 <xsl:when test=".='short'">shortPtr</xsl:when>
925 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
926 <xsl:when test=".='long'">longPtr</xsl:when>
927 <xsl:when test=".='long long'">llongPtr</xsl:when>
928 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
929 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
930 <xsl:when test=".='char'">charPtr</xsl:when>
931 <!--xsl:when test=".='string'">??</xsl:when-->
932 <xsl:when test=".='wchar'">wcharPtr</xsl:when>
933 <!--xsl:when test=".='wstring'">??</xsl:when-->
934 <xsl:otherwise>
935 <xsl:message terminate="yes">
936 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
937 <xsl:text>attribute 'mod=</xsl:text>
938 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
939 <xsl:text>' cannot be used with type </xsl:text>
940 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
941 </xsl:message>
942 </xsl:otherwise>
943 </xsl:choose>
944 </xsl:when>
945 <xsl:otherwise>
946 <xsl:message terminate="yes">
947 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
948 <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
949 <xsl:text>of attribute 'mod' is invalid!</xsl:text>
950 </xsl:message>
951 </xsl:otherwise>
952 </xsl:choose>
953 </xsl:when>
954 <!-- no modifiers -->
955 <xsl:otherwise>
956 <xsl:choose>
957 <!-- standard types -->
958 <xsl:when test=".='result'">nsresult</xsl:when>
959 <xsl:when test=".='boolean'">boolean</xsl:when>
960 <xsl:when test=".='octet'">octet</xsl:when>
961 <xsl:when test=".='short'">short</xsl:when>
962 <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
963 <xsl:when test=".='long'">long</xsl:when>
964 <xsl:when test=".='long long'">long long</xsl:when>
965 <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
966 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
967 <xsl:when test=".='char'">char</xsl:when>
968 <xsl:when test=".='wchar'">wchar</xsl:when>
969 <xsl:when test=".='string'">string</xsl:when>
970 <xsl:when test=".='wstring'">wstring</xsl:when>
971 <!-- UUID type -->
972 <xsl:when test=".='uuid'">
973 <xsl:choose>
974 <xsl:when test="name(..)='attribute'">
975 <xsl:choose>
976 <xsl:when test="../@readonly='yes'">
977 <xsl:text>nsIDPtr</xsl:text>
978 </xsl:when>
979 <xsl:otherwise>
980 <xsl:message terminate="yes">
981 <xsl:value-of select="../@name"/>
982 <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
983 </xsl:message>
984 </xsl:otherwise>
985 </xsl:choose>
986 </xsl:when>
987 <xsl:when test="name(..)='param'">
988 <xsl:choose>
989 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
990 <xsl:text>nsIDRef</xsl:text>
991 </xsl:when>
992 <xsl:otherwise>
993 <xsl:text>nsIDPtr</xsl:text>
994 </xsl:otherwise>
995 </xsl:choose>
996 </xsl:when>
997 </xsl:choose>
998 </xsl:when>
999 <!-- system interface types -->
1000 <xsl:when test=".='$unknown'">nsISupports</xsl:when>
1001 <xsl:otherwise>
1002 <xsl:choose>
1003 <!-- enum types -->
1004 <xsl:when test="
1005 (ancestor::library/enum[@name=current()]) or
1006 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
1007 ">
1008 <xsl:text>PRUint32</xsl:text>
1009 </xsl:when>
1010 <!-- custom interface types -->
1011 <xsl:when test="
1012 (name(current())='enumerator' and
1013 ((ancestor::library/enumerator[@name=current()]) or
1014 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
1015 ) or
1016 ((ancestor::library/interface[@name=current()]) or
1017 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
1018 ) or
1019 ((ancestor::library/collection[@name=current()]) or
1020 (ancestor::library/if[@target=$self_target]/collection[@name=current()])
1021 )
1022 ">
1023 <xsl:value-of select="."/>
1024 </xsl:when>
1025 <!-- other types -->
1026 <xsl:otherwise>
1027 <xsl:message terminate="yes">
1028 <xsl:text>Unknown parameter type: </xsl:text>
1029 <xsl:value-of select="."/>
1030 </xsl:message>
1031 </xsl:otherwise>
1032 </xsl:choose>
1033 </xsl:otherwise>
1034 </xsl:choose>
1035 </xsl:otherwise>
1036 </xsl:choose>
1037</xsl:template>
1038
1039<xsl:template match="
1040 attribute/@type | param/@type |
1041 enumerator/@type | collection/@type | collection/@enumerator
1042" mode="forwarder">
1043
1044 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
1045
1046 <xsl:choose>
1047 <!-- modifiers (ignored for 'enumeration' attributes)-->
1048 <xsl:when test="name(current())='type' and ../@mod">
1049 <xsl:choose>
1050 <xsl:when test="../@mod='ptr'">
1051 <xsl:choose>
1052 <!-- standard types -->
1053 <!--xsl:when test=".='result'">??</xsl:when-->
1054 <xsl:when test=".='boolean'">PRBool *</xsl:when>
1055 <xsl:when test=".='octet'">PRUint8 *</xsl:when>
1056 <xsl:when test=".='short'">PRInt16 *</xsl:when>
1057 <xsl:when test=".='unsigned short'">PRUint16 *</xsl:when>
1058 <xsl:when test=".='long'">PRInt32 *</xsl:when>
1059 <xsl:when test=".='long long'">PRInt64 *</xsl:when>
1060 <xsl:when test=".='unsigned long'">PRUint32 *</xsl:when>
1061 <xsl:when test=".='unsigned long long'">PRUint64 *</xsl:when>
1062 <xsl:when test=".='char'">char *</xsl:when>
1063 <!--xsl:when test=".='string'">??</xsl:when-->
1064 <xsl:when test=".='wchar'">PRUnichar *</xsl:when>
1065 <!--xsl:when test=".='wstring'">??</xsl:when-->
1066 </xsl:choose>
1067 </xsl:when>
1068 </xsl:choose>
1069 </xsl:when>
1070 <!-- no modifiers -->
1071 <xsl:otherwise>
1072 <xsl:choose>
1073 <!-- standard types -->
1074 <xsl:when test=".='result'">nsresult</xsl:when>
1075 <xsl:when test=".='boolean'">PRBool</xsl:when>
1076 <xsl:when test=".='octet'">PRUint8</xsl:when>
1077 <xsl:when test=".='short'">PRInt16</xsl:when>
1078 <xsl:when test=".='unsigned short'">PRUint16</xsl:when>
1079 <xsl:when test=".='long'">PRInt32</xsl:when>
1080 <xsl:when test=".='long long'">PRInt64</xsl:when>
1081 <xsl:when test=".='unsigned long'">PRUint32</xsl:when>
1082 <xsl:when test=".='unsigned long long'">PRUint64</xsl:when>
1083 <xsl:when test=".='char'">char</xsl:when>
1084 <xsl:when test=".='wchar'">PRUnichar</xsl:when>
1085 <!-- string types -->
1086 <xsl:when test=".='string'">char *</xsl:when>
1087 <xsl:when test=".='wstring'">PRUnichar *</xsl:when>
1088 <!-- UUID type -->
1089 <xsl:when test=".='uuid'">
1090 <xsl:choose>
1091 <xsl:when test="name(..)='attribute'">
1092 <xsl:choose>
1093 <xsl:when test="../@readonly='yes'">
1094 <xsl:text>nsID *</xsl:text>
1095 </xsl:when>
1096 </xsl:choose>
1097 </xsl:when>
1098 <xsl:when test="name(..)='param'">
1099 <xsl:choose>
1100 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
1101 <xsl:text>const nsID &amp;</xsl:text>
1102 </xsl:when>
1103 <xsl:otherwise>
1104 <xsl:text>nsID *</xsl:text>
1105 </xsl:otherwise>
1106 </xsl:choose>
1107 </xsl:when>
1108 </xsl:choose>
1109 </xsl:when>
1110 <!-- system interface types -->
1111 <xsl:when test=".='$unknown'">nsISupports *</xsl:when>
1112 <xsl:otherwise>
1113 <xsl:choose>
1114 <!-- enum types -->
1115 <xsl:when test="
1116 (ancestor::library/enum[@name=current()]) or
1117 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
1118 ">
1119 <xsl:text>PRUint32</xsl:text>
1120 </xsl:when>
1121 <!-- custom interface types -->
1122 <xsl:when test="
1123 (name(current())='enumerator' and
1124 ((ancestor::library/enumerator[@name=current()]) or
1125 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
1126 ) or
1127 ((ancestor::library/interface[@name=current()]) or
1128 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
1129 ) or
1130 ((ancestor::library/collection[@name=current()]) or
1131 (ancestor::library/if[@target=$self_target]/collection[@name=current()])
1132 )
1133 ">
1134 <xsl:value-of select="."/>
1135 <xsl:text> *</xsl:text>
1136 </xsl:when>
1137 <!-- other types -->
1138 </xsl:choose>
1139 </xsl:otherwise>
1140 </xsl:choose>
1141 </xsl:otherwise>
1142 </xsl:choose>
1143</xsl:template>
1144
1145</xsl:stylesheet>
1146
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