VirtualBox

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

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

Main: XIDL: Added support for <result> tags in <library> (MIDL, XPIDL, Doxygen). Added a couple of exemplary VBOX_E_ result codes.

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