VirtualBox

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

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

Main/cbinding: another Windows build fix

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette