VirtualBox

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

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

Cbinding: updated licence info.

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