VirtualBox

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

Last change on this file since 72153 was 69377, checked in by vboxsync, 7 years ago

Main/cbinding: scm updates

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

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