VirtualBox

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

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

VBoxCGlueTerm and VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME fixes.

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