VirtualBox

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

Last change on this file since 53938 was 53938, checked in by vboxsync, 10 years ago

capiidl.xsl: Must use xsl:key+key() to access interface[@name=?]. Moved uppercase/lowercase code to shared style sheet.

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