VirtualBox

source: vbox/trunk/src/VBox/Main/cbinding/capiidl.xsl@ 50187

Last change on this file since 50187 was 50187, checked in by vboxsync, 11 years ago

Main/cbinding: fix a few windows build glitches

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 100.2 KB
Line 
1<?xml version="1.0"?>
2<!-- $Id: capiidl.xsl 50187 2014-01-23 16:37:53Z vboxsync $ -->
3
4<!--
5 * A template to generate a C header file for all relevant XPCOM interfaces
6 * provided or needed for calling the VirtualBox API. The header file also
7 * works on Windows, by using the C bindings header created by the MS COM IDL
8 * compiler (which simultaneously supports C and C++, unlike XPCOM).
9
10 Copyright (C) 2008-2014 Oracle Corporation
11
12 This file is part of VirtualBox Open Source Edition (OSE), as
13 available from http://www.virtualbox.org. This file is free software;
14 you can redistribute it and/or modify it under the terms of the GNU
15 General Public License (GPL) as published by the Free Software
16 Foundation, in version 2 as it comes in the "COPYING" file of the
17 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19-->
20
21<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
22<xsl:output method="text"/>
23
24<xsl:strip-space elements="*"/>
25
26
27<!--
28// helper definitions
29/////////////////////////////////////////////////////////////////////////////
30-->
31
32<!--
33 * capitalizes the first letter
34-->
35<xsl:template name="capitalize">
36 <xsl:param name="str" select="."/>
37 <xsl:value-of select="
38 concat(
39 translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
40 substring($str,2)
41 )
42 "/>
43</xsl:template>
44
45<!--
46 * uncapitalizes the first letter only if the second one is not capital
47 * otherwise leaves the string unchanged
48-->
49<xsl:template name="uncapitalize">
50 <xsl:param name="str" select="."/>
51 <xsl:choose>
52 <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
53 <xsl:value-of select="
54 concat(
55 translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
56 substring($str,2)
57 )
58 "/>
59 </xsl:when>
60 <xsl:otherwise>
61 <xsl:value-of select="string($str)"/>
62 </xsl:otherwise>
63 </xsl:choose>
64</xsl:template>
65
66<!--
67 * translates the string to uppercase
68-->
69<xsl:template name="uppercase">
70 <xsl:param name="str" select="."/>
71 <xsl:value-of select="
72 translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
73 "/>
74</xsl:template>
75
76
77<!--
78 * translates the string to lowercase
79-->
80<xsl:template name="lowercase">
81 <xsl:param name="str" select="."/>
82 <xsl:value-of select="
83 translate($str,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')
84 "/>
85</xsl:template>
86
87
88<!--
89// templates
90/////////////////////////////////////////////////////////////////////////////
91-->
92
93
94<!--
95 * not explicitly matched elements and attributes
96-->
97<xsl:template match="*"/>
98
99
100<!--
101 * header
102-->
103<xsl:template match="/idl">
104 <xsl:text>/*
105 * DO NOT EDIT! This is a generated file.
106 *
107 * Header file which provides C declarations for VirtualBox Main API
108 * (COM interfaces), generated from XIDL (XML interface definition).
109 * On Windows (which uses COM instead of XPCOM) the native C support
110 * is used, and most of this file is not used.
111 *
112 * Source : src/VBox/Main/idl/VirtualBox.xidl
113 * Generator : src/VBox/Main/cbinding/capiidl.xsl
114 *
115 * This file contains portions from the following Mozilla XPCOM files:
116 * xpcom/include/xpcom/nsID.h
117 * xpcom/include/nsIException.h
118 * xpcom/include/nsprpub/prtypes.h
119 * xpcom/include/xpcom/nsISupportsBase.h
120 *
121 * These files were originally triple-licensed (MPL/GPL2/LGPL2.1). Oracle
122 * elects to distribute this derived work under the LGPL2.1 only.
123 */
124
125/*
126 * Copyright (C) 2008-2014 Oracle Corporation
127 *
128 * This file is part of a free software library; you can redistribute
129 * it and/or modify it under the terms of the GNU Lesser General
130 * Public License version 2.1 as published by the Free Software
131 * Foundation and shipped in the "COPYING" file with this library.
132 * The library is distributed in the hope that it will be useful,
133 * but WITHOUT ANY WARRANTY of any kind.
134 *
135 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if
136 * any license choice other than GPL or LGPL is available it will
137 * apply instead, Oracle elects to use only the Lesser General Public
138 * License version 2.1 (LGPLv2) at this time for any software where
139 * a choice of LGPL license versions is made available with the
140 * language indicating that LGPLv2 or any later version may be used,
141 * or where a choice of which version of the LGPL is applied is
142 * otherwise unspecified.
143 */
144
145#ifndef ___VirtualBox_CAPI_h
146#define ___VirtualBox_CAPI_h
147
148#ifdef _WIN32
149# undef COBJMACROS
150# define COBJMACROS
151# include "Windows.h"
152#endif /* _WIN32 */
153
154#ifdef WIN32
155# ifdef IN_VBOXCAPI
156# define VBOXCAPI_DECL(type) extern __declspec(dllexport) type
157# else /* !IN_VBOXCAPI */
158# define VBOXCAPI_DECL(type) __declspec(dllimport) type
159# endif /* !IN_VBOXCAPI */
160#endif /* WIN32 */
161
162#ifdef __cplusplus
163/* The C++ treatment in this file is not meant for SDK users, it only exists
164 * so that this file can be used to produce the VBoxCAPI shared library which
165 * has to use C++ as it does all the conversion magic. */
166# ifdef IN_VBOXCAPI
167# include "VBox/com/VirtualBox.h"
168# ifndef WIN32
169# include "nsIEventQueue.h"
170# endif /* !WIN32 */
171# else /* !IN_VBOXCAPI */
172# error Do not include this header file from C++ code
173# endif /* !IN_VBOXCAPI */
174#endif /* __cplusplus */
175
176#ifdef __GNUC__
177# define VBOX_EXTERN_CONST(type, name) extern const type name __attribute__((nocommon))
178#else /* !__GNUC__ */
179# define VBOX_EXTERN_CONST(type, name) extern const type name
180#endif /* !__GNUC__ */
181
182/* Treat WIN32 completely separately, as on Windows VirtualBox uses COM, not
183 * XPCOM like on all other platforms. While the code below would also compile
184 * on Windows, we need to switch to the native C support provided by the header
185 * files produced by the COM IDL compiler. */
186#ifdef WIN32
187# include "ObjBase.h"
188# include "oaidl.h"
189# include "VirtualBox.h"
190
191#ifndef __cplusplus
192/* Skip this in the C++ case as there's already a definition for CBSTR. */
193typedef const BSTR CBSTR;
194#endif /* !__cplusplus */
195
196#define ComSafeArrayAsInParam(f) (f)
197#define ComSafeArrayAsOutParam(f) (&amp;(f))
198#define ComSafeArrayAsOutIfaceParam(f,t) (&amp;(f))
199
200#else /* !WIN32 */
201
202#include &lt;stddef.h&gt;
203#include "wchar.h"
204
205#ifdef IN_VBOXCAPI
206# define VBOXCAPI_DECL(type) PR_EXPORT(type)
207#else /* !IN_VBOXCAPI */
208# define VBOXCAPI_DECL(type) PR_IMPORT(type)
209#endif /* !IN_VBOXCAPI */
210
211#ifndef __cplusplus
212
213#if defined(WIN32)
214
215#define PR_EXPORT(__type) extern __declspec(dllexport) __type
216#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
217#define PR_IMPORT(__type) __declspec(dllimport) __type
218#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
219
220#define PR_EXTERN(__type) extern __declspec(dllexport) __type
221#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
222#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
223#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
224
225#define PR_CALLBACK
226#define PR_CALLBACK_DECL
227#define PR_STATIC_CALLBACK(__x) static __x
228
229#elif defined(XP_BEOS)
230
231#define PR_EXPORT(__type) extern __declspec(dllexport) __type
232#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
233#define PR_IMPORT(__type) extern __declspec(dllexport) __type
234#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
235
236#define PR_EXTERN(__type) extern __declspec(dllexport) __type
237#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
238#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
239#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
240
241#define PR_CALLBACK
242#define PR_CALLBACK_DECL
243#define PR_STATIC_CALLBACK(__x) static __x
244
245#elif defined(WIN16)
246
247#define PR_CALLBACK_DECL __cdecl
248
249#if defined(_WINDLL)
250#define PR_EXPORT(__type) extern __type _cdecl _export _loadds
251#define PR_IMPORT(__type) extern __type _cdecl _export _loadds
252#define PR_EXPORT_DATA(__type) extern __type _export
253#define PR_IMPORT_DATA(__type) extern __type _export
254
255#define PR_EXTERN(__type) extern __type _cdecl _export _loadds
256#define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
257#define PR_EXTERN_DATA(__type) extern __type _export
258#define PR_IMPLEMENT_DATA(__type) __type _export
259
260#define PR_CALLBACK __cdecl __loadds
261#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
262
263#else /* this must be .EXE */
264#define PR_EXPORT(__type) extern __type _cdecl _export
265#define PR_IMPORT(__type) extern __type _cdecl _export
266#define PR_EXPORT_DATA(__type) extern __type _export
267#define PR_IMPORT_DATA(__type) extern __type _export
268
269#define PR_EXTERN(__type) extern __type _cdecl _export
270#define PR_IMPLEMENT(__type) __type _cdecl _export
271#define PR_EXTERN_DATA(__type) extern __type _export
272#define PR_IMPLEMENT_DATA(__type) __type _export
273
274#define PR_CALLBACK __cdecl __loadds
275#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
276#endif /* _WINDLL */
277
278#elif defined(XP_MAC)
279
280#define PR_EXPORT(__type) extern __declspec(export) __type
281#define PR_EXPORT_DATA(__type) extern __declspec(export) __type
282#define PR_IMPORT(__type) extern __declspec(export) __type
283#define PR_IMPORT_DATA(__type) extern __declspec(export) __type
284
285#define PR_EXTERN(__type) extern __declspec(export) __type
286#define PR_IMPLEMENT(__type) __declspec(export) __type
287#define PR_EXTERN_DATA(__type) extern __declspec(export) __type
288#define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
289
290#define PR_CALLBACK
291#define PR_CALLBACK_DECL
292#define PR_STATIC_CALLBACK(__x) static __x
293
294#elif defined(XP_OS2) &amp;&amp; defined(__declspec)
295
296#define PR_EXPORT(__type) extern __declspec(dllexport) __type
297#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
298#define PR_IMPORT(__type) __declspec(dllimport) __type
299#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
300
301#define PR_EXTERN(__type) extern __declspec(dllexport) __type
302#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
303#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
304#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
305
306#define PR_CALLBACK
307#define PR_CALLBACK_DECL
308#define PR_STATIC_CALLBACK(__x) static __x
309
310#elif defined(XP_OS2_VACPP)
311
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
317#define PR_EXTERN(__type) extern __type
318#define PR_IMPLEMENT(__type) __type
319#define PR_EXTERN_DATA(__type) extern __type
320#define PR_IMPLEMENT_DATA(__type) __type
321#define PR_CALLBACK _Optlink
322#define PR_CALLBACK_DECL
323#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
324
325#else /* Unix */
326
327# ifdef VBOX_HAVE_VISIBILITY_HIDDEN
328# define PR_EXPORT(__type) __attribute__((visibility("default"))) extern __type
329# define PR_EXPORT_DATA(__type) __attribute__((visibility("default"))) extern __type
330# define PR_IMPORT(__type) extern __type
331# define PR_IMPORT_DATA(__type) extern __type
332# define PR_EXTERN(__type) __attribute__((visibility("default"))) extern __type
333# define PR_IMPLEMENT(__type) __attribute__((visibility("default"))) __type
334# define PR_EXTERN_DATA(__type) __attribute__((visibility("default"))) extern __type
335# define PR_IMPLEMENT_DATA(__type) __attribute__((visibility("default"))) __type
336# define PR_CALLBACK
337# define PR_CALLBACK_DECL
338# define PR_STATIC_CALLBACK(__x) static __x
339# else
340# define PR_EXPORT(__type) extern __type
341# define PR_EXPORT_DATA(__type) extern __type
342# define PR_IMPORT(__type) extern __type
343# define PR_IMPORT_DATA(__type) extern __type
344# define PR_EXTERN(__type) extern __type
345# define PR_IMPLEMENT(__type) __type
346# define PR_EXTERN_DATA(__type) extern __type
347# define PR_IMPLEMENT_DATA(__type) __type
348# define PR_CALLBACK
349# define PR_CALLBACK_DECL
350# define PR_STATIC_CALLBACK(__x) static __x
351# endif
352#endif
353
354#if defined(_NSPR_BUILD_)
355#define NSPR_API(__type) PR_EXPORT(__type)
356#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
357#else
358#define NSPR_API(__type) PR_IMPORT(__type)
359#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
360#endif
361
362typedef unsigned char PRUint8;
363#if (defined(HPUX) &amp;&amp; defined(__cplusplus) \
364 &amp;&amp; !defined(__GNUC__) &amp;&amp; __cplusplus &lt; 199707L) \
365 || (defined(SCO) &amp;&amp; defined(__cplusplus) \
366 &amp;&amp; !defined(__GNUC__) &amp;&amp; __cplusplus == 1L)
367typedef char PRInt8;
368#else
369typedef signed char PRInt8;
370#endif
371
372#define PR_INT8_MAX 127
373#define PR_INT8_MIN (-128)
374#define PR_UINT8_MAX 255U
375
376typedef unsigned short PRUint16;
377typedef short PRInt16;
378
379#define PR_INT16_MAX 32767
380#define PR_INT16_MIN (-32768)
381#define PR_UINT16_MAX 65535U
382
383typedef unsigned int PRUint32;
384typedef int PRInt32;
385#define PR_INT32(x) x
386#define PR_UINT32(x) x ## U
387
388#define PR_INT32_MAX PR_INT32(2147483647)
389#define PR_INT32_MIN (-PR_INT32_MAX - 1)
390#define PR_UINT32_MAX PR_UINT32(4294967295)
391
392typedef long PRInt64;
393typedef unsigned long PRUint64;
394typedef int PRIntn;
395typedef unsigned int PRUintn;
396
397typedef double PRFloat64;
398typedef size_t PRSize;
399
400typedef ptrdiff_t PRPtrdiff;
401
402typedef unsigned long PRUptrdiff;
403
404typedef PRIntn PRBool;
405
406#define PR_TRUE 1
407#define PR_FALSE 0
408
409typedef PRUint8 PRPackedBool;
410
411/*
412** Status code used by some routines that have a single point of failure or
413** special status return.
414*/
415typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
416
417#ifndef __PRUNICHAR__
418#define __PRUNICHAR__
419#if defined(WIN32) || defined(XP_MAC)
420typedef wchar_t PRUnichar;
421#else
422typedef PRUint16 PRUnichar;
423#endif
424typedef PRUnichar *BSTR;
425typedef const PRUnichar *CBSTR;
426#endif
427
428typedef long PRWord;
429typedef unsigned long PRUword;
430
431#define nsnull 0
432typedef PRUint32 nsresult;
433
434#if defined(__GNUC__) &amp;&amp; (__GNUC__ > 2)
435#define NS_LIKELY(x) (__builtin_expect((x), 1))
436#define NS_UNLIKELY(x) (__builtin_expect((x), 0))
437#else
438#define NS_LIKELY(x) (x)
439#define NS_UNLIKELY(x) (x)
440#endif
441
442#define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) &amp; 0x80000000))
443#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) &amp; 0x80000000)))
444
445#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
446# define PR_IntervalNow VBoxNsprPR_IntervalNow
447# define PR_TicksPerSecond VBoxNsprPR_TicksPerSecond
448# define PR_SecondsToInterval VBoxNsprPR_SecondsToInterval
449# define PR_MillisecondsToInterval VBoxNsprPR_MillisecondsToInterval
450# define PR_MicrosecondsToInterval VBoxNsprPR_MicrosecondsToInterval
451# define PR_IntervalToSeconds VBoxNsprPR_IntervalToSeconds
452# define PR_IntervalToMilliseconds VBoxNsprPR_IntervalToMilliseconds
453# define PR_IntervalToMicroseconds VBoxNsprPR_IntervalToMicroseconds
454# define PR_EnterMonitor VBoxNsprPR_EnterMonitor
455# define PR_ExitMonitor VBoxNsprPR_ExitMonitor
456# define PR_Notify VBoxNsprPR_Notify
457# define PR_NotifyAll VBoxNsprPR_NotifyAll
458# define PR_Wait VBoxNsprPR_Wait
459# define PR_NewMonitor VBoxNsprPR_NewMonitor
460# define PR_DestroyMonitor VBoxNsprPR_DestroyMonitor
461#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
462
463typedef PRUint32 PRIntervalTime;
464
465#define PR_INTERVAL_MIN 1000UL
466#define PR_INTERVAL_MAX 100000UL
467#define PR_INTERVAL_NO_WAIT 0UL
468#define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL
469
470NSPR_API(PRIntervalTime) PR_IntervalNow(void);
471NSPR_API(PRUint32) PR_TicksPerSecond(void);
472NSPR_API(PRIntervalTime) PR_SecondsToInterval(PRUint32 seconds);
473NSPR_API(PRIntervalTime) PR_MillisecondsToInterval(PRUint32 milli);
474NSPR_API(PRIntervalTime) PR_MicrosecondsToInterval(PRUint32 micro);
475NSPR_API(PRUint32) PR_IntervalToSeconds(PRIntervalTime ticks);
476NSPR_API(PRUint32) PR_IntervalToMilliseconds(PRIntervalTime ticks);
477NSPR_API(PRUint32) PR_IntervalToMicroseconds(PRIntervalTime ticks);
478
479typedef struct PRMonitor PRMonitor;
480
481NSPR_API(PRMonitor*) PR_NewMonitor(void);
482NSPR_API(void) PR_DestroyMonitor(PRMonitor *mon);
483NSPR_API(void) PR_EnterMonitor(PRMonitor *mon);
484NSPR_API(PRStatus) PR_ExitMonitor(PRMonitor *mon);
485NSPR_API(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime ticks);
486NSPR_API(PRStatus) PR_Notify(PRMonitor *mon);
487NSPR_API(PRStatus) PR_NotifyAll(PRMonitor *mon);
488
489#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
490# define PR_CreateThread VBoxNsprPR_CreateThread
491# define PR_JoinThread VBoxNsprPR_JoinThread
492# define PR_Sleep VBoxNsprPR_Sleep
493# define PR_GetCurrentThread VBoxNsprPR_GetCurrentThread
494# define PR_GetThreadState VBoxNsprPR_GetThreadState
495# define PR_SetThreadPrivate VBoxNsprPR_SetThreadPrivate
496# define PR_GetThreadPrivate VBoxNsprPR_GetThreadPrivate
497# define PR_NewThreadPrivateIndex VBoxNsprPR_NewThreadPrivateIndex
498# define PR_GetThreadPriority VBoxNsprPR_GetThreadPriority
499# define PR_SetThreadPriority VBoxNsprPR_SetThreadPriority
500# define PR_Interrupt VBoxNsprPR_Interrupt
501# define PR_ClearInterrupt VBoxNsprPR_ClearInterrupt
502# define PR_BlockInterrupt VBoxNsprPR_BlockInterrupt
503# define PR_UnblockInterrupt VBoxNsprPR_UnblockInterrupt
504# define PR_GetThreadScope VBoxNsprPR_GetThreadScope
505# define PR_GetThreadType VBoxNsprPR_GetThreadType
506#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
507
508typedef struct PRThread PRThread;
509typedef struct PRThreadStack PRThreadStack;
510
511typedef enum PRThreadType {
512 PR_USER_THREAD,
513 PR_SYSTEM_THREAD
514} PRThreadType;
515
516typedef enum PRThreadScope {
517 PR_LOCAL_THREAD,
518 PR_GLOBAL_THREAD,
519 PR_GLOBAL_BOUND_THREAD
520} PRThreadScope;
521
522typedef enum PRThreadState {
523 PR_JOINABLE_THREAD,
524 PR_UNJOINABLE_THREAD
525} PRThreadState;
526
527typedef enum PRThreadPriority
528{
529 PR_PRIORITY_FIRST = 0, /* just a placeholder */
530 PR_PRIORITY_LOW = 0, /* the lowest possible priority */
531 PR_PRIORITY_NORMAL = 1, /* most common expected priority */
532 PR_PRIORITY_HIGH = 2, /* slightly more aggressive scheduling */
533 PR_PRIORITY_URGENT = 3, /* it does little good to have more than one */
534 PR_PRIORITY_LAST = 3 /* this is just a placeholder */
535} PRThreadPriority;
536
537NSPR_API(PRThread*) PR_CreateThread(PRThreadType type,
538 void (PR_CALLBACK *start)(void *arg),
539 void *arg,
540 PRThreadPriority priority,
541 PRThreadScope scope,
542 PRThreadState state,
543 PRUint32 stackSize);
544NSPR_API(PRStatus) PR_JoinThread(PRThread *thread);
545NSPR_API(PRThread*) PR_GetCurrentThread(void);
546#ifndef NO_NSPR_10_SUPPORT
547#define PR_CurrentThread() PR_GetCurrentThread() /* for nspr1.0 compat. */
548#endif /* NO_NSPR_10_SUPPORT */
549NSPR_API(PRThreadPriority) PR_GetThreadPriority(const PRThread *thread);
550NSPR_API(void) PR_SetThreadPriority(PRThread *thread, PRThreadPriority priority);
551
552typedef void (PR_CALLBACK *PRThreadPrivateDTOR)(void *priv);
553
554NSPR_API(PRStatus) PR_NewThreadPrivateIndex(
555 PRUintn *newIndex, PRThreadPrivateDTOR destructor);
556NSPR_API(PRStatus) PR_SetThreadPrivate(PRUintn tpdIndex, void *priv);
557NSPR_API(void*) PR_GetThreadPrivate(PRUintn tpdIndex);
558NSPR_API(PRStatus) PR_Interrupt(PRThread *thread);
559NSPR_API(void) PR_ClearInterrupt(void);
560NSPR_API(void) PR_BlockInterrupt(void);
561NSPR_API(void) PR_UnblockInterrupt(void);
562NSPR_API(PRStatus) PR_Sleep(PRIntervalTime ticks);
563NSPR_API(PRThreadScope) PR_GetThreadScope(const PRThread *thread);
564NSPR_API(PRThreadType) PR_GetThreadType(const PRThread *thread);
565NSPR_API(PRThreadState) PR_GetThreadState(const PRThread *thread);
566
567#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
568# define PR_DestroyLock VBoxNsprPR_DestroyLock
569# define PR_Lock VBoxNsprPR_Lock
570# define PR_NewLock VBoxNsprPR_NewLock
571# define PR_Unlock VBoxNsprPR_Unlock
572#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
573
574typedef struct PRLock PRLock;
575
576NSPR_API(PRLock*) PR_NewLock(void);
577NSPR_API(void) PR_DestroyLock(PRLock *lock);
578NSPR_API(void) PR_Lock(PRLock *lock);
579NSPR_API(PRStatus) PR_Unlock(PRLock *lock);
580
581#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
582# define PR_NewCondVar VBoxNsprPR_NewCondVar
583# define PR_DestroyCondVar VBoxNsprPR_DestroyCondVar
584# define PR_WaitCondVar VBoxNsprPR_WaitCondVar
585# define PR_NotifyCondVar VBoxNsprPR_NotifyCondVar
586# define PR_NotifyAllCondVar VBoxNsprPR_NotifyAllCondVar
587#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
588
589typedef struct PRCondVar PRCondVar;
590
591NSPR_API(PRCondVar*) PR_NewCondVar(PRLock *lock);
592NSPR_API(void) PR_DestroyCondVar(PRCondVar *cvar);
593NSPR_API(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout);
594NSPR_API(PRStatus) PR_NotifyCondVar(PRCondVar *cvar);
595NSPR_API(PRStatus) PR_NotifyAllCondVar(PRCondVar *cvar);
596
597typedef struct PRCListStr PRCList;
598
599struct PRCListStr {
600 PRCList *next;
601 PRCList *prev;
602};
603
604#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
605# define PL_DestroyEvent VBoxNsplPL_DestroyEvent
606# define PL_HandleEvent VBoxNsplPL_HandleEvent
607# define PL_InitEvent VBoxNsplPL_InitEvent
608# define PL_CreateEventQueue VBoxNsplPL_CreateEventQueue
609# define PL_CreateMonitoredEventQueue VBoxNsplPL_CreateMonitoredEventQueue
610# define PL_CreateNativeEventQueue VBoxNsplPL_CreateNativeEventQueue
611# define PL_DequeueEvent VBoxNsplPL_DequeueEvent
612# define PL_DestroyEventQueue VBoxNsplPL_DestroyEventQueue
613# define PL_EventAvailable VBoxNsplPL_EventAvailable
614# define PL_EventLoop VBoxNsplPL_EventLoop
615# define PL_GetEvent VBoxNsplPL_GetEvent
616# define PL_GetEventOwner VBoxNsplPL_GetEventOwner
617# define PL_GetEventQueueMonitor VBoxNsplPL_GetEventQueueMonitor
618# define PL_GetEventQueueSelectFD VBoxNsplPL_GetEventQueueSelectFD
619# define PL_MapEvents VBoxNsplPL_MapEvents
620# define PL_PostEvent VBoxNsplPL_PostEvent
621# define PL_PostSynchronousEvent VBoxNsplPL_PostSynchronousEvent
622# define PL_ProcessEventsBeforeID VBoxNsplPL_ProcessEventsBeforeID
623# define PL_ProcessPendingEvents VBoxNsplPL_ProcessPendingEvents
624# define PL_RegisterEventIDFunc VBoxNsplPL_RegisterEventIDFunc
625# define PL_RevokeEvents VBoxNsplPL_RevokeEvents
626# define PL_UnregisterEventIDFunc VBoxNsplPL_UnregisterEventIDFunc
627# define PL_WaitForEvent VBoxNsplPL_WaitForEvent
628# define PL_IsQueueNative VBoxNsplPL_IsQueueNative
629# define PL_IsQueueOnCurrentThread VBoxNsplPL_IsQueueOnCurrentThread
630# define PL_FavorPerformanceHint VBoxNsplPL_FavorPerformanceHint
631#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
632
633typedef struct PLEvent PLEvent;
634typedef struct PLEventQueue PLEventQueue;
635
636PR_EXTERN(PLEventQueue*)
637PL_CreateEventQueue(const char* name, PRThread* handlerThread);
638PR_EXTERN(PLEventQueue *)
639 PL_CreateNativeEventQueue(
640 const char *name,
641 PRThread *handlerThread
642 );
643PR_EXTERN(PLEventQueue *)
644 PL_CreateMonitoredEventQueue(
645 const char *name,
646 PRThread *handlerThread
647 );
648PR_EXTERN(void)
649PL_DestroyEventQueue(PLEventQueue* self);
650PR_EXTERN(PRMonitor*)
651PL_GetEventQueueMonitor(PLEventQueue* self);
652
653#define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
654 PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
655
656#define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
657 PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
658
659PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
660PR_EXTERN(void*) PL_PostSynchronousEvent(PLEventQueue* self, PLEvent* event);
661PR_EXTERN(PLEvent*) PL_GetEvent(PLEventQueue* self);
662PR_EXTERN(PRBool) PL_EventAvailable(PLEventQueue* self);
663
664typedef void (PR_CALLBACK *PLEventFunProc)(PLEvent* event, void* data, PLEventQueue* queue);
665
666PR_EXTERN(void) PL_MapEvents(PLEventQueue* self, PLEventFunProc fun, void* data);
667PR_EXTERN(void) PL_RevokeEvents(PLEventQueue* self, void* owner);
668PR_EXTERN(void) PL_ProcessPendingEvents(PLEventQueue* self);
669PR_EXTERN(PLEvent*) PL_WaitForEvent(PLEventQueue* self);
670PR_EXTERN(void) PL_EventLoop(PLEventQueue* self);
671PR_EXTERN(PRInt32) PL_GetEventQueueSelectFD(PLEventQueue* self);
672PR_EXTERN(PRBool) PL_IsQueueOnCurrentThread( PLEventQueue *queue );
673PR_EXTERN(PRBool) PL_IsQueueNative(PLEventQueue *queue);
674
675typedef void* (PR_CALLBACK *PLHandleEventProc)(PLEvent* self);
676typedef void (PR_CALLBACK *PLDestroyEventProc)(PLEvent* self);
677PR_EXTERN(void)
678PL_InitEvent(PLEvent* self, void* owner,
679 PLHandleEventProc handler,
680 PLDestroyEventProc destructor);
681PR_EXTERN(void*) PL_GetEventOwner(PLEvent* self);
682PR_EXTERN(void) PL_HandleEvent(PLEvent* self);
683PR_EXTERN(void) PL_DestroyEvent(PLEvent* self);
684PR_EXTERN(void) PL_DequeueEvent(PLEvent* self, PLEventQueue* queue);
685PR_EXTERN(void) PL_FavorPerformanceHint(PRBool favorPerformanceOverEventStarvation, PRUint32 starvationDelay);
686
687struct PLEvent {
688 PRCList link;
689 PLHandleEventProc handler;
690 PLDestroyEventProc destructor;
691 void* owner;
692 void* synchronousResult;
693 PRLock* lock;
694 PRCondVar* condVar;
695 PRBool handled;
696#ifdef PL_POST_TIMINGS
697 PRIntervalTime postTime;
698#endif
699#ifdef XP_UNIX
700 unsigned long id;
701#endif /* XP_UNIX */
702 /* other fields follow... */
703};
704
705#if defined(XP_WIN) || defined(XP_OS2)
706
707PR_EXTERN(HWND)
708 PL_GetNativeEventReceiverWindow(
709 PLEventQueue *eqp
710 );
711#endif /* XP_WIN || XP_OS2 */
712
713#ifdef XP_UNIX
714
715PR_EXTERN(PRInt32)
716PL_ProcessEventsBeforeID(PLEventQueue *aSelf, unsigned long aID);
717
718typedef unsigned long (PR_CALLBACK *PLGetEventIDFunc)(void *aClosure);
719
720PR_EXTERN(void)
721PL_RegisterEventIDFunc(PLEventQueue *aSelf, PLGetEventIDFunc aFunc,
722 void *aClosure);
723PR_EXTERN(void) PL_UnregisterEventIDFunc(PLEventQueue *aSelf);
724
725#endif /* XP_UNIX */
726
727/* Standard "it worked" return value */
728#define NS_OK 0
729
730#define NS_ERROR_BASE ((nsresult) 0xC1F30000)
731
732/* Returned when an instance is not initialized */
733#define NS_ERROR_NOT_INITIALIZED (NS_ERROR_BASE + 1)
734
735/* Returned when an instance is already initialized */
736#define NS_ERROR_ALREADY_INITIALIZED (NS_ERROR_BASE + 2)
737
738/* Returned by a not implemented function */
739#define NS_ERROR_NOT_IMPLEMENTED ((nsresult) 0x80004001L)
740
741/* Returned when a given interface is not supported. */
742#define NS_NOINTERFACE ((nsresult) 0x80004002L)
743#define NS_ERROR_NO_INTERFACE NS_NOINTERFACE
744
745#define NS_ERROR_INVALID_POINTER ((nsresult) 0x80004003L)
746#define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
747
748/* Returned when a function aborts */
749#define NS_ERROR_ABORT ((nsresult) 0x80004004L)
750
751/* Returned when a function fails */
752#define NS_ERROR_FAILURE ((nsresult) 0x80004005L)
753
754/* Returned when an unexpected error occurs */
755#define NS_ERROR_UNEXPECTED ((nsresult) 0x8000ffffL)
756
757/* Returned when a memory allocation fails */
758#define NS_ERROR_OUT_OF_MEMORY ((nsresult) 0x8007000eL)
759
760/* Returned when an illegal value is passed */
761#define NS_ERROR_ILLEGAL_VALUE ((nsresult) 0x80070057L)
762#define NS_ERROR_INVALID_ARG NS_ERROR_ILLEGAL_VALUE
763
764/* Returned when a class doesn't allow aggregation */
765#define NS_ERROR_NO_AGGREGATION ((nsresult) 0x80040110L)
766
767/* Returned when an operation can't complete due to an unavailable resource */
768#define NS_ERROR_NOT_AVAILABLE ((nsresult) 0x80040111L)
769
770/* Returned when a class is not registered */
771#define NS_ERROR_FACTORY_NOT_REGISTERED ((nsresult) 0x80040154L)
772
773/* Returned when a class cannot be registered, but may be tried again later */
774#define NS_ERROR_FACTORY_REGISTER_AGAIN ((nsresult) 0x80040155L)
775
776/* Returned when a dynamically loaded factory couldn't be found */
777#define NS_ERROR_FACTORY_NOT_LOADED ((nsresult) 0x800401f8L)
778
779/* Returned when a factory doesn't support signatures */
780#define NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT \
781 (NS_ERROR_BASE + 0x101)
782
783/* Returned when a factory already is registered */
784#define NS_ERROR_FACTORY_EXISTS (NS_ERROR_BASE + 0x100)
785
786/**
787 * An "interface id" which can be used to uniquely identify a given
788 * interface.
789 * A "unique identifier". This is modeled after OSF DCE UUIDs.
790 */
791
792struct nsID {
793 PRUint32 m0;
794 PRUint16 m1;
795 PRUint16 m2;
796 PRUint8 m3[8];
797};
798
799typedef struct nsID nsID;
800typedef nsID nsIID;
801typedef nsID nsCID;
802
803#endif /* __cplusplus */
804
805
806/* Various COM types defined by their XPCOM equivalent */
807typedef PRInt64 LONG64;
808typedef PRInt32 LONG;
809typedef PRInt32 DWORD;
810typedef PRInt16 SHORT;
811typedef PRUint64 ULONG64;
812typedef PRUint32 ULONG;
813typedef PRUint16 USHORT;
814
815typedef PRBool BOOL;
816
817#ifndef FALSE
818#define FALSE 0
819#define TRUE 1
820#endif
821
822#define HRESULT nsresult
823#define SUCCEEDED NS_SUCCEEDED
824#define FAILED NS_FAILED
825
826/* OLE error codes */
827#define S_OK ((nsresult)NS_OK)
828#define E_UNEXPECTED NS_ERROR_UNEXPECTED
829#define E_NOTIMPL NS_ERROR_NOT_IMPLEMENTED
830#define E_OUTOFMEMORY NS_ERROR_OUT_OF_MEMORY
831#define E_INVALIDARG NS_ERROR_INVALID_ARG
832#define E_NOINTERFACE NS_ERROR_NO_INTERFACE
833#define E_POINTER NS_ERROR_NULL_POINTER
834#define E_ABORT NS_ERROR_ABORT
835#define E_FAIL NS_ERROR_FAILURE
836/* Note: a better analog for E_ACCESSDENIED would probably be
837 * NS_ERROR_NOT_AVAILABLE, but we want binary compatibility for now. */
838#define E_ACCESSDENIED ((nsresult)0x80070005L)
839
840/* Basic vartype for COM compatibility. */
841typedef enum VARTYPE
842{
843 VT_I2 = 2,
844 VT_I4 = 3,
845 VT_BSTR = 8,
846 VT_DISPATCH = 9,
847 VT_BOOL = 11,
848 VT_UNKNOWN = 13,
849 VT_I1 = 16,
850 VT_UI1 = 17,
851 VT_UI2 = 18,
852 VT_UI4 = 19,
853 VT_I8 = 20,
854 VT_UI8 = 21,
855 VT_HRESULT = 25
856} VARTYPE;
857
858/* Basic safearray type for COM compatibility. */
859typedef struct SAFEARRAY
860{
861 void *pv;
862 ULONG c;
863} SAFEARRAY;
864
865#define ComSafeArrayAsInParam(f) ((f)->c), ((f)->pv)
866#define ComSafeArrayAsOutParam(f) (&amp;((f)->c)), (&amp;((f)->pv))
867#define ComSafeArrayAsOutIfaceParam(f,t) (&amp;((f)->c)), (t**)(&amp;((f)->pv))
868
869/* Glossing over differences between COM and XPCOM */
870#define IErrorInfo nsIException
871#define IUnknown nsISupports
872#define IDispatch nsISupports
873
874#ifndef __cplusplus
875
876struct nsISupports; /* forward declaration */
877struct nsIStackFrame; /* forward declaration */
878struct nsIException; /* forward declaration */
879typedef struct nsISupports nsISupports; /* forward declaration */
880typedef struct nsIStackFrame nsIStackFrame; /* forward declaration */
881typedef struct nsIException nsIException; /* forward declaration */
882
883/* starting interface: nsISupports */
884#define NS_ISUPPORTS_IID_STR "00000000-0000-0000-c000-000000000046"
885
886#define NS_ISUPPORTS_IID \
887 { 0x00000000, 0x0000, 0x0000, \
888 {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
889
890/**
891 * Reference count values
892 *
893 * This is the return type for AddRef() and Release() in nsISupports.
894 * IUnknown of COM returns an unsigned long from equivalent functions.
895 * The following ifdef exists to maintain binary compatibility with
896 * IUnknown.
897 */
898#if defined(XP_WIN) &amp;&amp; PR_BYTES_PER_LONG == 4
899typedef unsigned long nsrefcnt;
900#else
901typedef PRUint32 nsrefcnt;
902#endif
903
904/**
905 * Basic component object model interface. Objects which implement
906 * this interface support runtime interface discovery (QueryInterface)
907 * and a reference counted memory model (AddRef/Release). This is
908 * modelled after the win32 IUnknown API.
909 */
910#ifndef VBOX_WITH_GLUE
911struct nsISupports_vtbl
912{
913 nsresult (*QueryInterface)(nsISupports *pThis, const nsID *iid, void **resultp);
914 nsrefcnt (*AddRef)(nsISupports *pThis);
915 nsrefcnt (*Release)(nsISupports *pThis);
916};
917#else /* !VBOX_WITH_GLUE */
918struct nsISupportsVtbl
919{
920 nsresult (*QueryInterface)(nsISupports *pThis, const nsID *iid, void **resultp);
921 nsrefcnt (*AddRef)(nsISupports *pThis);
922 nsrefcnt (*Release)(nsISupports *pThis);
923};
924#define nsISupports_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
925#define nsISupports_AddRef(p) ((p)->lpVtbl->AddRef(p))
926#define nsISupports_Release(p) ((p)->lpVtbl->Release(p))
927#define IUnknown_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
928#define IUnknown_AddRef(p) ((p)->lpVtbl->AddRef(p))
929#define IUnknown_Release(p) ((p)->lpVtbl->Release(p))
930#define IDispatch_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
931#define IDispatch_AddRef(p) ((p)->lpVtbl->AddRef(p))
932#define IDispatch_Release(p) ((p)->lpVtbl->Release(p))
933#endif /* !VBOX_WITH_GLUE */
934
935struct nsISupports
936{
937#ifndef VBOX_WITH_GLUE
938 struct nsISupports_vtbl *vtbl;
939#else /* !VBOX_WITH_GLUE */
940 struct nsISupportsVtbl *lpVtbl;
941#endif /* !VBOX_WITH_GLUE */
942};
943
944/* starting interface: nsIException */
945#define NS_IEXCEPTION_IID_STR "f3a8d3b4-c424-4edc-8bf6-8974c983ba78"
946
947#define NS_IEXCEPTION_IID \
948 {0xf3a8d3b4, 0xc424, 0x4edc, \
949 { 0x8b, 0xf6, 0x89, 0x74, 0xc9, 0x83, 0xba, 0x78 }}
950
951#ifndef VBOX_WITH_GLUE
952struct nsIException_vtbl
953{
954 /* Methods from the interface nsISupports */
955 struct nsISupports_vtbl nsisupports;
956
957 nsresult (*GetMessage)(nsIException *pThis, PRUnichar * *aMessage);
958 nsresult (*GetResult)(nsIException *pThis, nsresult *aResult);
959 nsresult (*GetName)(nsIException *pThis, PRUnichar * *aName);
960 nsresult (*GetFilename)(nsIException *pThis, PRUnichar * *aFilename);
961 nsresult (*GetLineNumber)(nsIException *pThis, PRUint32 *aLineNumber);
962 nsresult (*GetColumnNumber)(nsIException *pThis, PRUint32 *aColumnNumber);
963 nsresult (*GetLocation)(nsIException *pThis, nsIStackFrame * *aLocation);
964 nsresult (*GetInner)(nsIException *pThis, nsIException * *aInner);
965 nsresult (*GetData)(nsIException *pThis, nsISupports * *aData);
966 nsresult (*ToString)(nsIException *pThis, PRUnichar **_retval);
967};
968#else /* !VBOX_WITH_GLUE */
969struct nsIExceptionVtbl
970{
971 nsresult (*QueryInterface)(nsIException *pThis, const nsID *iid, void **resultp);
972 nsrefcnt (*AddRef)(nsIException *pThis);
973 nsrefcnt (*Release)(nsIException *pThis);
974
975 nsresult (*GetMessage)(nsIException *pThis, PRUnichar * *aMessage);
976 nsresult (*GetResult)(nsIException *pThis, nsresult *aResult);
977 nsresult (*GetName)(nsIException *pThis, PRUnichar * *aName);
978 nsresult (*GetFilename)(nsIException *pThis, PRUnichar * *aFilename);
979 nsresult (*GetLineNumber)(nsIException *pThis, PRUint32 *aLineNumber);
980 nsresult (*GetColumnNumber)(nsIException *pThis, PRUint32 *aColumnNumber);
981 nsresult (*GetLocation)(nsIException *pThis, nsIStackFrame * *aLocation);
982 nsresult (*GetInner)(nsIException *pThis, nsIException * *aInner);
983 nsresult (*GetData)(nsIException *pThis, nsISupports * *aData);
984 nsresult (*ToString)(nsIException *pThis, PRUnichar **_retval);
985};
986#define nsIException_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
987#define nsIException_AddRef(p) ((p)->lpVtbl->AddRef(p))
988#define nsIException_Release(p) ((p)->lpVtbl->Release(p))
989#define nsIException_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
990#define nsIException_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
991#define nsIException_get_Result(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
992#define nsIException_GetResult(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
993#define nsIException_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
994#define nsIException_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
995#define nsIException_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
996#define nsIException_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
997#define nsIException_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
998#define nsIException_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
999#define nsIException_get_ColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
1000#define nsIException_GetColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
1001#define nsIException_get_Inner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
1002#define nsIException_GetInner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
1003#define nsIException_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))
1004#define nsIException_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))
1005#define nsIException_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))
1006#define IErrorInfo_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
1007#define IErrorInfo_AddRef(p) ((p)->lpVtbl->AddRef(p))
1008#define IErrorInfo_Release(p) ((p)->lpVtbl->Release(p))
1009#define IErrorInfo_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
1010#define IErrorInfo_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
1011#define IErrorInfo_get_Result(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
1012#define IErrorInfo_GetResult(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
1013#define IErrorInfo_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
1014#define IErrorInfo_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
1015#define IErrorInfo_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
1016#define IErrorInfo_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
1017#define IErrorInfo_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
1018#define IErrorInfo_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
1019#define IErrorInfo_get_ColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
1020#define IErrorInfo_GetColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
1021#define IErrorInfo_get_Inner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
1022#define IErrorInfo_GetInner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
1023#define IErrorInfo_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))
1024#define IErrorInfo_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))
1025#define IErrorInfo_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))
1026#endif /* !VBOX_WITH_GLUE */
1027
1028struct nsIException
1029{
1030#ifndef VBOX_WITH_GLUE
1031 struct nsIException_vtbl *vtbl;
1032#else /* !VBOX_WITH_GLUE */
1033 struct nsIExceptionVtbl *lpVtbl;
1034#endif /* !VBOX_WITH_GLUE */
1035};
1036
1037/* starting interface: nsIStackFrame */
1038#define NS_ISTACKFRAME_IID_STR "91d82105-7c62-4f8b-9779-154277c0ee90"
1039
1040#define NS_ISTACKFRAME_IID \
1041 {0x91d82105, 0x7c62, 0x4f8b, \
1042 { 0x97, 0x79, 0x15, 0x42, 0x77, 0xc0, 0xee, 0x90 }}
1043
1044#ifndef VBOX_WITH_GLUE
1045struct nsIStackFrame_vtbl
1046{
1047 /* Methods from the interface nsISupports */
1048 struct nsISupports_vtbl nsisupports;
1049
1050 nsresult (*GetLanguage)(nsIStackFrame *pThis, PRUint32 *aLanguage);
1051 nsresult (*GetLanguageName)(nsIStackFrame *pThis, PRUnichar * *aLanguageName);
1052 nsresult (*GetFilename)(nsIStackFrame *pThis, PRUnichar * *aFilename);
1053 nsresult (*GetName)(nsIStackFrame *pThis, PRUnichar * *aName);
1054 nsresult (*GetLineNumber)(nsIStackFrame *pThis, PRInt32 *aLineNumber);
1055 nsresult (*GetSourceLine)(nsIStackFrame *pThis, PRUnichar * *aSourceLine);
1056 nsresult (*GetCaller)(nsIStackFrame *pThis, nsIStackFrame * *aCaller);
1057 nsresult (*ToString)(nsIStackFrame *pThis, PRUnichar **_retval);
1058};
1059#else /* !VBOX_WITH_GLUE */
1060struct nsIStackFrameVtbl
1061{
1062 nsresult (*QueryInterface)(nsIStackFrame *pThis, const nsID *iid, void **resultp);
1063 nsrefcnt (*AddRef)(nsIStackFrame *pThis);
1064 nsrefcnt (*Release)(nsIStackFrame *pThis);
1065
1066 nsresult (*GetLanguage)(nsIStackFrame *pThis, PRUint32 *aLanguage);
1067 nsresult (*GetLanguageName)(nsIStackFrame *pThis, PRUnichar * *aLanguageName);
1068 nsresult (*GetFilename)(nsIStackFrame *pThis, PRUnichar * *aFilename);
1069 nsresult (*GetName)(nsIStackFrame *pThis, PRUnichar * *aName);
1070 nsresult (*GetLineNumber)(nsIStackFrame *pThis, PRInt32 *aLineNumber);
1071 nsresult (*GetSourceLine)(nsIStackFrame *pThis, PRUnichar * *aSourceLine);
1072 nsresult (*GetCaller)(nsIStackFrame *pThis, nsIStackFrame * *aCaller);
1073 nsresult (*ToString)(nsIStackFrame *pThis, PRUnichar **_retval);
1074};
1075#define nsIStackFrame_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
1076#define nsIStackFrame_AddRef(p) ((p)->lpVtbl->AddRef(p))
1077#define nsIStackFrame_Release(p) ((p)->lpVtbl->Release(p))
1078#define nsIStackFrame_get_Language(p, aLanguage) ((p)->lpVtbl->GetLanguge(p, aLanguage))
1079#define nsIStackFrame_GetLanguage(p, aLanguage) ((p)->lpVtbl->GetLanguge(p, aLanguage))
1080#define nsIStackFrame_get_LanguageName(p, aLanguageName) ((p)->lpVtbl->GetLanguageName(p, aLanguageName))
1081#define nsIStackFrame_GetLanguageName(p, aLanguageName) ((p)->lpVtbl->GetLanguageName(p, aLanguageName))
1082#define nsIStackFrame_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
1083#define nsIStackFrame_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
1084#define nsIStackFrame_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
1085#define nsIStackFrame_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
1086#define nsIStackFrame_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
1087#define nsIStackFrame_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
1088#define nsIStackFrame_get_SourceLine(p, aSourceLine) ((p)->lpVtbl->GetSourceLine(p, aSourceLine))
1089#define nsIStackFrame_GetSourceLine(p, aSourceLine) ((p)->lpVtbl->GetSourceLine(p, aSourceLine))
1090#define nsIStackFrame_get_Caller(p, aCaller) ((p)->lpVtbl->GetCaller(p, aCaller))
1091#define nsIStackFrame_GetCaller(p, aCaller) ((p)->lpVtbl->GetCaller(p, aCaller))
1092#define nsIStackFrame_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))
1093#endif /* !VBOX_WITH_GLUE */
1094
1095struct nsIStackFrame
1096{
1097#ifndef VBOX_WITH_GLUE
1098 struct nsIStackFrame_vtbl *vtbl;
1099#else /* !VBOX_WITH_GLUE */
1100 struct nsIStackFrameVtbl *lpVtbl;
1101#endif /* !VBOX_WITH_GLUE */
1102};
1103
1104/* starting interface: nsIEventTarget */
1105#define NS_IEVENTTARGET_IID_STR "ea99ad5b-cc67-4efb-97c9-2ef620a59f2a"
1106
1107#define NS_IEVENTTARGET_IID \
1108 {0xea99ad5b, 0xcc67, 0x4efb, \
1109 { 0x97, 0xc9, 0x2e, 0xf6, 0x20, 0xa5, 0x9f, 0x2a }}
1110
1111struct nsIEventTarget;
1112typedef struct nsIEventTarget nsIEventTarget;
1113
1114#ifndef VBOX_WITH_GLUE
1115struct nsIEventTarget_vtbl
1116{
1117 struct nsISupports_vtbl nsisupports;
1118
1119 nsresult (*PostEvent)(nsIEventTarget *pThis, PLEvent * aEvent);
1120 nsresult (*IsOnCurrentThread)(nsIEventTarget *pThis, PRBool *_retval);
1121};
1122#else /* !VBOX_WITH_GLUE */
1123struct nsIEventTargetVtbl
1124{
1125 nsresult (*QueryInterface)(nsIEventTarget *pThis, const nsID *iid, void **resultp);
1126 nsrefcnt (*AddRef)(nsIEventTarget *pThis);
1127 nsrefcnt (*Release)(nsIEventTarget *pThis);
1128
1129 nsresult (*PostEvent)(nsIEventTarget *pThis, PLEvent * aEvent);
1130 nsresult (*IsOnCurrentThread)(nsIEventTarget *pThis, PRBool *_retval);
1131};
1132#define nsIEventTarget_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
1133#define nsIEventTarget_AddRef(p) ((p)->lpVtbl->AddRef(p))
1134#define nsIEventTarget_Release(p) ((p)->lpVtbl->Release(p))
1135#define nsIEventTarget_PostEvent(p, aEvent) ((p)->lpVtbl->PostEvent(p, aEvent))
1136#define nsIEventTarget_IsOnCurrentThread(p, retval) ((p)->lpVtbl->IsOnCurrentThread(p, retval))
1137#endif /* !VBOX_WITH_GLUE */
1138
1139struct nsIEventTarget
1140{
1141#ifndef VBOX_WITH_GLUE
1142 struct nsIEventTarget_vtbl *vtbl;
1143#else /* !VBOX_WITH_GLUE */
1144 struct nsIEventTargetVtbl *lpVtbl;
1145#endif /* !VBOX_WITH_GLUE */
1146};
1147
1148/* starting interface: nsIEventQueue */
1149#define NS_IEVENTQUEUE_IID_STR "176afb41-00a4-11d3-9f2a-00400553eef0"
1150
1151#define NS_IEVENTQUEUE_IID \
1152 {0x176afb41, 0x00a4, 0x11d3, \
1153 { 0x9f, 0x2a, 0x00, 0x40, 0x05, 0x53, 0xee, 0xf0 }}
1154
1155struct nsIEventQueue;
1156typedef struct nsIEventQueue nsIEventQueue;
1157
1158#ifndef VBOX_WITH_GLUE
1159struct nsIEventQueue_vtbl
1160{
1161 struct nsIEventTarget_vtbl nsieventtarget;
1162
1163 nsresult (*InitEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor);
1164 nsresult (*PostSynchronousEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * *aResult);
1165 nsresult (*PendingEvents)(nsIEventQueue *pThis, PRBool *_retval);
1166 nsresult (*ProcessPendingEvents)(nsIEventQueue *pThis);
1167 nsresult (*EventLoop)(nsIEventQueue *pThis);
1168 nsresult (*EventAvailable)(nsIEventQueue *pThis, PRBool *aResult);
1169 nsresult (*GetEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
1170 nsresult (*HandleEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
1171 nsresult (*WaitForEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
1172 PRInt32 (*GetEventQueueSelectFD)(nsIEventQueue *pThis);
1173 nsresult (*Init)(nsIEventQueue *pThis, PRBool aNative);
1174 nsresult (*InitFromPRThread)(nsIEventQueue *pThis, PRThread * thread, PRBool aNative);
1175 nsresult (*InitFromPLQueue)(nsIEventQueue *pThis, PLEventQueue * aQueue);
1176 nsresult (*EnterMonitor)(nsIEventQueue *pThis);
1177 nsresult (*ExitMonitor)(nsIEventQueue *pThis);
1178 nsresult (*RevokeEvents)(nsIEventQueue *pThis, void * owner);
1179 nsresult (*GetPLEventQueue)(nsIEventQueue *pThis, PLEventQueue * *_retval);
1180 nsresult (*IsQueueNative)(nsIEventQueue *pThis, PRBool *_retval);
1181 nsresult (*StopAcceptingEvents)(nsIEventQueue *pThis);
1182};
1183#else /* !VBOX_WITH_GLUE */
1184struct nsIEventQueueVtbl
1185{
1186 nsresult (*QueryInterface)(nsIEventQueue *pThis, const nsID *iid, void **resultp);
1187 nsrefcnt (*AddRef)(nsIEventQueue *pThis);
1188 nsrefcnt (*Release)(nsIEventQueue *pThis);
1189
1190 nsresult (*PostEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
1191 nsresult (*IsOnCurrentThread)(nsIEventQueue *pThis, PRBool *_retval);
1192
1193 nsresult (*InitEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor);
1194 nsresult (*PostSynchronousEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * *aResult);
1195 nsresult (*PendingEvents)(nsIEventQueue *pThis, PRBool *_retval);
1196 nsresult (*ProcessPendingEvents)(nsIEventQueue *pThis);
1197 nsresult (*EventLoop)(nsIEventQueue *pThis);
1198 nsresult (*EventAvailable)(nsIEventQueue *pThis, PRBool *aResult);
1199 nsresult (*GetEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
1200 nsresult (*HandleEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
1201 nsresult (*WaitForEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
1202 PRInt32 (*GetEventQueueSelectFD)(nsIEventQueue *pThis);
1203 nsresult (*Init)(nsIEventQueue *pThis, PRBool aNative);
1204 nsresult (*InitFromPRThread)(nsIEventQueue *pThis, PRThread * thread, PRBool aNative);
1205 nsresult (*InitFromPLQueue)(nsIEventQueue *pThis, PLEventQueue * aQueue);
1206 nsresult (*EnterMonitor)(nsIEventQueue *pThis);
1207 nsresult (*ExitMonitor)(nsIEventQueue *pThis);
1208 nsresult (*RevokeEvents)(nsIEventQueue *pThis, void * owner);
1209 nsresult (*GetPLEventQueue)(nsIEventQueue *pThis, PLEventQueue * *_retval);
1210 nsresult (*IsQueueNative)(nsIEventQueue *pThis, PRBool *_retval);
1211 nsresult (*StopAcceptingEvents)(nsIEventQueue *pThis);
1212};
1213#define nsIEventQueue_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
1214#define nsIEventQueue_AddRef(p) ((p)->lpVtbl->AddRef(p))
1215#define nsIEventQueue_Release(p) ((p)->lpVtbl->Release(p))
1216#define nsIEventQueue_PostEvent(p, aEvent) ((p)->lpVtbl->PostEvent(p, aEvent))
1217#define nsIEventQueue_IsOnCurrentThread(p, retval) ((p)->lpVtbl->IsOnCurrentThread(p, retval))
1218#define nsIEventQueue_InitEvent(p, aEvent, owner, handler, destructor) ((p)->lpVtbl->InitEvent(p, aEvent, owner, handler, destructor))
1219#define nsIEventQueue_PostSynchronousEvent(p, aEvent, aResult) ((p)->lpVtbl->PostSynchronousEvent(p, aEvent, aResult))
1220#define nsIEventQueue_ProcessPendingEvents(p) ((p)->lpVtbl->ProcessPendingEvents(p))
1221#define nsIEventQueue_EventLoop(p) ((p)->lpVtbl->EventLoop(p))
1222#define nsIEventQueue_EventAvailable(p, aResult) ((p)->lpVtbl->EventAvailable(p, aResult))
1223#define nsIEventQueue_get_Event(p, aEvent) ((p)->lpVtbl->GetEvent(p, aEvent))
1224#define nsIEventQueue_GetEvent(p, aEvent) ((p)->lpVtbl->GetEvent(p, aEvent))
1225#define nsIEventQueue_HandleEvent(p, aEvent) ((p)->lpVtbl->HandleEvent(p, aEvent))
1226#define nsIEventQueue_WaitForEvent(p, aEvent) ((p)->lpVtbl->WaitForEvent(p, aEvent))
1227#define nsIEventQueue_GetEventQueueSelectFD(p) ((p)->lpVtbl->GetEventQueueSelectFD(p))
1228#define nsIEventQueue_Init(p, aNative) ((p)->lpVtbl->Init(p, aNative))
1229#define nsIEventQueue_InitFromPLQueue(p, aQueue) ((p)->lpVtbl->InitFromPLQueue(p, aQueue))
1230#define nsIEventQueue_EnterMonitor(p) ((p)->lpVtbl->EnterMonitor(p))
1231#define nsIEventQueue_ExitMonitor(p) ((p)->lpVtbl->ExitMonitor(p))
1232#define nsIEventQueue_RevokeEvents(p, owner) ((p)->lpVtbl->RevokeEvents(p, owner))
1233#define nsIEventQueue_GetPLEventQueue(p, retval) ((p)->lpVtbl->GetPLEventQueue(p, retval))
1234#define nsIEventQueue_IsQueueNative(p, retval) ((p)->lpVtbl->IsQueueNative(p, retval))
1235#define nsIEventQueue_StopAcceptingEvents(p) ((p)->lpVtbl->StopAcceptingEvents(p))
1236#endif /* !VBOX_WITH_GLUE */
1237
1238struct nsIEventQueue
1239{
1240#ifndef VBOX_WITH_GLUE
1241 struct nsIEventQueue_vtbl *vtbl;
1242#else /* !VBOX_WITH_GLUE */
1243 struct nsIEventQueueVtbl *lpVtbl;
1244#endif /* !VBOX_WITH_GLUE */
1245};
1246
1247</xsl:text>
1248 <xsl:apply-templates/>
1249 <xsl:text>
1250
1251#endif /* __cplusplus */
1252
1253#endif /* !WIN32 */
1254
1255#ifdef __cplusplus
1256extern "C"
1257{
1258#endif /* __cplusplus */
1259
1260
1261/**
1262 * Function table for dynamic linking.
1263 * Use VBoxGetCAPIFunctions() to obtain the pointer to it.
1264 */
1265typedef struct VBOXCAPI
1266{
1267 /** The size of the structure. */
1268 unsigned cb;
1269 /** The structure version. */
1270 unsigned uVersion;
1271
1272 /** Gets the VirtualBox version, major * 1000000 + minor * 1000 + patch. */
1273 unsigned int (*pfnGetVersion)(void);
1274
1275 /** Gets the VirtualBox API version, major * 1000 + minor, e.g. 4003. */
1276 unsigned int (*pfnGetAPIVersion)(void);
1277
1278 /**
1279 * New and preferred way to initialize the C bindings for an API client.
1280 *
1281 * This way is much more flexible, as it can easily handle multiple
1282 * sessions (important with more complicated API clients, including
1283 * multithreaded ones), and even VBoxSVC crashes can be detected and
1284 * processed appropriately by listening for events from the associated
1285 * event source in VirtualBoxClient. It is completely up to the client
1286 * to decide what to do (terminate or continue after getting new
1287 * object references to server-side objects). Must be called in the
1288 * primary thread of the client, later API use can be done in any
1289 * thread.
1290 *
1291 * Note that the returned reference is owned by the caller, and thus it's
1292 * the caller's responsibility to handle the reference count appropriately.
1293 *
1294 * @param pszVirtualBoxClientIID pass IVIRTUALBOXCLIENT_IID_STR
1295 * @param ppVirtualBoxClient output parameter for VirtualBoxClient
1296 * reference, handled as usual with COM/XPCOM.
1297 * @returns COM/XPCOM error code
1298 */
1299 HRESULT (*pfnClientInitialize)(const char *pszVirtualBoxClientIID,
1300 IVirtualBoxClient **ppVirtualBoxClient);
1301 /**
1302 * Initialize the use of the C bindings in a non-primary thread.
1303 *
1304 * Must be called on any newly created thread which wants to use the
1305 * VirtualBox API.
1306 *
1307 * @returns COM/XPCOM error code
1308 */
1309 HRESULT (*pfnClientThreadInitialize)(void);
1310 /**
1311 * Uninitialize the use of the C bindings in a non-primary thread.
1312 *
1313 * Should be called before terminating the thread which initialized the
1314 * C bindings using pfnClientThreadInitialize.
1315 *
1316 * @returns COM/XPCOM error code
1317 */
1318 HRESULT (*pfnClientThreadUninitialize)(void);
1319 /**
1320 * Uninitialize the C bindings for an API client.
1321 *
1322 * Should be called when the API client is about to terminate and does
1323 * not want to use the C bindings any more. It will invalidate all
1324 * object references. It is possible, however, to change one's mind,
1325 * and call pfnClientInitialize again to continue using the API, as long
1326 * as none of the object references from before the re-initialization
1327 * are used. Must be called from the primary thread of the client.
1328 */
1329 void (*pfnClientUninitialize)(void);
1330
1331 /**
1332 * Deprecated way to initialize the C bindings and getting important
1333 * object references. Kept for backwards compatibility.
1334 *
1335 * If any returned reference is NULL then the initialization failed.
1336 * Note that the returned references are owned by the C bindings. The
1337 * number of calls to Release in the client code must match the number
1338 * of calls to AddRef, and additionally at no point in time there can
1339 * be more Release calls than AddRef calls.
1340 *
1341 * @param pszVirtualBoxIID pass IVIRTUALBOX_IID_STR
1342 * @param ppVirtualBox output parameter for VirtualBox reference,
1343 * owned by C bindings
1344 * @param pszSessionIID pass ISESSION_IID_STR
1345 * @param ppSession output parameter for Session reference,
1346 * owned by C bindings
1347 */
1348 void (*pfnComInitialize)(const char *pszVirtualBoxIID,
1349 IVirtualBox **ppVirtualBox,
1350 const char *pszSessionIID,
1351 ISession **ppSession);
1352 /**
1353 * Deprecated way to uninitialize the C bindings for an API client.
1354 * Kept for backwards compatibility and must be used if the C bindings
1355 * were initialized using pfnComInitialize. */
1356 void (*pfnComUninitialize)(void);
1357
1358 /**
1359 * Free string managed by COM/XPCOM.
1360 *
1361 * @param pwsz pointer to string to be freed
1362 */
1363 void (*pfnComUnallocString)(BSTR pwsz);
1364#ifndef WIN32
1365 /** Legacy function, was always for freeing strings only. */
1366#define pfnComUnallocMem(pv) pfnComUnallocString((BSTR)(pv))
1367#endif /* !WIN32 */
1368
1369 /**
1370 * Convert string from UTF-16 encoding to UTF-8 encoding.
1371 *
1372 * @param pwszString input string
1373 * @param ppszString output string
1374 * @returns IPRT status code
1375 */
1376 int (*pfnUtf16ToUtf8)(CBSTR pwszString, char **ppszString);
1377 /**
1378 * Convert string from UTF-8 encoding to UTF-16 encoding.
1379 *
1380 * @param pszString input string
1381 * @param ppwszString output string
1382 * @returns IPRT status code
1383 */
1384 int (*pfnUtf8ToUtf16)(const char *pszString, BSTR *ppwszString);
1385 /**
1386 * Free memory returned by pfnUtf16ToUtf8. Do not use for anything else.
1387 *
1388 * @param pszString string to be freed.
1389 */
1390 void (*pfnUtf8Free)(char *pszString);
1391 /**
1392 * Free memory returned by pfnUtf8ToUtf16. Do not use for anything else.
1393 *
1394 * @param pwszString string to be freed.
1395 */
1396 void (*pfnUtf16Free)(BSTR pwszString);
1397
1398 /**
1399 * Create a safearray (used for passing arrays to COM/XPCOM)
1400 *
1401 * Must be freed by pfnSafeArrayDestroy.
1402 *
1403 * @param vt variant type, defines the size of the elements
1404 * @param lLbound lower bound of the index, should be 0
1405 * @param cElements number of elements
1406 * @returns pointer to safearray
1407 */
1408 SAFEARRAY *(*pfnSafeArrayCreateVector)(VARTYPE vt, LONG lLbound, ULONG cElements);
1409 /**
1410 * Pre-allocate a safearray to be used by an out safearray parameter
1411 *
1412 * Must be freed by pfnSafeArrayDestroy.
1413 *
1414 * @returns pointer to safearray (system dependent, may be NULL if
1415 * there is no need to pre-allocate a safearray)
1416 */
1417 SAFEARRAY *(*pfnSafeArrayOutParamAlloc)(void);
1418 /**
1419 * Copy a C array into a safearray (for passing as an input parameter)
1420 *
1421 * @param psa pointer to already created safearray.
1422 * @param pv pointer to memory block to copy into safearray.
1423 * @param cb number of bytes to copy.
1424 * @returns COM/XPCOM error code
1425 */
1426 HRESULT (*pfnSafeArrayCopyInParamHelper)(SAFEARRAY *psa, const void *pv, ULONG cb);
1427 /**
1428 * Copy a safearray into a C array (for getting an output parameter)
1429 *
1430 * @param ppv output pointer to newly created array, which has to
1431 * be freed with free().
1432 * @param pcb number of bytes in the output buffer.
1433 * @param vt variant type, defines the size of the elements
1434 * @param psa pointer to safearray for getting the data
1435 * @returns COM/XPCOM error code
1436 */
1437 HRESULT (*pfnSafeArrayCopyOutParamHelper)(void **ppv, ULONG *pcb, VARTYPE vt, SAFEARRAY *psa);
1438 /**
1439 * Copy a safearray into a C array (special variant for interface pointers)
1440 *
1441 * @param ppaObj output pointer to newly created array, which has
1442 * to be freed with free(). Note that it's the caller's
1443 * responsibility to call Release() on each non-NULL interface
1444 * pointer before freeing.
1445 * @param pcObj number of pointers in the output buffer.
1446 * @param psa pointer to safearray for getting the data
1447 * @returns COM/XPCOM error code
1448 */
1449 HRESULT (*pfnSafeArrayCopyOutIfaceParamHelper)(IUnknown ***ppaObj, ULONG *pcObj, SAFEARRAY *psa);
1450 /**
1451 * Free a safearray
1452 *
1453 * @param psa pointer to safearray for getting the data
1454 * @returns COM/XPCOM error code
1455 */
1456 HRESULT (*pfnSafeArrayDestroy)(SAFEARRAY *psa);
1457
1458#ifndef WIN32
1459 /**
1460 * Get XPCOM event queue. Deprecated!
1461 *
1462 * @param ppEventQueue output parameter for nsIEventQueue reference,
1463 * owned by C bindings.
1464 */
1465 void (*pfnGetEventQueue)(nsIEventQueue **ppEventQueue);
1466#endif /* !WIN32 */
1467
1468 /**
1469 * Get current COM/XPCOM exception.
1470 *
1471 * @param ppException output parameter for exception info reference,
1472 * may be @c NULL if no exception object has been created by
1473 * a previous COM/XPCOM call.
1474 * @returns COM/XPCOM error code
1475 */
1476 HRESULT (*pfnGetException)(IErrorInfo **ppException);
1477 /**
1478 * Clears current COM/XPCOM exception.
1479 *
1480 * @returns COM/XPCOM error code
1481 */
1482 HRESULT (*pfnClearException)(void);
1483
1484 /**
1485 * Process the event queue for a given amount of time.
1486 *
1487 * Must be called on the primary thread. Typical timeouts are from 200 to
1488 * 5000 msecs, to allow for checking a volatile variable if the event queue
1489 * processing should be terminated (,
1490 * or 0 if only the pending events should be processed, without waiting.
1491 *
1492 * @param iTimeoutMS how long to process the event queue, -1 means
1493 * infinitely long
1494 * @returns status code
1495 * @retval 0 if at least one event has been processed
1496 * @retval 1 if any signal interrupted the native system call (or returned
1497 * otherwise)
1498 * @retval 2 if the event queue was explicitly interrupted
1499 * @retval 3 if the timeout expired
1500 * @retval 4 if the function was called from the wrong thread
1501 * @retval 5 for all other (unexpected) errors
1502 */
1503 int (*pfnProcessEventQueue)(LONG64 iTimeoutMS);
1504 /**
1505 * Interrupt event queue processing.
1506 *
1507 * Can be called on any thread. Note that this function is not async-signal
1508 * safe, so never use it in such a context, instead use a volatile global
1509 * variable and a sensible timeout.
1510 * @returns 0 if successful, 1 otherwise.
1511 */
1512 int (*pfnInterruptEventQueueProcessing)(void);
1513
1514 /** Tail version, same as uVersion. */
1515 unsigned uEndVersion;
1516} VBOXCAPI;
1517/** Pointer to a const VBOXCAPI function table. */
1518typedef VBOXCAPI const *PCVBOXCAPI;
1519#ifndef WIN32
1520/** Backwards compatibility: Pointer to a const VBOXCAPI function table.
1521 * Use PCVBOXCAPI instead. */
1522typedef VBOXCAPI const *PCVBOXXPCOM;
1523#endif /* !WIN32 */
1524
1525#ifndef WIN32
1526/** Backwards compatibility: make sure old code using VBOXXPCOMC still compiles.
1527 * Use VBOXCAPI instead. */
1528#define VBOXXPCOMC VBOXCAPI
1529#endif /* !WIN32 */
1530
1531/** The current interface version.
1532 * For use with VBoxGetCAPIFunctions and to be found in VBOXCAPI::uVersion. */
1533#define VBOX_CAPI_VERSION 0x00040000U
1534
1535#ifndef WIN32
1536/** Backwards compatibility: The current interface version.
1537 * Use VBOX_CAPI_VERSION instead. */
1538#define VBOX_XPCOMC_VERSION VBOX_CAPI_VERSION
1539#endif /* !WIN32 */
1540
1541/** VBoxGetCAPIFunctions. */
1542VBOXCAPI_DECL(PCVBOXCAPI) VBoxGetCAPIFunctions(unsigned uVersion);
1543#ifndef WIN32
1544/** Backwards compatibility: VBoxGetXPCOMCFunctions.
1545 * Use VBoxGetCAPIFunctions instead. */
1546VBOXCAPI_DECL(PCVBOXCAPI) VBoxGetXPCOMCFunctions(unsigned uVersion);
1547#endif /* !WIN32 */
1548
1549/** Typedef for VBoxGetCAPIFunctions. */
1550typedef PCVBOXCAPI (*PFNVBOXGETCAPIFUNCTIONS)(unsigned uVersion);
1551#ifndef WIN32
1552/** Backwards compatibility: Typedef for VBoxGetXPCOMCFunctions.
1553 * Use PFNVBOXGETCAPIFUNCTIONS instead. */
1554typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
1555#endif /* !WIN32 */
1556
1557/** The symbol name of VBoxGetCAPIFunctions. */
1558#ifdef __OS2__
1559# define VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME "_VBoxGetCAPIFunctions"
1560#else /* !__OS2__ */
1561# define VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME "VBoxGetCAPIFunctions"
1562#endif /* !__OS2__ */
1563#ifndef WIN32
1564/** Backwards compatibility: The symbol name of VBoxGetXPCOMCFunctions.
1565 * Use VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME instead. */
1566# ifdef __OS2__
1567# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "_VBoxGetXPCOMCFunctions"
1568# else /* !__OS2__ */
1569# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "VBoxGetXPCOMCFunctions"
1570# endif /* !__OS2__ */
1571#endif /* !WIN32 */
1572
1573
1574#ifdef __cplusplus
1575}
1576#endif /* __cplusplus */
1577
1578#endif /* !___VirtualBox_CAPI_h */
1579</xsl:text>
1580</xsl:template>
1581
1582<!--
1583 * ignore all |if|s except those for XPIDL target
1584-->
1585<xsl:template match="if">
1586 <xsl:if test="@target='xpidl'">
1587 <xsl:apply-templates/>
1588 </xsl:if>
1589</xsl:template>
1590<xsl:template match="if" mode="forward">
1591 <xsl:if test="@target='xpidl'">
1592 <xsl:apply-templates mode="forward"/>
1593 </xsl:if>
1594</xsl:template>
1595<xsl:template match="if" mode="forwarder">
1596 <xsl:if test="@target='midl'">
1597 <xsl:apply-templates mode="forwarder"/>
1598 </xsl:if>
1599</xsl:template>
1600
1601
1602<!--
1603 * libraries
1604-->
1605<xsl:template match="library">
1606 <!-- result codes -->
1607 <xsl:text>&#x0A;</xsl:text>
1608 <xsl:for-each select="result">
1609 <xsl:apply-templates select="."/>
1610 </xsl:for-each>
1611 <xsl:text>&#x0A;&#x0A;</xsl:text>
1612 <!-- forward declarations -->
1613 <xsl:apply-templates select="interface | if/interface" mode="forward"/>
1614 <xsl:text>&#x0A;</xsl:text>
1615 <!-- typedef'ing the struct declarations -->
1616 <xsl:apply-templates select="interface | if/interface" mode="typedef"/>
1617 <xsl:text>&#x0A;</xsl:text>
1618 <!-- all enums go first -->
1619 <xsl:apply-templates select="enum | if/enum"/>
1620 <!-- everything else but result codes and enums -->
1621 <xsl:apply-templates select="*[not(self::result or self::enum) and
1622 not(self::if[result] or self::if[enum])]"/>
1623 <!-- -->
1624</xsl:template>
1625
1626
1627<!--
1628 * result codes
1629-->
1630<xsl:template match="result">
1631 <xsl:value-of select="concat('#define ',@name,' ',@value)"/>
1632 <xsl:text>&#x0A;</xsl:text>
1633</xsl:template>
1634
1635
1636<!--
1637 * forward declarations
1638-->
1639<xsl:template match="interface" mode="forward">
1640 <xsl:if test="not(@internal='yes')">
1641 <xsl:text>struct </xsl:text>
1642 <xsl:value-of select="@name"/>
1643 <xsl:text>;&#x0A;</xsl:text>
1644 </xsl:if>
1645</xsl:template>
1646
1647
1648<!--
1649 * typedef'ing the struct declarations
1650-->
1651<xsl:template match="interface" mode="typedef">
1652 <xsl:if test="not(@internal='yes')">
1653 <xsl:text>typedef struct </xsl:text>
1654 <xsl:value-of select="@name"/>
1655 <xsl:text> </xsl:text>
1656 <xsl:value-of select="@name"/>
1657 <xsl:text>;&#x0A;</xsl:text>
1658 </xsl:if>
1659</xsl:template>
1660
1661
1662<!--
1663 * COBJMACRO style convenience macros for calling methods
1664-->
1665<xsl:template match="interface" mode="cobjmacro">
1666 <xsl:param name="iface"/>
1667
1668 <xsl:variable name="extends" select="@extends"/>
1669 <xsl:choose>
1670 <xsl:when test="$extends='$unknown'">
1671 <xsl:text>#define </xsl:text>
1672 <xsl:value-of select="$iface"/>
1673 <xsl:text>_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))&#x0A;</xsl:text>
1674 <xsl:text>#define </xsl:text>
1675 <xsl:value-of select="$iface"/>
1676 <xsl:text>_AddRef(p) ((p)->lpVtbl->AddRef(p))&#x0A;</xsl:text>
1677 <xsl:text>#define </xsl:text>
1678 <xsl:value-of select="$iface"/>
1679 <xsl:text>_Release(p) ((p)->lpVtbl->Release(p))&#x0A;</xsl:text>
1680 </xsl:when>
1681 <xsl:when test="$extends='$errorinfo'">
1682 <xsl:text>#define </xsl:text>
1683 <xsl:value-of select="$iface"/>
1684 <xsl:text>_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))&#x0A;</xsl:text>
1685 <xsl:text>#define </xsl:text>
1686 <xsl:value-of select="$iface"/>
1687 <xsl:text>_AddRef(p) ((p)->lpVtbl->AddRef(p))&#x0A;</xsl:text>
1688 <xsl:text>#define </xsl:text>
1689 <xsl:value-of select="$iface"/>
1690 <xsl:text>_Release(p) ((p)->lpVtbl->Release(p))&#x0A;</xsl:text>
1691 <xsl:text>#define </xsl:text>
1692 <xsl:value-of select="$iface"/>
1693 <xsl:text>_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))&#x0A;</xsl:text>
1694 <xsl:text>#define </xsl:text>
1695 <xsl:value-of select="$iface"/>
1696 <xsl:text>_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))&#x0A;</xsl:text>
1697 <xsl:text>#define </xsl:text>
1698 <xsl:value-of select="$iface"/>
1699 <xsl:text>_get_Result(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))&#x0A;</xsl:text>
1700 <xsl:text>#define </xsl:text>
1701 <xsl:value-of select="$iface"/>
1702 <xsl:text>_GetResult(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))&#x0A;</xsl:text>
1703 <xsl:text>#define </xsl:text>
1704 <xsl:value-of select="$iface"/>
1705 <xsl:text>_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))&#x0A;</xsl:text>
1706 <xsl:text>#define </xsl:text>
1707 <xsl:value-of select="$iface"/>
1708 <xsl:text>_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))&#x0A;</xsl:text>
1709 <xsl:text>#define </xsl:text>
1710 <xsl:value-of select="$iface"/>
1711 <xsl:text>_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))&#x0A;</xsl:text>
1712 <xsl:text>#define </xsl:text>
1713 <xsl:value-of select="$iface"/>
1714 <xsl:text>_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))&#x0A;</xsl:text>
1715 <xsl:text>#define </xsl:text>
1716 <xsl:value-of select="$iface"/>
1717 <xsl:text>_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))&#x0A;</xsl:text>
1718 <xsl:text>#define </xsl:text>
1719 <xsl:value-of select="$iface"/>
1720 <xsl:text>_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))&#x0A;</xsl:text>
1721 <xsl:text>#define </xsl:text>
1722 <xsl:value-of select="$iface"/>
1723 <xsl:text>_get_ColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))&#x0A;</xsl:text>
1724 <xsl:text>#define </xsl:text>
1725 <xsl:value-of select="$iface"/>
1726 <xsl:text>_GetColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))&#x0A;</xsl:text>
1727 <xsl:text>#define </xsl:text>
1728 <xsl:value-of select="$iface"/>
1729 <xsl:text>_get_Location(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))&#x0A;</xsl:text>
1730 <xsl:text>#define </xsl:text>
1731 <xsl:value-of select="$iface"/>
1732 <xsl:text>_GetLocation(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))&#x0A;</xsl:text>
1733 <xsl:text>#define </xsl:text>
1734 <xsl:value-of select="$iface"/>
1735 <xsl:text>_get_Inner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))&#x0A;</xsl:text>
1736 <xsl:text>#define </xsl:text>
1737 <xsl:value-of select="$iface"/>
1738 <xsl:text>_GetInner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))&#x0A;</xsl:text>
1739 <xsl:text>#define </xsl:text>
1740 <xsl:value-of select="$iface"/>
1741 <xsl:text>_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))&#x0A;</xsl:text>
1742 <xsl:text>#define </xsl:text>
1743 <xsl:value-of select="$iface"/>
1744 <xsl:text>_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))&#x0A;</xsl:text>
1745 <xsl:text>#define </xsl:text>
1746 <xsl:value-of select="$iface"/>
1747 <xsl:text>_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))&#x0A;</xsl:text>
1748 </xsl:when>
1749 <xsl:otherwise>
1750 <xsl:apply-templates select="//interface[@name=$extends]" mode="cobjmacro">
1751 <xsl:with-param name="iface" select="$iface"/>
1752 </xsl:apply-templates>
1753 </xsl:otherwise>
1754 </xsl:choose>
1755 <!-- attributes (properties) -->
1756 <xsl:apply-templates select="attribute | if/attribute" mode="cobjmacro">
1757 <xsl:with-param name="iface" select="$iface"/>
1758 </xsl:apply-templates>
1759 <!-- methods -->
1760 <xsl:apply-templates select="method | if/method" mode="cobjmacro">
1761 <xsl:with-param name="iface" select="$iface"/>
1762 </xsl:apply-templates>
1763</xsl:template>
1764
1765
1766<!--
1767 * emit flat vtable, compatible with COM
1768-->
1769<xsl:template match="interface" mode="vtab_flat">
1770 <xsl:param name="iface"/>
1771
1772 <xsl:variable name="extends" select="@extends"/>
1773 <xsl:choose>
1774 <xsl:when test="$extends='$unknown'">
1775 <xsl:text> nsresult (*QueryInterface)(</xsl:text>
1776 <xsl:value-of select="$iface"/>
1777 <xsl:text> *pThis, const nsID *iid, void **resultp);&#x0A;</xsl:text>
1778 <xsl:text> nsrefcnt (*AddRef)(</xsl:text>
1779 <xsl:value-of select="$iface"/>
1780 <xsl:text> *pThis);&#x0A;</xsl:text>
1781 <xsl:text> nsrefcnt (*Release)(</xsl:text>
1782 <xsl:value-of select="$iface"/>
1783 <xsl:text> *pThis);&#x0A;</xsl:text>
1784 </xsl:when>
1785 <xsl:when test="$extends='$errorinfo'">
1786 <xsl:text> nsresult (*QueryInterface)(</xsl:text>
1787 <xsl:value-of select="$iface"/>
1788 <xsl:text> *pThis, const nsID *iid, void **resultp);&#x0A;</xsl:text>
1789 <xsl:text> nsrefcnt (*AddRef)(</xsl:text>
1790 <xsl:value-of select="$iface"/>
1791 <xsl:text> *pThis);&#x0A;</xsl:text>
1792 <xsl:text> nsrefcnt (*Release)(</xsl:text>
1793 <xsl:value-of select="$iface"/>
1794 <xsl:text> *pThis);&#x0A;</xsl:text>
1795 <xsl:text> nsresult (*GetMessage)(</xsl:text>
1796 <xsl:value-of select="$iface"/>
1797 <xsl:text> *pThis, PRUnichar * *aMessage);&#x0A;</xsl:text>
1798 <xsl:text> nsresult (*GetResult)(</xsl:text>
1799 <xsl:value-of select="$iface"/>
1800 <xsl:text> *pThis, nsresult *aResult);&#x0A;</xsl:text>
1801 <xsl:text> nsresult (*GetName)(</xsl:text>
1802 <xsl:value-of select="$iface"/>
1803 <xsl:text>*pThis, PRUnichar * *aName);&#x0A;</xsl:text>
1804 <xsl:text> nsresult (*GetFilename)(</xsl:text>
1805 <xsl:value-of select="$iface"/>
1806 <xsl:text> *pThis, PRUnichar * *aFilename);&#x0A;</xsl:text>
1807 <xsl:text> nsresult (*GetLineNumber)(</xsl:text>
1808 <xsl:value-of select="$iface"/>
1809 <xsl:text> *pThis, PRUint32 *aLineNumber);&#x0A;</xsl:text>
1810 <xsl:text> nsresult (*GetColumnNumber)(</xsl:text>
1811 <xsl:value-of select="$iface"/>
1812 <xsl:text> *pThis, PRUint32 *aColumnNumber);&#x0A;</xsl:text>
1813 <xsl:text> nsresult (*GetLocation)(</xsl:text>
1814 <xsl:value-of select="$iface"/>
1815 <xsl:text> *pThis, nsIStackFrame * *aLocation);&#x0A;</xsl:text>
1816 <xsl:text> nsresult (*GetInner)(</xsl:text>
1817 <xsl:value-of select="$iface"/>
1818 <xsl:text> *pThis, nsIException * *aInner);&#x0A;</xsl:text>
1819 <xsl:text> nsresult (*GetData)(</xsl:text>
1820 <xsl:value-of select="$iface"/>
1821 <xsl:text> *pThis, nsISupports * *aData);&#x0A;</xsl:text>
1822 <xsl:text> nsresult (*ToString)(</xsl:text>
1823 <xsl:value-of select="$iface"/>
1824 <xsl:text> *pThis, PRUnichar **_retval);&#x0A;</xsl:text>
1825 </xsl:when>
1826 <xsl:otherwise>
1827 <xsl:apply-templates select="//interface[@name=$extends]" mode="vtab_flat">
1828 <xsl:with-param name="iface" select="$iface"/>
1829 </xsl:apply-templates>
1830 </xsl:otherwise>
1831 </xsl:choose>
1832 <!-- attributes (properties) -->
1833 <xsl:apply-templates select="attribute | if/attribute">
1834 <xsl:with-param name="iface" select="$iface"/>
1835 </xsl:apply-templates>
1836 <!-- methods -->
1837 <xsl:apply-templates select="method | if/method">
1838 <xsl:with-param name="iface" select="$iface"/>
1839 </xsl:apply-templates>
1840</xsl:template>
1841
1842
1843<!--
1844 * interfaces
1845-->
1846<xsl:template match="interface">
1847 <xsl:if test="not(@internal='yes')">
1848 <xsl:text>/* Start of struct </xsl:text>
1849 <xsl:value-of select="@name"/>
1850 <xsl:text> declaration */&#x0A;</xsl:text>
1851 <xsl:text>#define </xsl:text>
1852 <xsl:call-template name="uppercase">
1853 <xsl:with-param name="str" select="@name"/>
1854 </xsl:call-template>
1855 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
1856 <xsl:text>&#x0A;</xsl:text>
1857 <xsl:text>#define </xsl:text>
1858 <xsl:call-template name="uppercase">
1859 <xsl:with-param name="str" select="@name"/>
1860 </xsl:call-template>
1861 <xsl:text>_IID { \&#x0A;</xsl:text>
1862 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
1863 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
1864 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
1865 <xsl:text>, \&#x0A; </xsl:text>
1866 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
1867 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
1868 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
1869 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
1870 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
1871 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
1872 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
1873 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
1874 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
1875 <xsl:text>/* COM compatibility */&#x0A;</xsl:text>
1876 <xsl:text>VBOX_EXTERN_CONST(nsIID, IID_</xsl:text>
1877 <xsl:value-of select="@name"/>
1878 <xsl:text>);&#x0A;</xsl:text>
1879 <xsl:text>#ifndef VBOX_WITH_GLUE&#x0A;</xsl:text>
1880 <xsl:text>struct </xsl:text>
1881 <xsl:value-of select="@name"/>
1882 <xsl:text>_vtbl&#x0A;{&#x0A;</xsl:text>
1883 <xsl:text> </xsl:text>
1884 <xsl:choose>
1885 <xsl:when test="@extends='$unknown'">struct nsISupports_vtbl nsisupports;</xsl:when>
1886 <xsl:when test="@extends='$errorinfo'">struct nsIException_vtbl nsiexception;</xsl:when>
1887 <xsl:otherwise>
1888 <xsl:text>struct </xsl:text>
1889 <xsl:value-of select="@extends"/>
1890 <xsl:text>_vtbl </xsl:text>
1891 <xsl:call-template name="lowercase">
1892 <xsl:with-param name="str" select="@extends"/>
1893 </xsl:call-template>
1894 <xsl:text>;</xsl:text>
1895 </xsl:otherwise>
1896 </xsl:choose>
1897 <xsl:text>&#x0A;&#x0A;</xsl:text>
1898 <!-- attributes (properties) -->
1899 <xsl:apply-templates select="attribute | if/attribute"/>
1900 <!-- methods -->
1901 <xsl:apply-templates select="method | if/method"/>
1902 <!-- -->
1903 <xsl:text>};&#x0A;</xsl:text>
1904 <xsl:text>#else /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1905 <xsl:text>struct </xsl:text>
1906 <xsl:value-of select="@name"/>
1907 <xsl:text>Vtbl&#x0A;{&#x0A;</xsl:text>
1908 <xsl:apply-templates select="." mode="vtab_flat">
1909 <xsl:with-param name="iface" select="@name"/>
1910 </xsl:apply-templates>
1911 <xsl:text>};&#x0A;</xsl:text>
1912 <xsl:apply-templates select="." mode="cobjmacro">
1913 <xsl:with-param name="iface" select="@name"/>
1914 </xsl:apply-templates>
1915 <!-- -->
1916 <xsl:text>#endif /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1917 <xsl:text>&#x0A;</xsl:text>
1918 <xsl:text>struct </xsl:text>
1919 <xsl:value-of select="@name"/>
1920 <xsl:text>&#x0A;{&#x0A;</xsl:text>
1921 <xsl:text>#ifndef VBOX_WITH_GLUE&#x0A;</xsl:text>
1922 <xsl:text> struct </xsl:text>
1923 <xsl:value-of select="@name"/>
1924 <xsl:text>_vtbl *vtbl;&#x0A;</xsl:text>
1925 <xsl:text>#else /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1926 <xsl:text> struct </xsl:text>
1927 <xsl:value-of select="@name"/>
1928 <xsl:text>Vtbl *lpVtbl;&#x0A;</xsl:text>
1929 <xsl:text>#endif /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1930 <xsl:text>};&#x0A;</xsl:text>
1931 <xsl:text>/* End of struct </xsl:text>
1932 <xsl:value-of select="@name"/>
1933 <xsl:text> declaration */&#x0A;&#x0A;&#x0A;</xsl:text>
1934 </xsl:if>
1935</xsl:template>
1936
1937
1938<!--
1939 * attributes
1940-->
1941<xsl:template match="attribute">
1942 <xsl:param name="iface" select="ancestor::interface/@name"/>
1943
1944 <xsl:choose>
1945 <!-- safearray pseudo attribute -->
1946 <xsl:when test="@safearray='yes'">
1947 <!-- getter -->
1948 <xsl:text> nsresult (*Get</xsl:text>
1949 <xsl:call-template name="capitalize">
1950 <xsl:with-param name="str" select="@name"/>
1951 </xsl:call-template>
1952 <xsl:text>)(</xsl:text>
1953 <xsl:value-of select="$iface" />
1954 <xsl:text> *pThis, </xsl:text>
1955 <!-- array size -->
1956 <xsl:text>PRUint32 *</xsl:text>
1957 <xsl:value-of select="@name"/>
1958 <xsl:text>Size, </xsl:text>
1959 <!-- array pointer -->
1960 <xsl:apply-templates select="@type" mode="forwarder"/>
1961 <xsl:text> **</xsl:text>
1962 <xsl:value-of select="@name"/>
1963 <xsl:text>);&#x0A;</xsl:text>
1964 <!-- setter -->
1965 <xsl:if test="not(@readonly='yes')">
1966 <xsl:text> nsresult (*Set</xsl:text>
1967 <xsl:call-template name="capitalize">
1968 <xsl:with-param name="str" select="@name"/>
1969 </xsl:call-template>
1970 <xsl:text>)(</xsl:text>
1971 <xsl:value-of select="$iface" />
1972 <xsl:text> *pThis, </xsl:text>
1973 <!-- array size -->
1974 <xsl:text>PRUint32 </xsl:text>
1975 <xsl:value-of select="@name"/>
1976 <xsl:text>Size, </xsl:text>
1977 <!-- array pointer -->
1978 <xsl:apply-templates select="@type" mode="forwarder"/>
1979 <xsl:text> *</xsl:text>
1980 <xsl:value-of select="@name"/>
1981 <xsl:text>);&#x0A;</xsl:text>
1982 </xsl:if>
1983 </xsl:when>
1984 <!-- normal attribute -->
1985 <xsl:otherwise>
1986 <xsl:text> </xsl:text>
1987 <xsl:if test="@readonly='yes'">
1988 <xsl:text>nsresult (*Get</xsl:text>
1989 <xsl:call-template name="capitalize">
1990 <xsl:with-param name="str" select="@name"/>
1991 </xsl:call-template>
1992 <xsl:text>)(</xsl:text>
1993 <xsl:value-of select="$iface" />
1994 <xsl:text> *pThis, </xsl:text>
1995 <xsl:apply-templates select="@type" mode="forwarder"/>
1996 <xsl:text> *</xsl:text>
1997 <xsl:value-of select="@name"/>
1998 <xsl:text>);&#x0A;</xsl:text>
1999 </xsl:if>
2000 <xsl:choose>
2001 <xsl:when test="@readonly='yes'">
2002 </xsl:when>
2003 <xsl:otherwise>
2004 <xsl:text>nsresult (*Get</xsl:text>
2005 <xsl:call-template name="capitalize">
2006 <xsl:with-param name="str" select="@name"/>
2007 </xsl:call-template>
2008 <xsl:text>)(</xsl:text>
2009 <xsl:value-of select="$iface" />
2010 <xsl:text> *pThis, </xsl:text>
2011 <xsl:apply-templates select="@type" mode="forwarder"/>
2012 <xsl:text> *</xsl:text>
2013 <xsl:value-of select="@name"/>
2014 <xsl:text>);&#x0A; </xsl:text>
2015 <xsl:text>nsresult (*Set</xsl:text>
2016 <xsl:call-template name="capitalize">
2017 <xsl:with-param name="str" select="@name"/>
2018 </xsl:call-template>
2019 <xsl:text>)(</xsl:text>
2020 <xsl:value-of select="$iface" />
2021 <xsl:text> *pThis, </xsl:text>
2022 <xsl:apply-templates select="@type" mode="forwarder"/>
2023 <xsl:text> </xsl:text>
2024 <xsl:value-of select="@name"/>
2025 <xsl:text>);&#x0A;</xsl:text>
2026 </xsl:otherwise>
2027 </xsl:choose>
2028 </xsl:otherwise>
2029 </xsl:choose>
2030 <xsl:text>&#x0A;</xsl:text>
2031</xsl:template>
2032
2033<xsl:template match="attribute" mode="cobjmacro">
2034 <xsl:param name="iface"/>
2035
2036 <!-- getter (COM compatible) -->
2037 <xsl:text>#define </xsl:text>
2038 <xsl:value-of select="concat($iface, '_get_')"/>
2039 <xsl:call-template name="capitalize">
2040 <xsl:with-param name="str" select="@name"/>
2041 </xsl:call-template>
2042 <xsl:text>(p, a</xsl:text>
2043 <xsl:call-template name="capitalize">
2044 <xsl:with-param name="str" select="@name"/>
2045 </xsl:call-template>
2046 <xsl:text>) ((p)->lpVtbl->Get</xsl:text>
2047 <xsl:call-template name="capitalize">
2048 <xsl:with-param name="str" select="@name"/>
2049 </xsl:call-template>
2050 <xsl:text>(p, a</xsl:text>
2051 <xsl:call-template name="capitalize">
2052 <xsl:with-param name="str" select="@name"/>
2053 </xsl:call-template>
2054 <xsl:text>))&#x0A;</xsl:text>
2055
2056 <!-- getter (XPCOM compatible) -->
2057 <xsl:text>#define </xsl:text>
2058 <xsl:value-of select="concat($iface, '_Get')"/>
2059 <xsl:call-template name="capitalize">
2060 <xsl:with-param name="str" select="@name"/>
2061 </xsl:call-template>
2062 <xsl:text>(p, a</xsl:text>
2063 <xsl:call-template name="capitalize">
2064 <xsl:with-param name="str" select="@name"/>
2065 </xsl:call-template>
2066 <xsl:text>) ((p)->lpVtbl->Get</xsl:text>
2067 <xsl:call-template name="capitalize">
2068 <xsl:with-param name="str" select="@name"/>
2069 </xsl:call-template>
2070 <xsl:text>(p, a</xsl:text>
2071 <xsl:call-template name="capitalize">
2072 <xsl:with-param name="str" select="@name"/>
2073 </xsl:call-template>
2074 <xsl:text>))&#x0A;</xsl:text>
2075
2076 <xsl:if test="not(@readonly='yes')">
2077 <!-- setter (COM compatible) -->
2078 <xsl:text>#define </xsl:text>
2079 <xsl:value-of select="concat($iface, '_set_')"/>
2080 <xsl:call-template name="capitalize">
2081 <xsl:with-param name="str" select="@name"/>
2082 </xsl:call-template>
2083 <xsl:text>(p, a</xsl:text>
2084 <xsl:call-template name="capitalize">
2085 <xsl:with-param name="str" select="@name"/>
2086 </xsl:call-template>
2087 <xsl:text>) ((p)->lpVtbl->Set</xsl:text>
2088 <xsl:call-template name="capitalize">
2089 <xsl:with-param name="str" select="@name"/>
2090 </xsl:call-template>
2091 <xsl:text>(p, a</xsl:text>
2092 <xsl:call-template name="capitalize">
2093 <xsl:with-param name="str" select="@name"/>
2094 </xsl:call-template>
2095 <xsl:text>))&#x0A;</xsl:text>
2096
2097 <!-- setter (XPCOM compatible) -->
2098 <xsl:text>#define </xsl:text>
2099 <xsl:value-of select="concat($iface, '_Set')"/>
2100 <xsl:call-template name="capitalize">
2101 <xsl:with-param name="str" select="@name"/>
2102 </xsl:call-template>
2103 <xsl:text>(p, a</xsl:text>
2104 <xsl:call-template name="capitalize">
2105 <xsl:with-param name="str" select="@name"/>
2106 </xsl:call-template>
2107 <xsl:text>) ((p)->lpVtbl->Set</xsl:text>
2108 <xsl:call-template name="capitalize">
2109 <xsl:with-param name="str" select="@name"/>
2110 </xsl:call-template>
2111 <xsl:text>(p, a</xsl:text>
2112 <xsl:call-template name="capitalize">
2113 <xsl:with-param name="str" select="@name"/>
2114 </xsl:call-template>
2115 <xsl:text>))&#x0A;</xsl:text>
2116
2117 </xsl:if>
2118</xsl:template>
2119
2120<!--
2121 * methods
2122-->
2123<xsl:template match="method">
2124 <xsl:param name="iface" select="ancestor::interface/@name"/>
2125
2126 <xsl:if test="param/@mod='ptr'">
2127 <!-- methods using native types must be non-scriptable
2128 <xsl:text> [noscript]&#x0A;</xsl:text>-->
2129 </xsl:if>
2130 <xsl:text> nsresult (*</xsl:text>
2131 <xsl:call-template name="capitalize">
2132 <xsl:with-param name="str" select="@name"/>
2133 </xsl:call-template>
2134 <xsl:if test="param">
2135 <xsl:text>)(&#x0A;</xsl:text>
2136 <xsl:text> </xsl:text>
2137 <xsl:value-of select="$iface" />
2138 <xsl:text> *pThis,&#x0A;</xsl:text>
2139 <xsl:for-each select="param [position() != last()]">
2140 <xsl:text> </xsl:text>
2141 <xsl:apply-templates select="."/>
2142 <xsl:text>,&#x0A;</xsl:text>
2143 </xsl:for-each>
2144 <xsl:text> </xsl:text>
2145 <xsl:apply-templates select="param [last()]"/>
2146 <xsl:text>&#x0A; );&#x0A;</xsl:text>
2147 </xsl:if>
2148 <xsl:if test="not(param)">
2149 <xsl:text>)(</xsl:text>
2150 <xsl:value-of select="$iface" />
2151 <xsl:text> *pThis );&#x0A;</xsl:text>
2152 </xsl:if>
2153 <xsl:text>&#x0A;</xsl:text>
2154</xsl:template>
2155
2156<xsl:template match="method" mode="cobjmacro">
2157 <xsl:param name="iface"/>
2158
2159 <xsl:text>#define </xsl:text>
2160 <xsl:value-of select="concat($iface, '_')"/>
2161 <xsl:call-template name="capitalize">
2162 <xsl:with-param name="str" select="@name"/>
2163 </xsl:call-template>
2164 <xsl:text>(p</xsl:text>
2165 <xsl:for-each select="param">
2166 <xsl:text>, a</xsl:text>
2167 <xsl:call-template name="capitalize">
2168 <xsl:with-param name="str" select="@name"/>
2169 </xsl:call-template>
2170 </xsl:for-each>
2171 <xsl:text>) ((p)->lpVtbl-></xsl:text>
2172 <xsl:call-template name="capitalize">
2173 <xsl:with-param name="str" select="@name"/>
2174 </xsl:call-template>
2175 <xsl:text>(p</xsl:text>
2176 <xsl:for-each select="param">
2177 <xsl:text>, a</xsl:text>
2178 <xsl:call-template name="capitalize">
2179 <xsl:with-param name="str" select="@name"/>
2180 </xsl:call-template>
2181 </xsl:for-each>
2182 <xsl:text>))&#x0A;</xsl:text>
2183</xsl:template>
2184
2185
2186<!--
2187 * modules
2188-->
2189<xsl:template match="module">
2190 <xsl:apply-templates select="class"/>
2191</xsl:template>
2192
2193
2194<!--
2195 * co-classes
2196-->
2197<xsl:template match="module/class">
2198 <!-- class and contract id -->
2199 <xsl:text>&#x0A;</xsl:text>
2200 <xsl:text>#define NS_</xsl:text>
2201 <xsl:call-template name="uppercase">
2202 <xsl:with-param name="str" select="@name"/>
2203 </xsl:call-template>
2204 <xsl:text>_CID { \&#x0A;</xsl:text>
2205 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
2206 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
2207 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
2208 <xsl:text>, \&#x0A; </xsl:text>
2209 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
2210 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
2211 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
2212 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
2213 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
2214 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
2215 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
2216 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
2217 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
2218 <xsl:text>#define NS_</xsl:text>
2219 <xsl:call-template name="uppercase">
2220 <xsl:with-param name="str" select="@name"/>
2221 </xsl:call-template>
2222 <!-- Contract ID -->
2223 <xsl:text>_CONTRACTID &quot;@</xsl:text>
2224 <xsl:value-of select="@namespace"/>
2225 <xsl:text>/</xsl:text>
2226 <xsl:value-of select="@name"/>
2227 <xsl:text>;1&quot;&#x0A;</xsl:text>
2228 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32 -->
2229 <xsl:text>/* COM compatibility */&#x0A;</xsl:text>
2230 <xsl:text>VBOX_EXTERN_CONST(nsCID, CLSID_</xsl:text>
2231 <xsl:value-of select="@name"/>
2232 <xsl:text>);&#x0A;</xsl:text>
2233 <xsl:text>&#x0A;&#x0A;</xsl:text>
2234</xsl:template>
2235
2236
2237<!--
2238 * enums
2239-->
2240<xsl:template match="enum">
2241 <xsl:text>/* Start of enum </xsl:text>
2242 <xsl:value-of select="@name"/>
2243 <xsl:text> declaration */&#x0A;</xsl:text>
2244 <xsl:text>#define </xsl:text>
2245 <xsl:call-template name="uppercase">
2246 <xsl:with-param name="str" select="@name"/>
2247 </xsl:call-template>
2248 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
2249 <xsl:text>&#x0A;</xsl:text>
2250 <xsl:text>#define </xsl:text>
2251 <xsl:call-template name="uppercase">
2252 <xsl:with-param name="str" select="@name"/>
2253 </xsl:call-template>
2254 <xsl:text>_IID { \&#x0A;</xsl:text>
2255 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
2256 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
2257 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
2258 <xsl:text>, \&#x0A; </xsl:text>
2259 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
2260 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
2261 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
2262 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
2263 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
2264 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
2265 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
2266 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
2267 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
2268 <xsl:text>enum </xsl:text>
2269 <xsl:value-of select="@name"/>
2270 <xsl:text>&#x0A;{&#x0A;</xsl:text>
2271 <xsl:variable name="this" select="."/>
2272 <xsl:for-each select="const">
2273 <xsl:text> </xsl:text>
2274 <xsl:value-of select="$this/@name"/>
2275 <xsl:text>_</xsl:text>
2276 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
2277 <xsl:if test="position() != last()">
2278 <xsl:text>,</xsl:text>
2279 </xsl:if>
2280 <xsl:text>&#x0A;</xsl:text>
2281 </xsl:for-each>
2282 <xsl:text>};&#x0A;</xsl:text>
2283 <xsl:text>/* End of enum </xsl:text>
2284 <xsl:value-of select="@name"/>
2285 <xsl:text> declaration */
2286#define </xsl:text>
2287 <xsl:value-of select="concat(@name, '_T PRUint32&#x0A;&#x0A;&#x0A;')"/>
2288</xsl:template>
2289
2290
2291<!--
2292 * method parameters
2293-->
2294<xsl:template match="method/param">
2295 <xsl:choose>
2296 <!-- safearray parameters -->
2297 <xsl:when test="@safearray='yes'">
2298 <!-- array size -->
2299 <xsl:choose>
2300 <xsl:when test="@dir='in'">
2301 <xsl:text>PRUint32 </xsl:text>
2302 <xsl:value-of select="@name"/>
2303 <xsl:text>Size,&#x0A;</xsl:text>
2304 </xsl:when>
2305 <xsl:when test="@dir='out'">
2306 <xsl:text>PRUint32 *</xsl:text>
2307 <xsl:value-of select="@name"/>
2308 <xsl:text>Size,&#x0A;</xsl:text>
2309 </xsl:when>
2310 <xsl:when test="@dir='return'">
2311 <xsl:text>PRUint32 *</xsl:text>
2312 <xsl:value-of select="@name"/>
2313 <xsl:text>Size,&#x0A;</xsl:text>
2314 </xsl:when>
2315 <xsl:otherwise>
2316 <xsl:text>PRUint32 </xsl:text>
2317 <xsl:value-of select="@name"/>
2318 <xsl:text>Size,&#x0A;</xsl:text>
2319 </xsl:otherwise>
2320 </xsl:choose>
2321 <!-- array pointer -->
2322 <xsl:text> </xsl:text>
2323 <xsl:choose>
2324 <xsl:when test="@dir='in'">
2325 <xsl:apply-templates select="@type" mode="forwarder"/>
2326 <xsl:text>*</xsl:text>
2327 </xsl:when>
2328 <xsl:when test="@dir='out'">
2329 <xsl:apply-templates select="@type" mode="forwarder"/>
2330 <xsl:text>**</xsl:text>
2331 </xsl:when>
2332 <xsl:when test="@dir='return'">
2333 <xsl:apply-templates select="@type" mode="forwarder"/>
2334 <xsl:text>**</xsl:text>
2335 </xsl:when>
2336 <xsl:otherwise>
2337 <xsl:apply-templates select="@type" mode="forwarder"/>
2338 <xsl:text>*</xsl:text>
2339 </xsl:otherwise>
2340 </xsl:choose>
2341 <xsl:text> </xsl:text>
2342 <xsl:value-of select="@name"/>
2343 </xsl:when>
2344 <!-- normal and array parameters -->
2345 <xsl:otherwise>
2346 <xsl:choose>
2347 <xsl:when test="@dir='in'">
2348 <xsl:apply-templates select="@type" mode="forwarder"/>
2349 <xsl:text></xsl:text>
2350 </xsl:when>
2351 <xsl:when test="@dir='out'">
2352 <xsl:apply-templates select="@type" mode="forwarder"/>
2353 <xsl:text> *</xsl:text>
2354 </xsl:when>
2355 <xsl:when test="@dir='return'">
2356 <xsl:apply-templates select="@type" mode="forwarder"/>
2357 <xsl:text> *</xsl:text>
2358 </xsl:when>
2359 <xsl:otherwise>
2360 <xsl:apply-templates select="@type" mode="forwarder"/>
2361 <xsl:text></xsl:text>
2362 </xsl:otherwise>
2363 </xsl:choose>
2364 <xsl:text> </xsl:text>
2365 <xsl:value-of select="@name"/>
2366 </xsl:otherwise>
2367 </xsl:choose>
2368</xsl:template>
2369
2370<xsl:template match="method/param" mode="forwarder">
2371 <xsl:if test="@safearray='yes'">
2372 <xsl:text>PRUint32</xsl:text>
2373 <xsl:if test="@dir='out' or @dir='return'">
2374 <xsl:text> *</xsl:text>
2375 </xsl:if>
2376 <xsl:text> a</xsl:text>
2377 <xsl:call-template name="capitalize">
2378 <xsl:with-param name="str" select="@name"/>
2379 </xsl:call-template>
2380 <xsl:text>Size, </xsl:text>
2381 </xsl:if>
2382 <xsl:apply-templates select="@type" mode="forwarder"/>
2383 <xsl:if test="@dir='out' or @dir='return'">
2384 <xsl:text> *</xsl:text>
2385 </xsl:if>
2386 <xsl:if test="@safearray='yes'">
2387 <xsl:text> *</xsl:text>
2388 </xsl:if>
2389 <xsl:text> a</xsl:text>
2390 <xsl:call-template name="capitalize">
2391 <xsl:with-param name="str" select="@name"/>
2392 </xsl:call-template>
2393</xsl:template>
2394
2395
2396<!--
2397 * attribute/parameter type conversion
2398-->
2399<xsl:template match="attribute/@type | param/@type">
2400 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
2401
2402 <xsl:choose>
2403 <!-- modifiers (ignored for 'enumeration' attributes)-->
2404 <xsl:when test="name(current())='type' and ../@mod">
2405 <xsl:choose>
2406 <xsl:when test="../@mod='ptr'">
2407 <xsl:choose>
2408 <!-- standard types -->
2409 <!--xsl:when test=".='result'">??</xsl:when-->
2410 <xsl:when test=".='boolean'">booleanPtr</xsl:when>
2411 <xsl:when test=".='octet'">octetPtr</xsl:when>
2412 <xsl:when test=".='short'">shortPtr</xsl:when>
2413 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
2414 <xsl:when test=".='long'">longPtr</xsl:when>
2415 <xsl:when test=".='long long'">llongPtr</xsl:when>
2416 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
2417 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
2418 <xsl:otherwise>
2419 <xsl:message terminate="yes">
2420 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2421 <xsl:text>attribute 'mod=</xsl:text>
2422 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2423 <xsl:text>' cannot be used with type </xsl:text>
2424 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2425 </xsl:message>
2426 </xsl:otherwise>
2427 </xsl:choose>
2428 </xsl:when>
2429 <xsl:when test="../@mod='string'">
2430 <xsl:choose>
2431 <!-- standard types -->
2432 <!--xsl:when test=".='result'">??</xsl:when-->
2433 <xsl:when test=".='uuid'">wstring</xsl:when>
2434 <xsl:otherwise>
2435 <xsl:message terminate="yes">
2436 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2437 <xsl:text>attribute 'mod=</xsl:text>
2438 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2439 <xsl:text>' cannot be used with type </xsl:text>
2440 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2441 </xsl:message>
2442 </xsl:otherwise>
2443 </xsl:choose>
2444 </xsl:when>
2445 <xsl:otherwise>
2446 <xsl:message terminate="yes">
2447 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2448 <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
2449 <xsl:text>of attribute 'mod' is invalid!</xsl:text>
2450 </xsl:message>
2451 </xsl:otherwise>
2452 </xsl:choose>
2453 </xsl:when>
2454 <!-- no modifiers -->
2455 <xsl:otherwise>
2456 <xsl:choose>
2457 <!-- standard types -->
2458 <xsl:when test=".='result'">nsresult</xsl:when>
2459 <xsl:when test=".='boolean'">boolean</xsl:when>
2460 <xsl:when test=".='octet'">octet</xsl:when>
2461 <xsl:when test=".='short'">short</xsl:when>
2462 <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
2463 <xsl:when test=".='long'">long</xsl:when>
2464 <xsl:when test=".='long long'">long long</xsl:when>
2465 <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
2466 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
2467 <xsl:when test=".='char'">char</xsl:when>
2468 <xsl:when test=".='wchar'">wchar</xsl:when>
2469 <xsl:when test=".='string'">string</xsl:when>
2470 <xsl:when test=".='wstring'">wstring</xsl:when>
2471 <!-- UUID type -->
2472 <xsl:when test=".='uuid'">
2473 <xsl:choose>
2474 <xsl:when test="name(..)='attribute'">
2475 <xsl:choose>
2476 <xsl:when test="../@readonly='yes'">
2477 <xsl:text>nsIDPtr</xsl:text>
2478 </xsl:when>
2479 <xsl:otherwise>
2480 <xsl:message terminate="yes">
2481 <xsl:value-of select="../@name"/>
2482 <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
2483 </xsl:message>
2484 </xsl:otherwise>
2485 </xsl:choose>
2486 </xsl:when>
2487 <xsl:when test="name(..)='param'">
2488 <xsl:choose>
2489 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
2490 <xsl:text>nsIDRef</xsl:text>
2491 </xsl:when>
2492 <xsl:otherwise>
2493 <xsl:text>nsIDPtr</xsl:text>
2494 </xsl:otherwise>
2495 </xsl:choose>
2496 </xsl:when>
2497 </xsl:choose>
2498 </xsl:when>
2499 <!-- system interface types -->
2500 <xsl:when test=".='$unknown'">nsISupports</xsl:when>
2501 <xsl:otherwise>
2502 <xsl:choose>
2503 <!-- enum types -->
2504 <xsl:when test="
2505 (ancestor::library/enum[@name=current()]) or
2506 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
2507 ">
2508 <xsl:text>PRUint32</xsl:text>
2509 </xsl:when>
2510 <!-- custom interface types -->
2511 <xsl:when test="
2512 (name(current())='enumerator' and
2513 ((ancestor::library/enumerator[@name=current()]) or
2514 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
2515 ) or
2516 ((ancestor::library/interface[@name=current()]) or
2517 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
2518 )
2519 ">
2520 <xsl:value-of select="."/>
2521 </xsl:when>
2522 <!-- other types -->
2523 <xsl:otherwise>
2524 <xsl:message terminate="yes">
2525 <xsl:text>Unknown parameter type: </xsl:text>
2526 <xsl:value-of select="."/>
2527 </xsl:message>
2528 </xsl:otherwise>
2529 </xsl:choose>
2530 </xsl:otherwise>
2531 </xsl:choose>
2532 </xsl:otherwise>
2533 </xsl:choose>
2534</xsl:template>
2535
2536<xsl:template match="attribute/@type | param/@type" mode="forwarder">
2537
2538 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
2539
2540 <xsl:choose>
2541 <!-- modifiers (ignored for 'enumeration' attributes)-->
2542 <xsl:when test="name(current())='type' and ../@mod">
2543 <xsl:choose>
2544 <xsl:when test="../@mod='ptr'">
2545 <xsl:choose>
2546 <!-- standard types -->
2547 <!--xsl:when test=".='result'">??</xsl:when-->
2548 <xsl:when test=".='boolean'">PRBool *</xsl:when>
2549 <xsl:when test=".='octet'">PRUint8 *</xsl:when>
2550 <xsl:when test=".='short'">PRInt16 *</xsl:when>
2551 <xsl:when test=".='unsigned short'">PRUint16 *</xsl:when>
2552 <xsl:when test=".='long'">PRInt32 *</xsl:when>
2553 <xsl:when test=".='long long'">PRInt64 *</xsl:when>
2554 <xsl:when test=".='unsigned long'">PRUint32 *</xsl:when>
2555 <xsl:when test=".='unsigned long long'">PRUint64 *</xsl:when>
2556 <xsl:otherwise>
2557 <xsl:message terminate="yes">
2558 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2559 <xsl:text>attribute 'mod=</xsl:text>
2560 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2561 <xsl:text>' cannot be used with type </xsl:text>
2562 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2563 </xsl:message>
2564 </xsl:otherwise>
2565 </xsl:choose>
2566 </xsl:when>
2567 <xsl:when test="../@mod='string'">
2568 <xsl:choose>
2569 <!-- standard types -->
2570 <!--xsl:when test=".='result'">??</xsl:when-->
2571 <xsl:when test=".='uuid'">PRUnichar *</xsl:when>
2572 <xsl:otherwise>
2573 <xsl:message terminate="yes">
2574 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2575 <xsl:text>attribute 'mod=</xsl:text>
2576 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2577 <xsl:text>' cannot be used with type </xsl:text>
2578 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2579 </xsl:message>
2580 </xsl:otherwise>
2581 </xsl:choose>
2582 </xsl:when>
2583 </xsl:choose>
2584 </xsl:when>
2585 <!-- no modifiers -->
2586 <xsl:otherwise>
2587 <xsl:choose>
2588 <!-- standard types -->
2589 <xsl:when test=".='result'">nsresult</xsl:when>
2590 <xsl:when test=".='boolean'">PRBool</xsl:when>
2591 <xsl:when test=".='octet'">PRUint8</xsl:when>
2592 <xsl:when test=".='short'">PRInt16</xsl:when>
2593 <xsl:when test=".='unsigned short'">PRUint16</xsl:when>
2594 <xsl:when test=".='long'">PRInt32</xsl:when>
2595 <xsl:when test=".='long long'">PRInt64</xsl:when>
2596 <xsl:when test=".='unsigned long'">PRUint32</xsl:when>
2597 <xsl:when test=".='unsigned long long'">PRUint64</xsl:when>
2598 <xsl:when test=".='char'">char</xsl:when>
2599 <xsl:when test=".='wchar'">PRUnichar</xsl:when>
2600 <!-- string types -->
2601 <xsl:when test=".='string'">char *</xsl:when>
2602 <xsl:when test=".='wstring'">PRUnichar *</xsl:when>
2603 <!-- UUID type -->
2604 <xsl:when test=".='uuid'">
2605 <xsl:choose>
2606 <xsl:when test="name(..)='attribute'">
2607 <xsl:choose>
2608 <xsl:when test="../@readonly='yes'">
2609 <xsl:text>nsID *</xsl:text>
2610 </xsl:when>
2611 </xsl:choose>
2612 </xsl:when>
2613 <xsl:when test="name(..)='param'">
2614 <xsl:choose>
2615 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
2616 <xsl:text>const nsID *</xsl:text>
2617 </xsl:when>
2618 <xsl:otherwise>
2619 <xsl:text>nsID *</xsl:text>
2620 </xsl:otherwise>
2621 </xsl:choose>
2622 </xsl:when>
2623 </xsl:choose>
2624 </xsl:when>
2625 <!-- system interface types -->
2626 <xsl:when test=".='$unknown'">nsISupports *</xsl:when>
2627 <xsl:otherwise>
2628 <xsl:choose>
2629 <!-- enum types -->
2630 <xsl:when test="
2631 (ancestor::library/enum[@name=current()]) or
2632 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
2633 ">
2634 <xsl:text>PRUint32</xsl:text>
2635 </xsl:when>
2636 <!-- custom interface types -->
2637 <xsl:when test="
2638 (name(current())='enumerator' and
2639 ((ancestor::library/enumerator[@name=current()]) or
2640 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
2641 ) or
2642 ((ancestor::library/interface[@name=current()]) or
2643 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
2644 )
2645 ">
2646 <xsl:value-of select="."/>
2647 <xsl:text> *</xsl:text>
2648 </xsl:when>
2649 <!-- other types -->
2650 </xsl:choose>
2651 </xsl:otherwise>
2652 </xsl:choose>
2653 </xsl:otherwise>
2654 </xsl:choose>
2655</xsl:template>
2656
2657</xsl:stylesheet>
2658
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