VirtualBox

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

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

Cbinding: updated licence info.

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