VirtualBox

source: vbox/trunk/src/VBox/Main/cbinding/xpcidl.xsl@ 18780

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

Cbinding: removed repeated words (Foundation, the)

  • Property svn:eol-style set to native
File size: 63.9 KB
Line 
1<?xml version="1.0"?>
2<!-- $Id: xpidl.xsl 39869 2008-11-25 13:37:40Z dmik $ -->
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) 2008-2009 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 * translates the string to lowercase
81-->
82<xsl:template name="lowercase">
83 <xsl:param name="str" select="."/>
84 <xsl:value-of select="
85 translate($str,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')
86 "/>
87</xsl:template>
88
89
90<!--
91// templates
92/////////////////////////////////////////////////////////////////////////////
93-->
94
95
96<!--
97 * not explicitly matched elements and attributes
98-->
99<xsl:template match="*"/>
100
101
102<!--
103 * header
104-->
105<xsl:template match="/idl">
106 <xsl:text>
107/*
108 * DO NOT EDIT! This is a generated file.
109 *
110 * XPCOM IDL (XPIDL) definition for VirtualBox Main API (COM interfaces)
111 * generated from XIDL (XML interface definition).
112 *
113 * Source : src/VBox/Main/idl/VirtualBox.xidl
114 * Generator : src/VBox/Main/idl/xpcidl.xsl
115 *
116 * This file contains portions from the following Mozilla XPCOM files:
117 * xpcom/include/xpcom/nsID.h
118 * xpcom/include/nsIException.h
119 * xpcom/include/nsprpub/prtypes.h
120 * xpcom/include/xpcom/nsISupportsBase.h
121 *
122 * These files were originally triple-licensed (MPL/GPL2/LGPL2.1). Sun
123 * elects to distribute this derived work under the LGPL2.1 only.
124 */
125
126/*
127 * Copyright (C) 2008-2009 Sun Microsystems, Inc.
128 *
129 * This file is part of a free software library; you can redistribute
130 * it and/or modify it under the terms of the GNU Lesser General
131 * Public License version 2.1 as published by the Free Software
132 * Foundation and shipped in the "COPYING" file with this library.
133 * The library is distributed in the hope that it will be useful,
134 * but WITHOUT ANY WARRANTY of any kind.
135 *
136 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if
137 * any license choice other than GPL or LGPL is available it will
138 * apply instead, Sun elects to use only the Lesser General Public
139 * License version 2.1 (LGPLv2) at this time for any software where
140 * a choice of LGPL license versions is made available with the
141 * language indicating that LGPLv2 or any later version may be used,
142 * or where a choice of which version of the LGPL is applied is
143 * otherwise unspecified.
144 *
145 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
146 * Clara, CA 95054 USA or visit http://www.sun.com if you need
147 * additional information or have any questions.
148 */
149
150#ifndef ___VirtualBox_CXPCOM_h
151#define ___VirtualBox_CXPCOM_h
152
153#ifdef __cplusplus
154# include "VirtualBox_XPCOM.h"
155#else /* !__cplusplus */
156
157#include &lt;stddef.h&gt;
158#include "wchar.h"
159
160#if defined(WIN32)
161
162#define PR_EXPORT(__type) extern __declspec(dllexport) __type
163#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
164#define PR_IMPORT(__type) __declspec(dllimport) __type
165#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
166
167#define PR_EXTERN(__type) extern __declspec(dllexport) __type
168#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
169#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
170#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
171
172#define PR_CALLBACK
173#define PR_CALLBACK_DECL
174#define PR_STATIC_CALLBACK(__x) static __x
175
176#elif defined(XP_BEOS)
177
178#define PR_EXPORT(__type) extern __declspec(dllexport) __type
179#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
180#define PR_IMPORT(__type) extern __declspec(dllexport) __type
181#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
182
183#define PR_EXTERN(__type) extern __declspec(dllexport) __type
184#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
185#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
186#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
187
188#define PR_CALLBACK
189#define PR_CALLBACK_DECL
190#define PR_STATIC_CALLBACK(__x) static __x
191
192#elif defined(WIN16)
193
194#define PR_CALLBACK_DECL __cdecl
195
196#if defined(_WINDLL)
197#define PR_EXPORT(__type) extern __type _cdecl _export _loadds
198#define PR_IMPORT(__type) extern __type _cdecl _export _loadds
199#define PR_EXPORT_DATA(__type) extern __type _export
200#define PR_IMPORT_DATA(__type) extern __type _export
201
202#define PR_EXTERN(__type) extern __type _cdecl _export _loadds
203#define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
204#define PR_EXTERN_DATA(__type) extern __type _export
205#define PR_IMPLEMENT_DATA(__type) __type _export
206
207#define PR_CALLBACK __cdecl __loadds
208#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
209
210#else /* this must be .EXE */
211#define PR_EXPORT(__type) extern __type _cdecl _export
212#define PR_IMPORT(__type) extern __type _cdecl _export
213#define PR_EXPORT_DATA(__type) extern __type _export
214#define PR_IMPORT_DATA(__type) extern __type _export
215
216#define PR_EXTERN(__type) extern __type _cdecl _export
217#define PR_IMPLEMENT(__type) __type _cdecl _export
218#define PR_EXTERN_DATA(__type) extern __type _export
219#define PR_IMPLEMENT_DATA(__type) __type _export
220
221#define PR_CALLBACK __cdecl __loadds
222#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
223#endif /* _WINDLL */
224
225#elif defined(XP_MAC)
226
227#define PR_EXPORT(__type) extern __declspec(export) __type
228#define PR_EXPORT_DATA(__type) extern __declspec(export) __type
229#define PR_IMPORT(__type) extern __declspec(export) __type
230#define PR_IMPORT_DATA(__type) extern __declspec(export) __type
231
232#define PR_EXTERN(__type) extern __declspec(export) __type
233#define PR_IMPLEMENT(__type) __declspec(export) __type
234#define PR_EXTERN_DATA(__type) extern __declspec(export) __type
235#define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
236
237#define PR_CALLBACK
238#define PR_CALLBACK_DECL
239#define PR_STATIC_CALLBACK(__x) static __x
240
241#elif defined(XP_OS2) &amp;&amp; defined(__declspec)
242
243#define PR_EXPORT(__type) extern __declspec(dllexport) __type
244#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
245#define PR_IMPORT(__type) __declspec(dllimport) __type
246#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
247
248#define PR_EXTERN(__type) extern __declspec(dllexport) __type
249#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
250#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
251#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
252
253#define PR_CALLBACK
254#define PR_CALLBACK_DECL
255#define PR_STATIC_CALLBACK(__x) static __x
256
257#elif defined(XP_OS2_VACPP)
258
259#define PR_EXPORT(__type) extern __type
260#define PR_EXPORT_DATA(__type) extern __type
261#define PR_IMPORT(__type) extern __type
262#define PR_IMPORT_DATA(__type) extern __type
263
264#define PR_EXTERN(__type) extern __type
265#define PR_IMPLEMENT(__type) __type
266#define PR_EXTERN_DATA(__type) extern __type
267#define PR_IMPLEMENT_DATA(__type) __type
268#define PR_CALLBACK _Optlink
269#define PR_CALLBACK_DECL
270#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
271
272#else /* Unix */
273
274# ifdef VBOX_HAVE_VISIBILITY_HIDDEN
275# define PR_EXPORT(__type) __attribute__((visibility("default"))) extern __type
276# define PR_EXPORT_DATA(__type) __attribute__((visibility("default"))) extern __type
277# define PR_IMPORT(__type) extern __type
278# define PR_IMPORT_DATA(__type) extern __type
279# define PR_EXTERN(__type) __attribute__((visibility("default"))) extern __type
280# define PR_IMPLEMENT(__type) __attribute__((visibility("default"))) __type
281# define PR_EXTERN_DATA(__type) __attribute__((visibility("default"))) extern __type
282# define PR_IMPLEMENT_DATA(__type) __attribute__((visibility("default"))) __type
283# define PR_CALLBACK
284# define PR_CALLBACK_DECL
285# define PR_STATIC_CALLBACK(__x) static __x
286# else
287# define PR_EXPORT(__type) extern __type
288# define PR_EXPORT_DATA(__type) extern __type
289# define PR_IMPORT(__type) extern __type
290# define PR_IMPORT_DATA(__type) extern __type
291# define PR_EXTERN(__type) extern __type
292# define PR_IMPLEMENT(__type) __type
293# define PR_EXTERN_DATA(__type) extern __type
294# define PR_IMPLEMENT_DATA(__type) __type
295# define PR_CALLBACK
296# define PR_CALLBACK_DECL
297# define PR_STATIC_CALLBACK(__x) static __x
298# endif
299#endif
300
301#if defined(_NSPR_BUILD_)
302#define NSPR_API(__type) PR_EXPORT(__type)
303#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
304#else
305#define NSPR_API(__type) PR_IMPORT(__type)
306#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
307#endif
308
309typedef unsigned char PRUint8;
310#if (defined(HPUX) &amp;&amp; defined(__cplusplus) \
311 &amp;&amp; !defined(__GNUC__) &amp;&amp; __cplusplus &lt; 199707L) \
312 || (defined(SCO) &amp;&amp; defined(__cplusplus) \
313 &amp;&amp; !defined(__GNUC__) &amp;&amp; __cplusplus == 1L)
314typedef char PRInt8;
315#else
316typedef signed char PRInt8;
317#endif
318
319#define PR_INT8_MAX 127
320#define PR_INT8_MIN (-128)
321#define PR_UINT8_MAX 255U
322
323typedef unsigned short PRUint16;
324typedef short PRInt16;
325
326#define PR_INT16_MAX 32767
327#define PR_INT16_MIN (-32768)
328#define PR_UINT16_MAX 65535U
329
330typedef unsigned int PRUint32;
331typedef int PRInt32;
332#define PR_INT32(x) x
333#define PR_UINT32(x) x ## U
334
335#define PR_INT32_MAX PR_INT32(2147483647)
336#define PR_INT32_MIN (-PR_INT32_MAX - 1)
337#define PR_UINT32_MAX PR_UINT32(4294967295)
338
339typedef long PRInt64;
340typedef unsigned long PRUint64;
341typedef int PRIntn;
342typedef unsigned int PRUintn;
343
344typedef double PRFloat64;
345typedef size_t PRSize;
346
347typedef ptrdiff_t PRPtrdiff;
348
349typedef unsigned long PRUptrdiff;
350
351typedef PRIntn PRBool;
352
353#define PR_TRUE 1
354#define PR_FALSE 0
355
356typedef PRUint8 PRPackedBool;
357
358/*
359** Status code used by some routines that have a single point of failure or
360** special status return.
361*/
362typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
363
364#ifndef __PRUNICHAR__
365#define __PRUNICHAR__
366#if defined(WIN32) || defined(XP_MAC)
367typedef wchar_t PRUnichar;
368#else
369typedef PRUint16 PRUnichar;
370#endif
371#endif
372
373typedef long PRWord;
374typedef unsigned long PRUword;
375
376#define nsnull 0
377typedef PRUint32 nsresult;
378
379#if defined(__GNUC__) &amp;&amp; (__GNUC__ > 2)
380#define NS_LIKELY(x) (__builtin_expect((x), 1))
381#define NS_UNLIKELY(x) (__builtin_expect((x), 0))
382#else
383#define NS_LIKELY(x) (x)
384#define NS_UNLIKELY(x) (x)
385#endif
386
387#define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) &amp; 0x80000000))
388#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) &amp; 0x80000000)))
389
390/**
391 * An "interface id" which can be used to uniquely identify a given
392 * interface.
393 * A "unique identifier". This is modeled after OSF DCE UUIDs.
394 */
395
396struct nsID {
397 PRUint32 m0;
398 PRUint16 m1;
399 PRUint16 m2;
400 PRUint8 m3[8];
401};
402
403typedef struct nsID nsID;
404typedef nsID nsIID;
405
406struct nsISupports; /* forward declaration */
407struct nsIStackFrame; /* forward declaration */
408struct nsIException; /* forward declaration */
409typedef struct nsISupports nsISupports; /* forward declaration */
410typedef struct nsIStackFrame nsIStackFrame; /* forward declaration */
411typedef struct nsIException nsIException; /* forward declaration */
412
413/**
414 * IID for the nsISupports interface
415 * {00000000-0000-0000-c000-000000000046}
416 *
417 * To maintain binary compatibility with COM's IUnknown, we define the IID
418 * of nsISupports to be the same as that of COM's IUnknown.
419 */
420#define NS_ISUPPORTS_IID \
421 { 0x00000000, 0x0000, 0x0000, \
422 {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
423
424/**
425 * Reference count values
426 *
427 * This is the return type for AddRef() and Release() in nsISupports.
428 * IUnknown of COM returns an unsigned long from equivalent functions.
429 * The following ifdef exists to maintain binary compatibility with
430 * IUnknown.
431 */
432
433/**
434 * Basic component object model interface. Objects which implement
435 * this interface support runtime interface discovery (QueryInterface)
436 * and a reference counted memory model (AddRef/Release). This is
437 * modelled after the win32 IUnknown API.
438 */
439struct nsISupports_vtbl {
440
441 /**
442 * @name Methods
443 */
444
445 /**
446 * A run time mechanism for interface discovery.
447 * @param aIID [in] A requested interface IID
448 * @param aInstancePtr [out] A pointer to an interface pointer to
449 * receive the result.
450 * @return NS_OK if the interface is supported by the associated
451 * instance, NS_NOINTERFACE if it is not.
452 * NS_ERROR_INVALID_POINTER if aInstancePtr is NULL.
453 */
454 nsresult (*QueryInterface)(nsISupports *this_, const nsID *iid, void **resultp);
455 /**
456 * Increases the reference count for this interface.
457 * The associated instance will not be deleted unless
458 * the reference count is returned to zero.
459 *
460 * @return The resulting reference count.
461 */
462 nsresult (*AddRef)(nsISupports *this_);
463
464 /**
465 * Decreases the reference count for this interface.
466 * Generally, if the reference count returns to zero,
467 * the associated instance is deleted.
468 *
469 * @return The resulting reference count.
470 */
471 nsresult (*Release)(nsISupports *this_);
472
473};
474
475struct nsISupports {
476 struct nsISupports_vtbl *vtbl;
477};
478
479/* starting interface: nsIException */
480#define NS_IEXCEPTION_IID_STR "f3a8d3b4-c424-4edc-8bf6-8974c983ba78"
481
482#define NS_IEXCEPTION_IID \
483 {0xf3a8d3b4, 0xc424, 0x4edc, \
484 { 0x8b, 0xf6, 0x89, 0x74, 0xc9, 0x83, 0xba, 0x78 }}
485
486struct nsIException_vtbl {
487
488 /* Methods from the Class nsISupports */
489 struct nsISupports_vtbl nsisupports;
490
491 /* readonly attribute string message; */
492 nsresult (*GetMessage)(nsIException *this_, PRUnichar * *aMessage);
493
494 /* readonly attribute nsresult (*result; */
495 nsresult (*GetResult)(nsIException *this_, nsresult *aResult);
496
497 /* readonly attribute string name; */
498 nsresult (*GetName)(nsIException *this_, PRUnichar * *aName);
499
500 /* readonly attribute string filename; */
501 nsresult (*GetFilename)(nsIException *this_, PRUnichar * *aFilename);
502
503 /* readonly attribute PRUint32 lineNumber; */
504 nsresult (*GetLineNumber)(nsIException *this_, PRUint32 *aLineNumber);
505
506 /* readonly attribute PRUint32 columnNumber; */
507 nsresult (*GetColumnNumber)(nsIException *this_, PRUint32 *aColumnNumber);
508
509 /* readonly attribute nsIStackFrame location; */
510 nsresult (*GetLocation)(nsIException *this_, nsIStackFrame * *aLocation);
511
512 /* readonly attribute nsIException inner; */
513 nsresult (*GetInner)(nsIException *this_, nsIException * *aInner);
514
515 /* readonly attribute nsISupports data; */
516 nsresult (*GetData)(nsIException *this_, nsISupports * *aData);
517
518 /* string toString (); */
519 nsresult (*ToString)(nsIException *this_, PRUnichar **_retval);
520};
521
522struct nsIException {
523 struct nsIException_vtbl *vtbl;
524};
525
526/* starting interface: nsIStackFrame */
527#define NS_ISTACKFRAME_IID_STR "91d82105-7c62-4f8b-9779-154277c0ee90"
528
529#define NS_ISTACKFRAME_IID \
530 {0x91d82105, 0x7c62, 0x4f8b, \
531 { 0x97, 0x79, 0x15, 0x42, 0x77, 0xc0, 0xee, 0x90 }}
532
533struct nsIStackFrame_vtbl {
534
535 /* Methods from the Class nsISupports */
536 struct nsISupports_vtbl nsisupports;
537
538 /* readonly attribute PRUint32 language; */
539 nsresult (*GetLanguage)(nsIStackFrame *this_, PRUint32 *aLanguage);
540
541 /* readonly attribute string languageName; */
542 nsresult (*GetLanguageName)(nsIStackFrame *this_, PRUnichar * *aLanguageName);
543
544 /* readonly attribute string filename; */
545 nsresult (*GetFilename)(nsIStackFrame *this_, PRUnichar * *aFilename);
546
547 /* readonly attribute string name; */
548 nsresult (*GetName)(nsIStackFrame *this_, PRUnichar * *aName);
549
550 /* readonly attribute PRInt32 lineNumber; */
551 nsresult (*GetLineNumber)(nsIStackFrame *this_, PRInt32 *aLineNumber);
552
553 /* readonly attribute string sourceLine; */
554 nsresult (*GetSourceLine)(nsIStackFrame *this_, PRUnichar * *aSourceLine);
555
556 /* readonly attribute nsIStackFrame caller; */
557 nsresult (*GetCaller)(nsIStackFrame *this_, nsIStackFrame * *aCaller);
558
559 /* string toString (); */
560 nsresult (*ToString)(nsIStackFrame *this_, PRUnichar **_retval);
561};
562
563struct nsIStackFrame {
564 struct nsIStackFrame_vtbl *vtbl;
565};
566
567</xsl:text>
568 <xsl:apply-templates/>
569<xsl:text>
570#endif /* !__cplusplus */
571
572#ifdef IN_VBOXXPCOMC
573# define VBOXXPCOMC_DECL(type) PR_EXPORT(type)
574#else
575# define VBOXXPCOMC_DECL(type) PR_IMPORT(type)
576#endif
577
578#ifdef __cplusplus
579extern "C" {
580#endif
581
582
583/**
584 * Function table for dynamic linking.
585 * Use VBoxGetFunctions() to obtain the pointer to it.
586 */
587typedef struct VBOXXPCOMC
588{
589 /** The size of the structure. */
590 unsigned cb;
591 /** The structure version. */
592 unsigned uVersion;
593
594 unsigned int (*pfnGetVersion)(void);
595
596 void (*pfnComInitialize)(IVirtualBox **virtualBox, ISession **session);
597 void (*pfnComUninitialize)(void);
598
599 void (*pfnComUnallocMem)(void *pv);
600 void (*pfnUtf16Free)(PRUnichar *pwszString);
601 void (*pfnUtf8Free)(char *pszString);
602
603 int (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
604 int (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
605
606 /** Tail version, same as uVersion. */
607 unsigned uEndVersion;
608} VBOXXPCOMC;
609/** Pointer to a const VBoxXPCOMC function table. */
610typedef VBOXXPCOMC const *PCVBOXXPCOM;
611
612/** The current interface version.
613 * For use with VBoxGetXPCOMCFunctions and to be found in
614 * VBOXXPCOMC::uVersion. */
615#define VBOX_XPCOMC_VERSION 0x00010000U
616
617VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
618/** Typedef for VBoxGetXPCOMCFunctions. */
619typedef PCVBOXXPCOM (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
620
621/** The symbol name of VBoxGetXPCOMCFunctions. */
622#if defined(__OS2__)
623# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "_VBoxGetXPCOMCFunctions"
624#else
625# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "VBoxGetXPCOMCFunctions"
626#endif
627
628
629#ifdef __cplusplus
630}
631#endif
632
633#endif /* !___VirtualBox_CXPCOM_h */
634</xsl:text>
635</xsl:template>
636
637<!--
638 * ignore all |if|s except those for XPIDL target
639<xsl:template match="if">
640 <xsl:if test="@target='xpidl'">
641 <xsl:apply-templates/>
642 </xsl:if>
643</xsl:template>
644<xsl:template match="if" mode="forward">
645 <xsl:if test="@target='xpidl'">
646 <xsl:apply-templates mode="forward"/>
647 </xsl:if>
648</xsl:template>
649<xsl:template match="if" mode="forwarder">
650 <xsl:if test="@target='midl'">
651 <xsl:apply-templates mode="forwarder"/>
652 </xsl:if>
653</xsl:template>
654
655-->
656
657<!--
658 * cpp_quote
659<xsl:template match="cpp">
660 <xsl:if test="text()">
661 <xsl:text>%{C++</xsl:text>
662 <xsl:value-of select="text()"/>
663 <xsl:text>&#x0A;%}&#x0A;&#x0A;</xsl:text>
664 </xsl:if>
665 <xsl:if test="not(text()) and @line">
666 <xsl:text>%{C++&#x0A;</xsl:text>
667 <xsl:value-of select="@line"/>
668 <xsl:text>&#x0A;%}&#x0A;&#x0A;</xsl:text>
669 </xsl:if>
670</xsl:template>
671-->
672
673
674<!--
675 * #if statement (@if attribute)
676 * @note
677 * xpidl doesn't support any preprocessor defines other than #include
678 * (it just ignores them), so the generated IDL will most likely be
679 * invalid. So for now we forbid using @if attributes
680-->
681<xsl:template match="@if" mode="begin">
682 <xsl:message terminate="yes">
683 @if attributes are not currently allowed because xpidl lacks
684 support for #ifdef and stuff.
685 </xsl:message>
686 <xsl:text>#if </xsl:text>
687 <xsl:value-of select="."/>
688 <xsl:text>&#x0A;</xsl:text>
689</xsl:template>
690<xsl:template match="@if" mode="end">
691 <xsl:text>#endif&#x0A;</xsl:text>
692</xsl:template>
693
694
695<!--
696 * libraries
697-->
698<xsl:template match="library">
699 <!-- result codes -->
700 <xsl:text>&#x0A;</xsl:text>
701 <xsl:for-each select="result">
702 <xsl:apply-templates select="."/>
703 </xsl:for-each>
704 <xsl:text>&#x0A;&#x0A;</xsl:text>
705 <!-- forward declarations -->
706 <xsl:apply-templates select="if | interface | collection | enumerator" mode="forward"/>
707 <xsl:text>&#x0A;</xsl:text>
708 <!-- typedef'ing the struct declarations -->
709 <xsl:apply-templates select="if | interface | collection | enumerator" mode="typedef"/>
710 <xsl:text>&#x0A;</xsl:text>
711 <!-- all enums go first -->
712 <xsl:apply-templates select="enum | if/enum"/>
713 <!-- everything else but result codes and enums -->
714 <xsl:apply-templates select="*[not(self::result or self::enum) and
715 not(self::if[result] or self::if[enum])]"/>
716 <!-- -->
717</xsl:template>
718
719
720<!--
721 * result codes
722-->
723<xsl:template match="result">
724 <xsl:value-of select="concat('#define ',@name,' ',@value)"/>
725 <xsl:text>&#x0A;</xsl:text>
726</xsl:template>
727
728
729<!--
730 * forward declarations
731-->
732<xsl:template match="interface | collection | enumerator" mode="forward">
733 <xsl:text>struct </xsl:text>
734 <xsl:value-of select="@name"/>
735 <xsl:text>;&#x0A;</xsl:text>
736</xsl:template>
737
738
739<!--
740 * typedef'ing the struct declarations
741-->
742<xsl:template match="interface | collection | enumerator" mode="typedef">
743 <xsl:text>typedef struct </xsl:text>
744 <xsl:value-of select="@name"/>
745 <xsl:text> </xsl:text>
746 <xsl:value-of select="@name"/>
747 <xsl:text>;&#x0A;</xsl:text>
748</xsl:template>
749
750
751<!--
752 * interfaces
753-->
754<xsl:template match="interface">
755 <xsl:text>/* Start of struct </xsl:text>
756 <xsl:value-of select="@name"/>
757 <xsl:text> Declaration */&#x0A;</xsl:text>
758 <xsl:text>#define </xsl:text>
759 <xsl:call-template name="uppercase">
760 <xsl:with-param name="str" select="@name"/>
761 </xsl:call-template>
762 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
763 <xsl:text>&#x0A;</xsl:text>
764 <xsl:text>#define </xsl:text>
765 <xsl:call-template name="uppercase">
766 <xsl:with-param name="str" select="@name"/>
767 </xsl:call-template>
768 <xsl:text>_IID { \&#x0A;</xsl:text>
769 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
770 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
771 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
772 <xsl:text>, \&#x0A; </xsl:text>
773 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
774 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
775 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
776 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
777 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
778 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
779 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
780 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
781 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
782 <xsl:text>struct </xsl:text>
783 <xsl:value-of select="@name"/>
784 <xsl:text>_vtbl&#x0A;{&#x0A;</xsl:text>
785 <xsl:text> </xsl:text>
786 <xsl:choose>
787 <xsl:when test="@extends='$unknown'">struct nsISupports_vtbl nsisupports;</xsl:when>
788 <xsl:when test="@extends='$dispatched'">struct nsISupports_vtbl nsisupports;</xsl:when>
789 <xsl:when test="@extends='$errorinfo'">struct nsIException_vtbl nsiexception;</xsl:when>
790 <xsl:otherwise>
791 <xsl:text>struct </xsl:text>
792 <xsl:value-of select="@extends"/>
793 <xsl:text>_vtbl </xsl:text>
794 <xsl:call-template name="lowercase">
795 <xsl:with-param name="str" select="@extends"/>
796 </xsl:call-template>
797 <xsl:text>;</xsl:text>
798 </xsl:otherwise>
799 </xsl:choose>
800 <xsl:text>&#x0A;&#x0A;</xsl:text>
801 <!-- attributes (properties) -->
802 <xsl:apply-templates select="attribute"/>
803 <!-- methods -->
804 <xsl:apply-templates select="method"/>
805 <!-- 'if' enclosed elements, unsorted -->
806 <xsl:apply-templates select="if"/>
807 <!-- -->
808 <xsl:text>};</xsl:text>
809 <xsl:text>&#x0A;&#x0A;</xsl:text>
810 <xsl:text>struct </xsl:text>
811 <xsl:value-of select="@name"/>
812 <xsl:text>&#x0A;{&#x0A; struct </xsl:text>
813 <xsl:value-of select="@name"/>
814 <xsl:text>_vtbl *vtbl;&#x0A;};&#x0A;</xsl:text>
815 <xsl:text>/* End of struct </xsl:text>
816 <xsl:value-of select="@name"/>
817 <xsl:text> Declaration */&#x0A;&#x0A;&#x0A;</xsl:text>
818</xsl:template>
819
820
821<!--
822 * attributes
823-->
824<xsl:template match="interface//attribute | collection//attribute">
825 <xsl:if test="@array">
826 <xsl:message terminate="yes">
827 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
828 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
829 </xsl:message>
830 </xsl:if>
831 <xsl:apply-templates select="@if" mode="begin"/>
832 <xsl:if test="@mod='ptr'">
833 <!-- attributes using native types must be non-scriptable
834 <xsl:text> [noscript]&#x0A;</xsl:text>-->
835 </xsl:if>
836 <xsl:choose>
837 <!-- safearray pseudo attribute -->
838 <xsl:when test="@safearray='yes'">
839 <!-- getter -->
840 <xsl:text> nsresult (*Get</xsl:text>
841 <xsl:call-template name="capitalize">
842 <xsl:with-param name="str" select="@name"/>
843 </xsl:call-template>
844 <xsl:text>)(</xsl:text>
845 <xsl:value-of select="../@name" />
846 <xsl:text> *this_, </xsl:text>
847 <!-- array size -->
848 <xsl:text>PRUint32 *</xsl:text>
849 <xsl:value-of select="@name"/>
850 <xsl:text>Size, </xsl:text>
851 <!-- array pointer -->
852 <xsl:apply-templates select="@type" mode="forwarder"/>
853 <xsl:text> **</xsl:text>
854 <xsl:value-of select="@name"/>
855 <xsl:text>);&#x0A;</xsl:text>
856 <!-- setter -->
857 <xsl:if test="not(@readonly='yes')">
858 <xsl:text> nsresult set</xsl:text>
859 <xsl:call-template name="capitalize">
860 <xsl:with-param name="str" select="@name"/>
861 </xsl:call-template>
862 <xsl:text> (&#x0A;</xsl:text>
863 <!-- array size -->
864 <xsl:text> in unsigned long </xsl:text>
865 <xsl:value-of select="@name"/>
866 <xsl:text>Size,&#x0A;</xsl:text>
867 <!-- array pointer -->
868 <xsl:text> [array, size_is(</xsl:text>
869 <xsl:value-of select="@name"/>
870 <xsl:text>Size)] in </xsl:text>
871 <xsl:apply-templates select="@type" mode="forwarder"/>
872 <xsl:text> </xsl:text>
873 <xsl:value-of select="@name"/>
874 <xsl:text>&#x0A; );&#x0A;</xsl:text>
875 </xsl:if>
876 </xsl:when>
877 <!-- normal attribute -->
878 <xsl:otherwise>
879 <xsl:text> </xsl:text>
880 <xsl:if test="@readonly='yes'">
881 <xsl:text>nsresult (*Get</xsl:text>
882 <xsl:call-template name="capitalize">
883 <xsl:with-param name="str" select="@name"/>
884 </xsl:call-template>
885 <xsl:text>)(</xsl:text>
886 <xsl:value-of select="../@name" />
887 <xsl:text> *this_, </xsl:text>
888 <xsl:apply-templates select="@type" mode="forwarder"/>
889 <xsl:text> *</xsl:text>
890 <xsl:value-of select="@name"/>
891 <xsl:text>);&#x0A;</xsl:text>
892 </xsl:if>
893 <xsl:choose>
894 <xsl:when test="@readonly='yes'">
895 </xsl:when>
896 <xsl:otherwise>
897 <xsl:text>nsresult (*Get</xsl:text>
898 <xsl:call-template name="capitalize">
899 <xsl:with-param name="str" select="@name"/>
900 </xsl:call-template>
901 <xsl:text>)(</xsl:text>
902 <xsl:value-of select="../@name" />
903 <xsl:text> *this_, </xsl:text>
904 <xsl:apply-templates select="@type" mode="forwarder"/>
905 <xsl:text> *</xsl:text>
906 <xsl:value-of select="@name"/>
907 <xsl:text>);&#x0A; </xsl:text>
908 <xsl:text>nsresult (*Set</xsl:text>
909 <xsl:call-template name="capitalize">
910 <xsl:with-param name="str" select="@name"/>
911 </xsl:call-template>
912 <xsl:text>)(</xsl:text>
913 <xsl:value-of select="../@name" />
914 <xsl:text> *this_, </xsl:text>
915 <xsl:apply-templates select="@type" mode="forwarder"/>
916 <xsl:text> </xsl:text>
917 <xsl:value-of select="@name"/>
918 <xsl:text>);&#x0A;</xsl:text>
919 </xsl:otherwise>
920 </xsl:choose>
921 </xsl:otherwise>
922 </xsl:choose>
923 <xsl:apply-templates select="@if" mode="end"/>
924 <xsl:text>&#x0A;</xsl:text>
925</xsl:template>
926
927<xsl:template match="interface//attribute | collection//attribute" mode="forwarder">
928
929 <xsl:variable name="parent" select="ancestor::interface | ancestor::collection"/>
930
931 <xsl:apply-templates select="@if" mode="begin"/>
932
933 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO(smth) -->
934 <xsl:text>#define COM_FORWARD_</xsl:text>
935 <xsl:value-of select="$parent/@name"/>
936 <xsl:text>_GETTER_</xsl:text>
937 <xsl:call-template name="capitalize">
938 <xsl:with-param name="str" select="@name"/>
939 </xsl:call-template>
940 <xsl:text>_TO(smth) NS_IMETHOD Get</xsl:text>
941 <xsl:call-template name="capitalize">
942 <xsl:with-param name="str" select="@name"/>
943 </xsl:call-template>
944 <xsl:text> (</xsl:text>
945 <xsl:if test="@safearray='yes'">
946 <xsl:text>PRUint32 * a</xsl:text>
947 <xsl:call-template name="capitalize">
948 <xsl:with-param name="str" select="@name"/>
949 </xsl:call-template>
950 <xsl:text>Size, </xsl:text>
951 </xsl:if>
952 <xsl:apply-templates select="@type" mode="forwarder"/>
953 <xsl:if test="@safearray='yes'">
954 <xsl:text> *</xsl:text>
955 </xsl:if>
956 <xsl:text> * a</xsl:text>
957 <xsl:call-template name="capitalize">
958 <xsl:with-param name="str" select="@name"/>
959 </xsl:call-template>
960 <xsl:text>) { return smth Get</xsl:text>
961 <xsl:call-template name="capitalize">
962 <xsl:with-param name="str" select="@name"/>
963 </xsl:call-template>
964 <xsl:text> (</xsl:text>
965 <xsl:if test="@safearray='yes'">
966 <xsl:text>a</xsl:text>
967 <xsl:call-template name="capitalize">
968 <xsl:with-param name="str" select="@name"/>
969 </xsl:call-template>
970 <xsl:text>Size, </xsl:text>
971 </xsl:if>
972 <xsl:text>a</xsl:text>
973 <xsl:call-template name="capitalize">
974 <xsl:with-param name="str" select="@name"/>
975 </xsl:call-template>
976 <xsl:text>); }&#x0A;</xsl:text>
977 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_OBJ(obj) -->
978 <xsl:text>#define COM_FORWARD_</xsl:text>
979 <xsl:value-of select="$parent/@name"/>
980 <xsl:text>_GETTER_</xsl:text>
981 <xsl:call-template name="capitalize">
982 <xsl:with-param name="str" select="@name"/>
983 </xsl:call-template>
984 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
985 <xsl:value-of select="$parent/@name"/>
986 <xsl:text>_GETTER_</xsl:text>
987 <xsl:call-template name="capitalize">
988 <xsl:with-param name="str" select="@name"/>
989 </xsl:call-template>
990 <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
991 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_BASE(base) -->
992 <xsl:text>#define COM_FORWARD_</xsl:text>
993 <xsl:value-of select="$parent/@name"/>
994 <xsl:text>_GETTER_</xsl:text>
995 <xsl:call-template name="capitalize">
996 <xsl:with-param name="str" select="@name"/>
997 </xsl:call-template>
998 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
999 <xsl:value-of select="$parent/@name"/>
1000 <xsl:text>_GETTER_</xsl:text>
1001 <xsl:call-template name="capitalize">
1002 <xsl:with-param name="str" select="@name"/>
1003 </xsl:call-template>
1004 <xsl:text>_TO (base::)&#x0A;</xsl:text>
1005 <!-- -->
1006 <xsl:if test="not(@readonly='yes')">
1007 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO(smth) -->
1008 <xsl:text>#define COM_FORWARD_</xsl:text>
1009 <xsl:value-of select="$parent/@name"/>
1010 <xsl:text>_SETTER_</xsl:text>
1011 <xsl:call-template name="capitalize">
1012 <xsl:with-param name="str" select="@name"/>
1013 </xsl:call-template>
1014 <xsl:text>_TO(smth) NS_IMETHOD Set</xsl:text>
1015 <xsl:call-template name="capitalize">
1016 <xsl:with-param name="str" select="@name"/>
1017 </xsl:call-template>
1018 <xsl:text> (</xsl:text>
1019 <xsl:if test="@safearray='yes'">
1020 <xsl:text>PRUint32 a</xsl:text>
1021 <xsl:call-template name="capitalize">
1022 <xsl:with-param name="str" select="@name"/>
1023 </xsl:call-template>
1024 <xsl:text>Size, </xsl:text>
1025 </xsl:if>
1026 <xsl:if test="not(@safearray='yes') and (@type='string' or @type='wstring')">
1027 <xsl:text>const </xsl:text>
1028 </xsl:if>
1029 <xsl:apply-templates select="@type" mode="forwarder"/>
1030 <xsl:if test="@safearray='yes'">
1031 <xsl:text> *</xsl:text>
1032 </xsl:if>
1033 <xsl:text> a</xsl:text>
1034 <xsl:call-template name="capitalize">
1035 <xsl:with-param name="str" select="@name"/>
1036 </xsl:call-template>
1037 <xsl:text>) { return smth Set</xsl:text>
1038 <xsl:call-template name="capitalize">
1039 <xsl:with-param name="str" select="@name"/>
1040 </xsl:call-template>
1041 <xsl:text> (a</xsl:text>
1042 <xsl:call-template name="capitalize">
1043 <xsl:with-param name="str" select="@name"/>
1044 </xsl:call-template>
1045 <xsl:text>); }&#x0A;</xsl:text>
1046 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_OBJ(obj) -->
1047 <xsl:text>#define COM_FORWARD_</xsl:text>
1048 <xsl:value-of select="$parent/@name"/>
1049 <xsl:text>_SETTER_</xsl:text>
1050 <xsl:call-template name="capitalize">
1051 <xsl:with-param name="str" select="@name"/>
1052 </xsl:call-template>
1053 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
1054 <xsl:value-of select="$parent/@name"/>
1055 <xsl:text>_SETTER_</xsl:text>
1056 <xsl:call-template name="capitalize">
1057 <xsl:with-param name="str" select="@name"/>
1058 </xsl:call-template>
1059 <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
1060 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_BASE(base) -->
1061 <xsl:text>#define COM_FORWARD_</xsl:text>
1062 <xsl:value-of select="$parent/@name"/>
1063 <xsl:text>_SETTER_</xsl:text>
1064 <xsl:call-template name="capitalize">
1065 <xsl:with-param name="str" select="@name"/>
1066 </xsl:call-template>
1067 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
1068 <xsl:value-of select="$parent/@name"/>
1069 <xsl:text>_SETTER_</xsl:text>
1070 <xsl:call-template name="capitalize">
1071 <xsl:with-param name="str" select="@name"/>
1072 </xsl:call-template>
1073 <xsl:text>_TO (base::)&#x0A;</xsl:text>
1074 </xsl:if>
1075
1076 <xsl:apply-templates select="@if" mode="end"/>
1077
1078</xsl:template>
1079
1080
1081<!--
1082 * methods
1083-->
1084<xsl:template match="interface//method | collection//method">
1085 <xsl:apply-templates select="@if" mode="begin"/>
1086 <xsl:if test="param/@mod='ptr'">
1087 <!-- methods using native types must be non-scriptable
1088 <xsl:text> [noscript]&#x0A;</xsl:text>-->
1089 </xsl:if>
1090 <xsl:text> nsresult (*</xsl:text>
1091 <xsl:call-template name="capitalize">
1092 <xsl:with-param name="str" select="@name"/>
1093 </xsl:call-template>
1094 <xsl:if test="param">
1095 <xsl:text>)(&#x0A;</xsl:text>
1096 <xsl:text> </xsl:text>
1097 <xsl:value-of select="../@name" />
1098 <xsl:text> *this_,&#x0A;</xsl:text>
1099 <xsl:for-each select="param [position() != last()]">
1100 <xsl:text> </xsl:text>
1101 <xsl:apply-templates select="."/>
1102 <xsl:text>,&#x0A;</xsl:text>
1103 </xsl:for-each>
1104 <xsl:text> </xsl:text>
1105 <xsl:apply-templates select="param [last()]"/>
1106 <xsl:text>&#x0A; );&#x0A;</xsl:text>
1107 </xsl:if>
1108 <xsl:if test="not(param)">
1109 <xsl:text>)(</xsl:text>
1110 <xsl:value-of select="../@name" />
1111 <xsl:text> *this_ );&#x0A;</xsl:text>
1112 </xsl:if>
1113 <xsl:apply-templates select="@if" mode="end"/>
1114 <xsl:text>&#x0A;</xsl:text>
1115</xsl:template>
1116
1117<xsl:template match="interface//method | collection//method" mode="forwarder">
1118
1119 <xsl:variable name="parent" select="ancestor::interface | ancestor::collection"/>
1120
1121 <xsl:apply-templates select="@if" mode="begin"/>
1122
1123 <xsl:text>#define COM_FORWARD_</xsl:text>
1124 <xsl:value-of select="$parent/@name"/>
1125 <xsl:text>_</xsl:text>
1126 <xsl:call-template name="capitalize">
1127 <xsl:with-param name="str" select="@name"/>
1128 </xsl:call-template>
1129 <xsl:text>_TO(smth) NS_IMETHOD </xsl:text>
1130 <xsl:call-template name="capitalize">
1131 <xsl:with-param name="str" select="@name"/>
1132 </xsl:call-template>
1133 <xsl:choose>
1134 <xsl:when test="param">
1135 <xsl:text> (</xsl:text>
1136 <xsl:for-each select="param [position() != last()]">
1137 <xsl:apply-templates select="." mode="forwarder"/>
1138 <xsl:text>, </xsl:text>
1139 </xsl:for-each>
1140 <xsl:apply-templates select="param [last()]" mode="forwarder"/>
1141 <xsl:text>) { return smth </xsl:text>
1142 <xsl:call-template name="capitalize">
1143 <xsl:with-param name="str" select="@name"/>
1144 </xsl:call-template>
1145 <xsl:text> (</xsl:text>
1146 <xsl:for-each select="param [position() != last()]">
1147 <xsl:if test="@safearray='yes'">
1148 <xsl:text>a</xsl:text>
1149 <xsl:call-template name="capitalize">
1150 <xsl:with-param name="str" select="@name"/>
1151 </xsl:call-template>
1152 <xsl:text>Size+++, </xsl:text>
1153 </xsl:if>
1154 <xsl:text>a</xsl:text>
1155 <xsl:call-template name="capitalize">
1156 <xsl:with-param name="str" select="@name"/>
1157 </xsl:call-template>
1158 <xsl:text>, </xsl:text>
1159 </xsl:for-each>
1160 <xsl:if test="param [last()]/@safearray='yes'">
1161 <xsl:text>a</xsl:text>
1162 <xsl:call-template name="capitalize">
1163 <xsl:with-param name="str" select="param [last()]/@name"/>
1164 </xsl:call-template>
1165 <xsl:text>Size, </xsl:text>
1166 </xsl:if>
1167 <xsl:text>a</xsl:text>
1168 <xsl:call-template name="capitalize">
1169 <xsl:with-param name="str" select="param [last()]/@name"/>
1170 </xsl:call-template>
1171 <xsl:text>); }</xsl:text>
1172 </xsl:when>
1173 <xsl:otherwise test="not(param)">
1174 <xsl:text>() { return smth </xsl:text>
1175 <xsl:call-template name="capitalize">
1176 <xsl:with-param name="str" select="@name"/>
1177 </xsl:call-template>
1178 <xsl:text>(); }</xsl:text>
1179 </xsl:otherwise>
1180 </xsl:choose>
1181 <xsl:text>&#x0A;</xsl:text>
1182 <!-- COM_FORWARD_Interface_Method_TO_OBJ(obj) -->
1183 <xsl:text>#define COM_FORWARD_</xsl:text>
1184 <xsl:value-of select="$parent/@name"/>
1185 <xsl:text>_</xsl:text>
1186 <xsl:call-template name="capitalize">
1187 <xsl:with-param name="str" select="@name"/>
1188 </xsl:call-template>
1189 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
1190 <xsl:value-of select="$parent/@name"/>
1191 <xsl:text>_</xsl:text>
1192 <xsl:call-template name="capitalize">
1193 <xsl:with-param name="str" select="@name"/>
1194 </xsl:call-template>
1195 <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
1196 <!-- COM_FORWARD_Interface_Method_TO_BASE(base) -->
1197 <xsl:text>#define COM_FORWARD_</xsl:text>
1198 <xsl:value-of select="$parent/@name"/>
1199 <xsl:text>_</xsl:text>
1200 <xsl:call-template name="capitalize">
1201 <xsl:with-param name="str" select="@name"/>
1202 </xsl:call-template>
1203 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
1204 <xsl:value-of select="$parent/@name"/>
1205 <xsl:text>_</xsl:text>
1206 <xsl:call-template name="capitalize">
1207 <xsl:with-param name="str" select="@name"/>
1208 </xsl:call-template>
1209 <xsl:text>_TO (base::)&#x0A;</xsl:text>
1210
1211 <xsl:apply-templates select="@if" mode="end"/>
1212
1213</xsl:template>
1214
1215
1216<!--
1217 * modules
1218-->
1219<xsl:template match="module">
1220 <xsl:apply-templates select="class"/>
1221</xsl:template>
1222
1223
1224<!--
1225 * co-classes
1226-->
1227<xsl:template match="module/class">
1228 <!-- class and contract id -->
1229 <xsl:text>&#x0A;</xsl:text>
1230 <xsl:text>#define NS_</xsl:text>
1231 <xsl:call-template name="uppercase">
1232 <xsl:with-param name="str" select="@name"/>
1233 </xsl:call-template>
1234 <xsl:text>_CID { \&#x0A;</xsl:text>
1235 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
1236 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
1237 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
1238 <xsl:text>, \&#x0A; </xsl:text>
1239 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
1240 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
1241 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
1242 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
1243 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
1244 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
1245 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
1246 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
1247 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
1248 <xsl:text>#define NS_</xsl:text>
1249 <xsl:call-template name="uppercase">
1250 <xsl:with-param name="str" select="@name"/>
1251 </xsl:call-template>
1252 <!-- Contract ID -->
1253 <xsl:text>_CONTRACTID &quot;@</xsl:text>
1254 <xsl:value-of select="@namespace"/>
1255 <xsl:text>/</xsl:text>
1256 <xsl:value-of select="@name"/>
1257 <xsl:text>;1&quot;&#x0A;</xsl:text>
1258 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32 -->
1259 <xsl:text>/* for compatibility with Win32 */&#x0A;</xsl:text>
1260 <xsl:text>#define CLSID_</xsl:text>
1261 <xsl:value-of select="@name"/>
1262 <xsl:text> (nsCID) NS_</xsl:text>
1263 <xsl:call-template name="uppercase">
1264 <xsl:with-param name="str" select="@name"/>
1265 </xsl:call-template>
1266 <xsl:text>_CID&#x0A;</xsl:text>
1267 <xsl:text>&#x0A;&#x0A;</xsl:text>
1268</xsl:template>
1269
1270
1271<!--
1272 * enumerators
1273-->
1274<xsl:template match="enumerator">
1275 <xsl:text>/* Start of struct </xsl:text>
1276 <xsl:value-of select="@name"/>
1277 <xsl:text> Declaration */&#x0A;</xsl:text>
1278 <xsl:text>#define </xsl:text>
1279 <xsl:call-template name="uppercase">
1280 <xsl:with-param name="str" select="@name"/>
1281 </xsl:call-template>
1282 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
1283 <xsl:text>&#x0A;</xsl:text>
1284 <xsl:text>#define </xsl:text>
1285 <xsl:call-template name="uppercase">
1286 <xsl:with-param name="str" select="@name"/>
1287 </xsl:call-template>
1288 <xsl:text>_IID { \&#x0A;</xsl:text>
1289 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
1290 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
1291 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
1292 <xsl:text>, \&#x0A; </xsl:text>
1293 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
1294 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
1295 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
1296 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
1297 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
1298 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
1299 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
1300 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
1301 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
1302 <xsl:text>struct </xsl:text>
1303 <xsl:value-of select="@name"/>
1304 <xsl:text>_vtbl&#x0A;{&#x0A;</xsl:text>
1305 <xsl:text> struct nsISupports_vtbl nsisupports;&#x0A;&#x0A;</xsl:text>
1306 <!-- attributes (properties) -->
1307 <xsl:text> nsresult (*HasMore)(</xsl:text>
1308 <xsl:value-of select="@name" />
1309 <xsl:text> *this_, PRBool *more);&#x0A;&#x0A;</xsl:text>
1310 <!-- GetNext -->
1311 <xsl:text> nsresult (*GetNext)(</xsl:text>
1312 <xsl:value-of select="@name" />
1313 <xsl:text> *this_, </xsl:text>
1314 <xsl:apply-templates select="@type" mode="forwarder"/>
1315 <xsl:text> *next);&#x0A;&#x0A;</xsl:text>
1316 <xsl:text>};</xsl:text>
1317 <xsl:text>&#x0A;&#x0A;</xsl:text>
1318 <xsl:text>struct </xsl:text>
1319 <xsl:value-of select="@name"/>
1320 <xsl:text>&#x0A;{&#x0A; struct </xsl:text>
1321 <xsl:value-of select="@name"/>
1322 <xsl:text>_vtbl *vtbl;&#x0A;};&#x0A;</xsl:text>
1323 <xsl:text>/* End of struct </xsl:text>
1324 <xsl:value-of select="@name"/>
1325 <xsl:text> Declaration */&#x0A;&#x0A;&#x0A;</xsl:text>
1326</xsl:template>
1327
1328
1329<!--
1330 * collections
1331-->
1332<xsl:template match="collection">
1333 <xsl:if test="not(@readonly='yes')">
1334 <xsl:message terminate="yes">
1335 <xsl:value-of select="concat(@name,': ')"/>
1336 <xsl:text>non-readonly collections are not currently supported</xsl:text>
1337 </xsl:message>
1338 </xsl:if>
1339 <xsl:text>/* Start of struct </xsl:text>
1340 <xsl:value-of select="@name"/>
1341 <xsl:text> Declaration */&#x0A;</xsl:text>
1342 <xsl:text>#define </xsl:text>
1343 <xsl:call-template name="uppercase">
1344 <xsl:with-param name="str" select="@name"/>
1345 </xsl:call-template>
1346 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
1347 <xsl:text>&#x0A;</xsl:text>
1348 <xsl:text>#define </xsl:text>
1349 <xsl:call-template name="uppercase">
1350 <xsl:with-param name="str" select="@name"/>
1351 </xsl:call-template>
1352 <xsl:text>_IID { \&#x0A;</xsl:text>
1353 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
1354 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
1355 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
1356 <xsl:text>, \&#x0A; </xsl:text>
1357 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
1358 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
1359 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
1360 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
1361 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
1362 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
1363 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
1364 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
1365 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
1366 <xsl:text>struct </xsl:text>
1367 <xsl:value-of select="@name"/>
1368 <xsl:text>_vtbl&#x0A;{&#x0A;</xsl:text>
1369 <xsl:text> struct nsISupports_vtbl nsisupports;&#x0A;&#x0A;</xsl:text>
1370 <!-- Count -->
1371 <xsl:text> nsresult (*GetCount)(</xsl:text>
1372 <xsl:value-of select="@name" />
1373 <xsl:text> *this_, PRUint32 *aCount);&#x0A;&#x0A;</xsl:text>
1374 <!-- GetItemAt -->
1375 <xsl:text> nsresult (*GetItemAt)(</xsl:text>
1376 <xsl:value-of select="@name" />
1377 <xsl:text> *this_, PRUint32 index, </xsl:text>
1378 <xsl:apply-templates select="@type" mode="forwarder"/>
1379 <xsl:text> **item);&#x0A;&#x0A;</xsl:text>
1380 <!-- Enumerate -->
1381 <xsl:text> nsresult (*Enumerate)(</xsl:text>
1382 <xsl:value-of select="@name" />
1383 <xsl:text> *this_, </xsl:text>
1384 <xsl:apply-templates select="@enumerator"/>
1385 <xsl:text> **enumerator);&#x0A;&#x0A;</xsl:text>
1386 <!-- other extra attributes (properties) -->
1387 <xsl:apply-templates select="attribute"/>
1388 <!-- other extra methods -->
1389 <xsl:apply-templates select="method"/>
1390 <!-- 'if' enclosed elements, unsorted -->
1391 <xsl:apply-templates select="if"/>
1392 <xsl:text>};</xsl:text>
1393 <xsl:text>&#x0A;&#x0A;</xsl:text>
1394 <xsl:text>struct </xsl:text>
1395 <xsl:value-of select="@name"/>
1396 <xsl:text>&#x0A;{&#x0A; struct </xsl:text>
1397 <xsl:value-of select="@name"/>
1398 <xsl:text>_vtbl *vtbl;&#x0A;};&#x0A;</xsl:text>
1399 <xsl:text>/* End of struct </xsl:text>
1400 <xsl:value-of select="@name"/>
1401 <xsl:text> Declaration */&#x0A;&#x0A;&#x0A;</xsl:text>
1402</xsl:template>
1403
1404
1405<!--
1406 * enums
1407-->
1408<xsl:template match="enum">
1409 <xsl:text>/* Start of enum </xsl:text>
1410 <xsl:value-of select="@name"/>
1411 <xsl:text> Declaration */&#x0A;</xsl:text>
1412 <xsl:text>#define </xsl:text>
1413 <xsl:call-template name="uppercase">
1414 <xsl:with-param name="str" select="@name"/>
1415 </xsl:call-template>
1416 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
1417 <xsl:text>&#x0A;</xsl:text>
1418 <xsl:text>#define </xsl:text>
1419 <xsl:call-template name="uppercase">
1420 <xsl:with-param name="str" select="@name"/>
1421 </xsl:call-template>
1422 <xsl:text>_IID { \&#x0A;</xsl:text>
1423 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
1424 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
1425 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
1426 <xsl:text>, \&#x0A; </xsl:text>
1427 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
1428 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
1429 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
1430 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
1431 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
1432 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
1433 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
1434 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
1435 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
1436 <xsl:text>enum </xsl:text>
1437 <xsl:value-of select="@name"/>
1438 <xsl:text>&#x0A;{&#x0A;</xsl:text>
1439 <xsl:variable name="this" select="."/>
1440 <xsl:for-each select="const">
1441 <xsl:text> </xsl:text>
1442 <xsl:value-of select="$this/@name"/>
1443 <xsl:text>_</xsl:text>
1444 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
1445 <xsl:if test="position() != last()">
1446 <xsl:text>,</xsl:text>
1447 </xsl:if>
1448 <xsl:text>&#x0A;</xsl:text>
1449 </xsl:for-each>
1450 <xsl:text>};&#x0A;</xsl:text>
1451 <xsl:text>/* End of enum </xsl:text>
1452 <xsl:value-of select="@name"/>
1453 <xsl:text> Declaration */&#x0A;&#x0A;&#x0A;</xsl:text>
1454</xsl:template>
1455
1456
1457<!--
1458 * method parameters
1459-->
1460<xsl:template match="method/param">
1461 <xsl:choose>
1462 <!-- safearray parameters -->
1463 <xsl:when test="@safearray='yes'">
1464 <!-- array size -->
1465 <xsl:choose>
1466 <xsl:when test="@dir='in'">
1467 <xsl:text>PRUint32 </xsl:text>
1468 <xsl:value-of select="@name"/>
1469 <xsl:text>Size,&#x0A;</xsl:text>
1470 </xsl:when>
1471 <xsl:when test="@dir='out'">
1472 <xsl:text>PRUint32 *</xsl:text>
1473 <xsl:value-of select="@name"/>
1474 <xsl:text>Size,&#x0A;</xsl:text>
1475 </xsl:when>
1476 <xsl:when test="@dir='return'">
1477 <xsl:text>PRUint32 *</xsl:text>
1478 <xsl:value-of select="@name"/>
1479 <xsl:text>Size,&#x0A;</xsl:text>
1480 </xsl:when>
1481 <xsl:otherwise>
1482 <xsl:text>PRUint32 </xsl:text>
1483 <xsl:value-of select="@name"/>
1484 <xsl:text>Size,&#x0A;</xsl:text>
1485 </xsl:otherwise>
1486 </xsl:choose>
1487 <!-- array pointer -->
1488 <xsl:text> </xsl:text>
1489 <xsl:choose>
1490 <xsl:when test="@dir='in'">
1491 <xsl:apply-templates select="@type" mode="forwarder"/>
1492 <xsl:text>*</xsl:text>
1493 </xsl:when>
1494 <xsl:when test="@dir='out'">
1495 <xsl:apply-templates select="@type" mode="forwarder"/>
1496 <xsl:if test="@type='wstring'">
1497 <xsl:text>*</xsl:text>
1498 </xsl:if>
1499 <xsl:text>*</xsl:text>
1500 </xsl:when>
1501 <xsl:when test="@dir='return'">
1502 <xsl:apply-templates select="@type" mode="forwarder"/>
1503 <xsl:text>**</xsl:text>
1504 </xsl:when>
1505 <xsl:otherwise>
1506 <xsl:apply-templates select="@type" mode="forwarder"/>
1507 <xsl:text>*</xsl:text>
1508 </xsl:otherwise>
1509 </xsl:choose>
1510 <xsl:text> </xsl:text>
1511 <xsl:value-of select="@name"/>
1512 </xsl:when>
1513 <!-- normal and array parameters -->
1514 <xsl:otherwise>
1515 <xsl:if test="@array">
1516 <xsl:if test="@dir='return'">
1517 <xsl:message terminate="yes">
1518 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
1519 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text>
1520 </xsl:message>
1521 </xsl:if>
1522 <xsl:text>[array, </xsl:text>
1523 <xsl:choose>
1524 <xsl:when test="../param[@name=current()/@array]">
1525 <xsl:if test="../param[@name=current()/@array]/@dir != @dir">
1526 <xsl:message terminate="yes">
1527 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
1528 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/>
1529 <xsl:text> must have the same direction</xsl:text>
1530 </xsl:message>
1531 </xsl:if>
1532 <xsl:text>size_is(</xsl:text>
1533 <xsl:value-of select="@array"/>
1534 <xsl:text>)</xsl:text>
1535 </xsl:when>
1536 <xsl:otherwise>
1537 <xsl:message terminate="yes">
1538 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
1539 <xsl:text>array attribute refers to non-existent param: </xsl:text>
1540 <xsl:value-of select="@array"/>
1541 </xsl:message>
1542 </xsl:otherwise>
1543 </xsl:choose>
1544 <xsl:text>] </xsl:text>
1545 </xsl:if>
1546 <xsl:choose>
1547 <xsl:when test="@dir='in'">
1548 <xsl:apply-templates select="@type" mode="forwarder"/>
1549 <xsl:text></xsl:text>
1550 </xsl:when>
1551 <xsl:when test="@dir='out'">
1552 <xsl:apply-templates select="@type" mode="forwarder"/>
1553 <xsl:text> *</xsl:text>
1554 </xsl:when>
1555 <xsl:when test="@dir='return'">
1556 <xsl:apply-templates select="@type" mode="forwarder"/>
1557 <xsl:text> *</xsl:text>
1558 </xsl:when>
1559 <xsl:otherwise>
1560 <xsl:apply-templates select="@type" mode="forwarder"/>
1561 <xsl:text></xsl:text>
1562 </xsl:otherwise>
1563 </xsl:choose>
1564 <xsl:text> </xsl:text>
1565 <xsl:value-of select="@name"/>
1566 </xsl:otherwise>
1567 </xsl:choose>
1568</xsl:template>
1569
1570<xsl:template match="method/param" mode="forwarder">
1571 <xsl:if test="@safearray='yes'">
1572 <xsl:text>PRUint32</xsl:text>
1573 <xsl:if test="@dir='out' or @dir='return'">
1574 <xsl:text> *</xsl:text>
1575 </xsl:if>
1576 <xsl:text> a</xsl:text>
1577 <xsl:call-template name="capitalize">
1578 <xsl:with-param name="str" select="@name"/>
1579 </xsl:call-template>
1580 <xsl:text>Size, </xsl:text>
1581 </xsl:if>
1582 <xsl:apply-templates select="@type" mode="forwarder"/>
1583 <xsl:if test="@dir='out' or @dir='return'">
1584 <xsl:text> *</xsl:text>
1585 </xsl:if>
1586 <xsl:if test="@safearray='yes'">
1587 <xsl:text> *</xsl:text>
1588 </xsl:if>
1589 <xsl:text> a</xsl:text>
1590 <xsl:call-template name="capitalize">
1591 <xsl:with-param name="str" select="@name"/>
1592 </xsl:call-template>
1593</xsl:template>
1594
1595
1596<!--
1597 * attribute/parameter type conversion
1598-->
1599<xsl:template match="
1600 attribute/@type | param/@type |
1601 enumerator/@type | collection/@type | collection/@enumerator
1602">
1603 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
1604
1605 <xsl:if test="../@array and ../@safearray='yes'">
1606 <xsl:message terminate="yes">
1607 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
1608 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
1609 </xsl:message>
1610 </xsl:if>
1611
1612 <xsl:choose>
1613 <!-- modifiers (ignored for 'enumeration' attributes)-->
1614 <xsl:when test="name(current())='type' and ../@mod">
1615 <xsl:choose>
1616 <xsl:when test="../@mod='ptr'">
1617 <xsl:choose>
1618 <!-- standard types -->
1619 <!--xsl:when test=".='result'">??</xsl:when-->
1620 <xsl:when test=".='boolean'">booleanPtr</xsl:when>
1621 <xsl:when test=".='octet'">octetPtr</xsl:when>
1622 <xsl:when test=".='short'">shortPtr</xsl:when>
1623 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
1624 <xsl:when test=".='long'">longPtr</xsl:when>
1625 <xsl:when test=".='long long'">llongPtr</xsl:when>
1626 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
1627 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
1628 <xsl:when test=".='char'">charPtr</xsl:when>
1629 <!--xsl:when test=".='string'">??</xsl:when-->
1630 <xsl:when test=".='wchar'">wcharPtr</xsl:when>
1631 <!--xsl:when test=".='wstring'">??</xsl:when-->
1632 <xsl:otherwise>
1633 <xsl:message terminate="yes">
1634 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
1635 <xsl:text>attribute 'mod=</xsl:text>
1636 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
1637 <xsl:text>' cannot be used with type </xsl:text>
1638 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
1639 </xsl:message>
1640 </xsl:otherwise>
1641 </xsl:choose>
1642 </xsl:when>
1643 <xsl:otherwise>
1644 <xsl:message terminate="yes">
1645 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
1646 <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
1647 <xsl:text>of attribute 'mod' is invalid!</xsl:text>
1648 </xsl:message>
1649 </xsl:otherwise>
1650 </xsl:choose>
1651 </xsl:when>
1652 <!-- no modifiers -->
1653 <xsl:otherwise>
1654 <xsl:choose>
1655 <!-- standard types -->
1656 <xsl:when test=".='result'">nsresult</xsl:when>
1657 <xsl:when test=".='boolean'">boolean</xsl:when>
1658 <xsl:when test=".='octet'">octet</xsl:when>
1659 <xsl:when test=".='short'">short</xsl:when>
1660 <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
1661 <xsl:when test=".='long'">long</xsl:when>
1662 <xsl:when test=".='long long'">long long</xsl:when>
1663 <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
1664 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
1665 <xsl:when test=".='char'">char</xsl:when>
1666 <xsl:when test=".='wchar'">wchar</xsl:when>
1667 <xsl:when test=".='string'">string</xsl:when>
1668 <xsl:when test=".='wstring'">wstring</xsl:when>
1669 <!-- UUID type -->
1670 <xsl:when test=".='uuid'">
1671 <xsl:choose>
1672 <xsl:when test="name(..)='attribute'">
1673 <xsl:choose>
1674 <xsl:when test="../@readonly='yes'">
1675 <xsl:text>nsIDPtr</xsl:text>
1676 </xsl:when>
1677 <xsl:otherwise>
1678 <xsl:message terminate="yes">
1679 <xsl:value-of select="../@name"/>
1680 <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
1681 </xsl:message>
1682 </xsl:otherwise>
1683 </xsl:choose>
1684 </xsl:when>
1685 <xsl:when test="name(..)='param'">
1686 <xsl:choose>
1687 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
1688 <xsl:text>nsIDRef</xsl:text>
1689 </xsl:when>
1690 <xsl:otherwise>
1691 <xsl:text>nsIDPtr</xsl:text>
1692 </xsl:otherwise>
1693 </xsl:choose>
1694 </xsl:when>
1695 </xsl:choose>
1696 </xsl:when>
1697 <!-- system interface types -->
1698 <xsl:when test=".='$unknown'">nsISupports</xsl:when>
1699 <xsl:otherwise>
1700 <xsl:choose>
1701 <!-- enum types -->
1702 <xsl:when test="
1703 (ancestor::library/enum[@name=current()]) or
1704 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
1705 ">
1706 <xsl:text>PRUint32</xsl:text>
1707 </xsl:when>
1708 <!-- custom interface types -->
1709 <xsl:when test="
1710 (name(current())='enumerator' and
1711 ((ancestor::library/enumerator[@name=current()]) or
1712 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
1713 ) or
1714 ((ancestor::library/interface[@name=current()]) or
1715 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
1716 ) or
1717 ((ancestor::library/collection[@name=current()]) or
1718 (ancestor::library/if[@target=$self_target]/collection[@name=current()])
1719 )
1720 ">
1721 <xsl:value-of select="."/>
1722 </xsl:when>
1723 <!-- other types -->
1724 <xsl:otherwise>
1725 <xsl:message terminate="yes">
1726 <xsl:text>Unknown parameter type: </xsl:text>
1727 <xsl:value-of select="."/>
1728 </xsl:message>
1729 </xsl:otherwise>
1730 </xsl:choose>
1731 </xsl:otherwise>
1732 </xsl:choose>
1733 </xsl:otherwise>
1734 </xsl:choose>
1735</xsl:template>
1736
1737<xsl:template match="
1738 attribute/@type | param/@type |
1739 enumerator/@type | collection/@type | collection/@enumerator
1740" mode="forwarder">
1741
1742 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
1743
1744 <xsl:choose>
1745 <!-- modifiers (ignored for 'enumeration' attributes)-->
1746 <xsl:when test="name(current())='type' and ../@mod">
1747 <xsl:choose>
1748 <xsl:when test="../@mod='ptr'">
1749 <xsl:choose>
1750 <!-- standard types -->
1751 <!--xsl:when test=".='result'">??</xsl:when-->
1752 <xsl:when test=".='boolean'">PRBool *</xsl:when>
1753 <xsl:when test=".='octet'">PRUint8 *</xsl:when>
1754 <xsl:when test=".='short'">PRInt16 *</xsl:when>
1755 <xsl:when test=".='unsigned short'">PRUint16 *</xsl:when>
1756 <xsl:when test=".='long'">PRInt32 *</xsl:when>
1757 <xsl:when test=".='long long'">PRInt64 *</xsl:when>
1758 <xsl:when test=".='unsigned long'">PRUint32 *</xsl:when>
1759 <xsl:when test=".='unsigned long long'">PRUint64 *</xsl:when>
1760 <xsl:when test=".='char'">char *</xsl:when>
1761 <!--xsl:when test=".='string'">??</xsl:when-->
1762 <xsl:when test=".='wchar'">PRUnichar *</xsl:when>
1763 <!--xsl:when test=".='wstring'">??</xsl:when-->
1764 </xsl:choose>
1765 </xsl:when>
1766 </xsl:choose>
1767 </xsl:when>
1768 <!-- no modifiers -->
1769 <xsl:otherwise>
1770 <xsl:choose>
1771 <!-- standard types -->
1772 <xsl:when test=".='result'">nsresult</xsl:when>
1773 <xsl:when test=".='boolean'">PRBool</xsl:when>
1774 <xsl:when test=".='octet'">PRUint8</xsl:when>
1775 <xsl:when test=".='short'">PRInt16</xsl:when>
1776 <xsl:when test=".='unsigned short'">PRUint16</xsl:when>
1777 <xsl:when test=".='long'">PRInt32</xsl:when>
1778 <xsl:when test=".='long long'">PRInt64</xsl:when>
1779 <xsl:when test=".='unsigned long'">PRUint32</xsl:when>
1780 <xsl:when test=".='unsigned long long'">PRUint64</xsl:when>
1781 <xsl:when test=".='char'">char</xsl:when>
1782 <xsl:when test=".='wchar'">PRUnichar</xsl:when>
1783 <!-- string types -->
1784 <xsl:when test=".='string'">char *</xsl:when>
1785 <xsl:when test=".='wstring'">PRUnichar *</xsl:when>
1786 <!-- UUID type -->
1787 <xsl:when test=".='uuid'">
1788 <xsl:choose>
1789 <xsl:when test="name(..)='attribute'">
1790 <xsl:choose>
1791 <xsl:when test="../@readonly='yes'">
1792 <xsl:text>nsID *</xsl:text>
1793 </xsl:when>
1794 </xsl:choose>
1795 </xsl:when>
1796 <xsl:when test="name(..)='param'">
1797 <xsl:choose>
1798 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
1799 <xsl:text>const nsID *</xsl:text>
1800 </xsl:when>
1801 <xsl:otherwise>
1802 <xsl:text>nsID *</xsl:text>
1803 </xsl:otherwise>
1804 </xsl:choose>
1805 </xsl:when>
1806 </xsl:choose>
1807 </xsl:when>
1808 <!-- system interface types -->
1809 <xsl:when test=".='$unknown'">nsISupports *</xsl:when>
1810 <xsl:otherwise>
1811 <xsl:choose>
1812 <!-- enum types -->
1813 <xsl:when test="
1814 (ancestor::library/enum[@name=current()]) or
1815 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
1816 ">
1817 <xsl:text>PRUint32</xsl:text>
1818 </xsl:when>
1819 <!-- custom interface types -->
1820 <xsl:when test="
1821 (name(current())='enumerator' and
1822 ((ancestor::library/enumerator[@name=current()]) or
1823 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
1824 ) or
1825 ((ancestor::library/interface[@name=current()]) or
1826 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
1827 ) or
1828 ((ancestor::library/collection[@name=current()]) or
1829 (ancestor::library/if[@target=$self_target]/collection[@name=current()])
1830 )
1831 ">
1832 <xsl:value-of select="."/>
1833 <xsl:text> *</xsl:text>
1834 </xsl:when>
1835 <!-- other types -->
1836 </xsl:choose>
1837 </xsl:otherwise>
1838 </xsl:choose>
1839 </xsl:otherwise>
1840 </xsl:choose>
1841</xsl:template>
1842
1843</xsl:stylesheet>
1844
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