VirtualBox

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

Last change on this file since 96308 was 96308, checked in by vboxsync, 3 years ago

src/VBox/Main: XML/XSL comment fixes

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