VirtualBox

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

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

Main/cbinding: Add new helper functions to clear out strings (useful if they contain sensitive data). While doing this, added code to the glue init which checks if the version of the structure is compatible with what the client expects. This exposed annoying code duplication between the non-Windows/Windows implementations which is now eliminated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 101.5 KB
Line 
1<?xml version="1.0"?>
2<!-- $Id: capiidl.xsl 54027 2015-01-29 15:23:36Z 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 /**
1486 * Clear memory used by a UTF-8 string. Must be zero terminated.
1487 * Can be used for any UTF-8 or ASCII/ANSI string.
1488 *
1489 * @param pszString input/output string
1490 */
1491 void (*pfnUtf8Clear)(char *pszString);
1492 /**
1493 * Clear memory used by a UTF-16 string. Must be zero terminated.
1494 * Can be used for any UTF-16 or UCS-2 string.
1495 *
1496 * @param pwszString input/output string
1497 */
1498 void (*pfnUtf16Clear)(BSTR pwszString);
1499
1500 /** Tail version, same as uVersion.
1501 *
1502 * This should only be accessed if for some reason an API client needs
1503 * exactly the version it requested, or if cb is used to calculate the
1504 * address of this field. It may move as the structure before this is
1505 * allowed to grow as long as all the data from earlier minor versions
1506 * remains at the same place.
1507 */
1508 unsigned uEndVersion;
1509} VBOXCAPI;
1510/** Pointer to a const VBOXCAPI function table. */
1511typedef VBOXCAPI const *PCVBOXCAPI;
1512#ifndef WIN32
1513/** Backwards compatibility: Pointer to a const VBOXCAPI function table.
1514 * Use PCVBOXCAPI instead. */
1515typedef VBOXCAPI const *PCVBOXXPCOM;
1516#endif /* !WIN32 */
1517
1518#ifndef WIN32
1519/** Backwards compatibility: make sure old code using VBOXXPCOMC still compiles.
1520 * Use VBOXCAPI instead. */
1521#define VBOXXPCOMC VBOXCAPI
1522#endif /* !WIN32 */
1523
1524/** Extract the C API style major version.
1525 * Useful for comparing the interface version in VBOXCAPI::uVersion. */
1526#define VBOX_CAPI_MAJOR(x) (((x) &amp; 0xffff0000U) &gt;&gt; 16)
1527
1528/** Extract the C API style major version.
1529 * Useful for comparing the interface version in VBOXCAPI::uVersion. */
1530#define VBOX_CAPI_MINOR(x) ((x) &amp; 0x0000ffffU)
1531
1532/** The current interface version.
1533 * For use with VBoxGetCAPIFunctions and to be found in VBOXCAPI::uVersion. */
1534#define VBOX_CAPI_VERSION 0x00040001U
1535
1536#ifndef WIN32
1537/** Backwards compatibility: The current interface version.
1538 * Use VBOX_CAPI_VERSION instead. */
1539#define VBOX_XPCOMC_VERSION VBOX_CAPI_VERSION
1540#endif /* !WIN32 */
1541
1542/** VBoxGetCAPIFunctions. */
1543VBOXCAPI_DECL(PCVBOXCAPI) VBoxGetCAPIFunctions(unsigned uVersion);
1544#ifndef WIN32
1545/** Backwards compatibility: VBoxGetXPCOMCFunctions.
1546 * Use VBoxGetCAPIFunctions instead. */
1547VBOXCAPI_DECL(PCVBOXCAPI) VBoxGetXPCOMCFunctions(unsigned uVersion);
1548#endif /* !WIN32 */
1549
1550/** Typedef for VBoxGetCAPIFunctions. */
1551typedef PCVBOXCAPI (*PFNVBOXGETCAPIFUNCTIONS)(unsigned uVersion);
1552#ifndef WIN32
1553/** Backwards compatibility: Typedef for VBoxGetXPCOMCFunctions.
1554 * Use PFNVBOXGETCAPIFUNCTIONS instead. */
1555typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
1556#endif /* !WIN32 */
1557
1558/** The symbol name of VBoxGetCAPIFunctions. */
1559#ifdef __OS2__
1560# define VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME "_VBoxGetCAPIFunctions"
1561#else /* !__OS2__ */
1562# define VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME "VBoxGetCAPIFunctions"
1563#endif /* !__OS2__ */
1564#ifndef WIN32
1565/** Backwards compatibility: The symbol name of VBoxGetXPCOMCFunctions.
1566 * Use VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME instead. */
1567# ifdef __OS2__
1568# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "_VBoxGetXPCOMCFunctions"
1569# else /* !__OS2__ */
1570# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "VBoxGetXPCOMCFunctions"
1571# endif /* !__OS2__ */
1572#endif /* !WIN32 */
1573
1574
1575#ifdef __cplusplus
1576}
1577#endif /* __cplusplus */
1578
1579#endif /* !___VirtualBox_CAPI_h */
1580</xsl:text>
1581</xsl:template>
1582
1583<!--
1584 * ignore all |if|s except those for XPIDL target
1585-->
1586<xsl:template match="if">
1587 <xsl:if test="@target='xpidl'">
1588 <xsl:apply-templates/>
1589 </xsl:if>
1590</xsl:template>
1591<xsl:template match="if" mode="forward">
1592 <xsl:if test="@target='xpidl'">
1593 <xsl:apply-templates mode="forward"/>
1594 </xsl:if>
1595</xsl:template>
1596<xsl:template match="if" mode="forwarder">
1597 <xsl:if test="@target='midl'">
1598 <xsl:apply-templates mode="forwarder"/>
1599 </xsl:if>
1600</xsl:template>
1601
1602
1603<!--
1604 * libraries
1605-->
1606<xsl:template match="library">
1607 <!-- result codes -->
1608 <xsl:call-template name="xsltprocNewlineOutputHack"/>
1609 <xsl:for-each select="result">
1610 <xsl:apply-templates select="."/>
1611 </xsl:for-each>
1612 <xsl:call-template name="xsltprocNewlineOutputHack"/>
1613 <xsl:call-template name="xsltprocNewlineOutputHack"/>
1614 <!-- forward declarations -->
1615 <xsl:apply-templates select="interface | if/interface" mode="forward"/>
1616 <xsl:call-template name="xsltprocNewlineOutputHack"/>
1617 <!-- typedef'ing the struct declarations -->
1618 <xsl:apply-templates select="interface | if/interface" mode="typedef"/>
1619 <xsl:call-template name="xsltprocNewlineOutputHack"/>
1620 <!-- all enums go first -->
1621 <xsl:apply-templates select="enum | if/enum"/>
1622 <!-- everything else but result codes and enums -->
1623 <xsl:apply-templates select="*[not(self::result or self::enum) and
1624 not(self::if[result] or self::if[enum])]"/>
1625 <!-- -->
1626</xsl:template>
1627
1628
1629<!--
1630 * result codes
1631-->
1632<xsl:template match="result">
1633 <xsl:value-of select="concat('#define ',@name,' ',@value)"/>
1634 <xsl:text>&#x0A;</xsl:text>
1635</xsl:template>
1636
1637
1638<!--
1639 * forward declarations
1640-->
1641<xsl:template match="interface" mode="forward">
1642 <xsl:if test="not(@internal='yes')">
1643 <xsl:text>interface </xsl:text>
1644 <xsl:value-of select="@name"/>
1645 <xsl:text>;&#x0A;</xsl:text>
1646 </xsl:if>
1647</xsl:template>
1648
1649
1650<!--
1651 * typedef'ing the struct declarations
1652-->
1653<xsl:template match="interface" mode="typedef">
1654 <xsl:if test="not(@internal='yes')">
1655 <xsl:text>typedef interface </xsl:text>
1656 <xsl:value-of select="@name"/>
1657 <xsl:text> </xsl:text>
1658 <xsl:value-of select="@name"/>
1659 <xsl:text>;&#x0A;</xsl:text>
1660 </xsl:if>
1661</xsl:template>
1662
1663
1664<!--
1665 * COBJMACRO style convenience macros for calling methods
1666-->
1667<xsl:template match="interface" mode="cobjmacro">
1668 <xsl:param name="iface"/>
1669
1670 <xsl:variable name="extends" select="@extends"/>
1671 <xsl:choose>
1672 <xsl:when test="$extends='$unknown'">
1673 <xsl:text>#define </xsl:text>
1674 <xsl:value-of select="$iface"/>
1675 <xsl:text>_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))&#x0A;</xsl:text>
1676 <xsl:text>#define </xsl:text>
1677 <xsl:value-of select="$iface"/>
1678 <xsl:text>_AddRef(p) ((p)->lpVtbl->AddRef(p))&#x0A;</xsl:text>
1679 <xsl:text>#define </xsl:text>
1680 <xsl:value-of select="$iface"/>
1681 <xsl:text>_Release(p) ((p)->lpVtbl->Release(p))&#x0A;</xsl:text>
1682 </xsl:when>
1683 <xsl:when test="$extends='$errorinfo'">
1684 <xsl:text>#define </xsl:text>
1685 <xsl:value-of select="$iface"/>
1686 <xsl:text>_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))&#x0A;</xsl:text>
1687 <xsl:text>#define </xsl:text>
1688 <xsl:value-of select="$iface"/>
1689 <xsl:text>_AddRef(p) ((p)->lpVtbl->AddRef(p))&#x0A;</xsl:text>
1690 <xsl:text>#define </xsl:text>
1691 <xsl:value-of select="$iface"/>
1692 <xsl:text>_Release(p) ((p)->lpVtbl->Release(p))&#x0A;</xsl:text>
1693 <xsl:text>#define </xsl:text>
1694 <xsl:value-of select="$iface"/>
1695 <xsl:text>_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))&#x0A;</xsl:text>
1696 <xsl:text>#define </xsl:text>
1697 <xsl:value-of select="$iface"/>
1698 <xsl:text>_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))&#x0A;</xsl:text>
1699 <xsl:text>#define </xsl:text>
1700 <xsl:value-of select="$iface"/>
1701 <xsl:text>_get_Result(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))&#x0A;</xsl:text>
1702 <xsl:text>#define </xsl:text>
1703 <xsl:value-of select="$iface"/>
1704 <xsl:text>_GetResult(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))&#x0A;</xsl:text>
1705 <xsl:text>#define </xsl:text>
1706 <xsl:value-of select="$iface"/>
1707 <xsl:text>_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))&#x0A;</xsl:text>
1708 <xsl:text>#define </xsl:text>
1709 <xsl:value-of select="$iface"/>
1710 <xsl:text>_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))&#x0A;</xsl:text>
1711 <xsl:text>#define </xsl:text>
1712 <xsl:value-of select="$iface"/>
1713 <xsl:text>_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))&#x0A;</xsl:text>
1714 <xsl:text>#define </xsl:text>
1715 <xsl:value-of select="$iface"/>
1716 <xsl:text>_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))&#x0A;</xsl:text>
1717 <xsl:text>#define </xsl:text>
1718 <xsl:value-of select="$iface"/>
1719 <xsl:text>_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))&#x0A;</xsl:text>
1720 <xsl:text>#define </xsl:text>
1721 <xsl:value-of select="$iface"/>
1722 <xsl:text>_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))&#x0A;</xsl:text>
1723 <xsl:text>#define </xsl:text>
1724 <xsl:value-of select="$iface"/>
1725 <xsl:text>_get_ColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))&#x0A;</xsl:text>
1726 <xsl:text>#define </xsl:text>
1727 <xsl:value-of select="$iface"/>
1728 <xsl:text>_GetColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))&#x0A;</xsl:text>
1729 <xsl:text>#define </xsl:text>
1730 <xsl:value-of select="$iface"/>
1731 <xsl:text>_get_Location(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))&#x0A;</xsl:text>
1732 <xsl:text>#define </xsl:text>
1733 <xsl:value-of select="$iface"/>
1734 <xsl:text>_GetLocation(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))&#x0A;</xsl:text>
1735 <xsl:text>#define </xsl:text>
1736 <xsl:value-of select="$iface"/>
1737 <xsl:text>_get_Inner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))&#x0A;</xsl:text>
1738 <xsl:text>#define </xsl:text>
1739 <xsl:value-of select="$iface"/>
1740 <xsl:text>_GetInner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))&#x0A;</xsl:text>
1741 <xsl:text>#define </xsl:text>
1742 <xsl:value-of select="$iface"/>
1743 <xsl:text>_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))&#x0A;</xsl:text>
1744 <xsl:text>#define </xsl:text>
1745 <xsl:value-of select="$iface"/>
1746 <xsl:text>_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))&#x0A;</xsl:text>
1747 <xsl:text>#define </xsl:text>
1748 <xsl:value-of select="$iface"/>
1749 <xsl:text>_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))&#x0A;</xsl:text>
1750 </xsl:when>
1751 <xsl:otherwise>
1752 <xsl:apply-templates select="key('G_keyInterfacesByName', $extends)" mode="cobjmacro">
1753 <xsl:with-param name="iface" select="$iface"/>
1754 </xsl:apply-templates>
1755 </xsl:otherwise>
1756 </xsl:choose>
1757 <!-- attributes (properties) -->
1758 <xsl:apply-templates select="attribute | if/attribute" mode="cobjmacro">
1759 <xsl:with-param name="iface" select="$iface"/>
1760 </xsl:apply-templates>
1761 <!-- methods -->
1762 <xsl:apply-templates select="method | if/method" mode="cobjmacro">
1763 <xsl:with-param name="iface" select="$iface"/>
1764 </xsl:apply-templates>
1765</xsl:template>
1766
1767
1768<!--
1769 * emit flat vtable, compatible with COM
1770-->
1771<xsl:template match="interface" mode="vtab_flat">
1772 <xsl:param name="iface"/>
1773
1774 <xsl:variable name="extends" select="@extends"/>
1775 <xsl:choose>
1776 <xsl:when test="$extends='$unknown'">
1777 <xsl:text> nsresult (*QueryInterface)(</xsl:text>
1778 <xsl:value-of select="$iface"/>
1779 <xsl:text> *pThis, const nsID *iid, void **resultp);&#x0A;</xsl:text>
1780 <xsl:text> nsrefcnt (*AddRef)(</xsl:text>
1781 <xsl:value-of select="$iface"/>
1782 <xsl:text> *pThis);&#x0A;</xsl:text>
1783 <xsl:text> nsrefcnt (*Release)(</xsl:text>
1784 <xsl:value-of select="$iface"/>
1785 <xsl:text> *pThis);&#x0A;</xsl:text>
1786 </xsl:when>
1787 <xsl:when test="$extends='$errorinfo'">
1788 <xsl:text> nsresult (*QueryInterface)(</xsl:text>
1789 <xsl:value-of select="$iface"/>
1790 <xsl:text> *pThis, const nsID *iid, void **resultp);&#x0A;</xsl:text>
1791 <xsl:text> nsrefcnt (*AddRef)(</xsl:text>
1792 <xsl:value-of select="$iface"/>
1793 <xsl:text> *pThis);&#x0A;</xsl:text>
1794 <xsl:text> nsrefcnt (*Release)(</xsl:text>
1795 <xsl:value-of select="$iface"/>
1796 <xsl:text> *pThis);&#x0A;</xsl:text>
1797 <xsl:text> nsresult (*GetMessage)(</xsl:text>
1798 <xsl:value-of select="$iface"/>
1799 <xsl:text> *pThis, PRUnichar * *aMessage);&#x0A;</xsl:text>
1800 <xsl:text> nsresult (*GetResult)(</xsl:text>
1801 <xsl:value-of select="$iface"/>
1802 <xsl:text> *pThis, nsresult *aResult);&#x0A;</xsl:text>
1803 <xsl:text> nsresult (*GetName)(</xsl:text>
1804 <xsl:value-of select="$iface"/>
1805 <xsl:text>*pThis, PRUnichar * *aName);&#x0A;</xsl:text>
1806 <xsl:text> nsresult (*GetFilename)(</xsl:text>
1807 <xsl:value-of select="$iface"/>
1808 <xsl:text> *pThis, PRUnichar * *aFilename);&#x0A;</xsl:text>
1809 <xsl:text> nsresult (*GetLineNumber)(</xsl:text>
1810 <xsl:value-of select="$iface"/>
1811 <xsl:text> *pThis, PRUint32 *aLineNumber);&#x0A;</xsl:text>
1812 <xsl:text> nsresult (*GetColumnNumber)(</xsl:text>
1813 <xsl:value-of select="$iface"/>
1814 <xsl:text> *pThis, PRUint32 *aColumnNumber);&#x0A;</xsl:text>
1815 <xsl:text> nsresult (*GetLocation)(</xsl:text>
1816 <xsl:value-of select="$iface"/>
1817 <xsl:text> *pThis, nsIStackFrame * *aLocation);&#x0A;</xsl:text>
1818 <xsl:text> nsresult (*GetInner)(</xsl:text>
1819 <xsl:value-of select="$iface"/>
1820 <xsl:text> *pThis, nsIException * *aInner);&#x0A;</xsl:text>
1821 <xsl:text> nsresult (*GetData)(</xsl:text>
1822 <xsl:value-of select="$iface"/>
1823 <xsl:text> *pThis, nsISupports * *aData);&#x0A;</xsl:text>
1824 <xsl:text> nsresult (*ToString)(</xsl:text>
1825 <xsl:value-of select="$iface"/>
1826 <xsl:text> *pThis, PRUnichar **_retval);&#x0A;</xsl:text>
1827 </xsl:when>
1828 <xsl:otherwise>
1829 <xsl:apply-templates select="key('G_keyInterfacesByName', $extends)" mode="vtab_flat">
1830 <xsl:with-param name="iface" select="$iface"/>
1831 </xsl:apply-templates>
1832 </xsl:otherwise>
1833 </xsl:choose>
1834 <!-- attributes (properties) -->
1835 <xsl:apply-templates select="attribute | if/attribute">
1836 <xsl:with-param name="iface" select="$iface"/>
1837 </xsl:apply-templates>
1838 <!-- methods -->
1839 <xsl:apply-templates select="method | if/method">
1840 <xsl:with-param name="iface" select="$iface"/>
1841 </xsl:apply-templates>
1842</xsl:template>
1843
1844
1845<!--
1846 * interfaces
1847-->
1848<xsl:template match="interface">
1849 <xsl:if test="not(@internal='yes')">
1850 <xsl:text>/* Start of struct </xsl:text>
1851 <xsl:value-of select="@name"/>
1852 <xsl:text> declaration */&#x0A;</xsl:text>
1853 <xsl:text>#define </xsl:text>
1854 <xsl:call-template name="string-to-upper">
1855 <xsl:with-param name="str" select="@name"/>
1856 </xsl:call-template>
1857 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
1858 <xsl:text>&#x0A;</xsl:text>
1859 <xsl:text>#define </xsl:text>
1860 <xsl:call-template name="string-to-upper">
1861 <xsl:with-param name="str" select="@name"/>
1862 </xsl:call-template>
1863 <xsl:text>_IID { \&#x0A;</xsl:text>
1864 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
1865 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
1866 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
1867 <xsl:text>, \&#x0A; </xsl:text>
1868 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
1869 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
1870 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
1871 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
1872 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
1873 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
1874 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
1875 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
1876 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
1877 <xsl:text>/* COM compatibility */&#x0A;</xsl:text>
1878 <xsl:text>VBOX_EXTERN_CONST(nsIID, IID_</xsl:text>
1879 <xsl:value-of select="@name"/>
1880 <xsl:text>);&#x0A;</xsl:text>
1881 <xsl:text>#ifndef VBOX_WITH_GLUE&#x0A;</xsl:text>
1882 <xsl:text>struct </xsl:text>
1883 <xsl:value-of select="@name"/>
1884 <xsl:text>_vtbl&#x0A;{&#x0A;</xsl:text>
1885 <xsl:text> </xsl:text>
1886 <xsl:choose>
1887 <xsl:when test="@extends='$unknown'">struct nsISupports_vtbl nsisupports;</xsl:when>
1888 <xsl:when test="@extends='$errorinfo'">struct nsIException_vtbl nsiexception;</xsl:when>
1889 <xsl:otherwise>
1890 <xsl:text>struct </xsl:text>
1891 <xsl:value-of select="@extends"/>
1892 <xsl:text>_vtbl </xsl:text>
1893 <xsl:call-template name="string-to-lower">
1894 <xsl:with-param name="str" select="@extends"/>
1895 </xsl:call-template>
1896 <xsl:text>;</xsl:text>
1897 </xsl:otherwise>
1898 </xsl:choose>
1899 <xsl:text>&#x0A;&#x0A;</xsl:text>
1900 <!-- attributes (properties) -->
1901 <xsl:apply-templates select="attribute | if/attribute"/>
1902 <!-- methods -->
1903 <xsl:apply-templates select="method | if/method"/>
1904 <!-- -->
1905 <xsl:text>};&#x0A;</xsl:text>
1906 <xsl:text>#else /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1907 <xsl:text>struct </xsl:text>
1908 <xsl:value-of select="@name"/>
1909 <xsl:text>Vtbl&#x0A;{&#x0A;</xsl:text>
1910 <xsl:apply-templates select="." mode="vtab_flat">
1911 <xsl:with-param name="iface" select="@name"/>
1912 </xsl:apply-templates>
1913 <xsl:text>};&#x0A;</xsl:text>
1914 <xsl:apply-templates select="." mode="cobjmacro">
1915 <xsl:with-param name="iface" select="@name"/>
1916 </xsl:apply-templates>
1917 <!-- -->
1918 <xsl:text>#endif /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1919 <xsl:text>&#x0A;</xsl:text>
1920 <xsl:text>interface </xsl:text>
1921 <xsl:value-of select="@name"/>
1922 <xsl:text>&#x0A;{&#x0A;</xsl:text>
1923 <xsl:text>#ifndef VBOX_WITH_GLUE&#x0A;</xsl:text>
1924 <xsl:text> struct </xsl:text>
1925 <xsl:value-of select="@name"/>
1926 <xsl:text>_vtbl *vtbl;&#x0A;</xsl:text>
1927 <xsl:text>#else /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1928 <xsl:text> CONST_VTBL struct </xsl:text>
1929 <xsl:value-of select="@name"/>
1930 <xsl:text>Vtbl *lpVtbl;&#x0A;</xsl:text>
1931 <xsl:text>#endif /* VBOX_WITH_GLUE */&#x0A;</xsl:text>
1932 <xsl:text>};&#x0A;</xsl:text>
1933 <xsl:text>/* End of struct </xsl:text>
1934 <xsl:value-of select="@name"/>
1935 <xsl:text> declaration */&#x0A;&#x0A;</xsl:text>
1936 <xsl:call-template name="xsltprocNewlineOutputHack"/>
1937 </xsl:if>
1938</xsl:template>
1939
1940
1941<!--
1942 * attributes
1943-->
1944<xsl:template match="attribute">
1945 <xsl:param name="iface" select="ancestor::interface/@name"/>
1946
1947 <xsl:choose>
1948 <!-- safearray pseudo attribute -->
1949 <xsl:when test="@safearray='yes'">
1950 <!-- getter -->
1951 <xsl:text> nsresult (*Get</xsl:text>
1952 <xsl:call-template name="capitalize">
1953 <xsl:with-param name="str" select="@name"/>
1954 </xsl:call-template>
1955 <xsl:text>)(</xsl:text>
1956 <xsl:value-of select="$iface" />
1957 <xsl:text> *pThis, </xsl:text>
1958 <!-- array size -->
1959 <xsl:text>PRUint32 *</xsl:text>
1960 <xsl:value-of select="@name"/>
1961 <xsl:text>Size, </xsl:text>
1962 <!-- array pointer -->
1963 <xsl:apply-templates select="@type" mode="forwarder"/>
1964 <xsl:text> **</xsl:text>
1965 <xsl:value-of select="@name"/>
1966 <xsl:text>);&#x0A;</xsl:text>
1967 <!-- setter -->
1968 <xsl:if test="not(@readonly='yes')">
1969 <xsl:text> nsresult (*Set</xsl:text>
1970 <xsl:call-template name="capitalize">
1971 <xsl:with-param name="str" select="@name"/>
1972 </xsl:call-template>
1973 <xsl:text>)(</xsl:text>
1974 <xsl:value-of select="$iface" />
1975 <xsl:text> *pThis, </xsl:text>
1976 <!-- array size -->
1977 <xsl:text>PRUint32 </xsl:text>
1978 <xsl:value-of select="@name"/>
1979 <xsl:text>Size, </xsl:text>
1980 <!-- array pointer -->
1981 <xsl:apply-templates select="@type" mode="forwarder"/>
1982 <xsl:text> *</xsl:text>
1983 <xsl:value-of select="@name"/>
1984 <xsl:text>);&#x0A;</xsl:text>
1985 </xsl:if>
1986 </xsl:when>
1987 <!-- normal attribute -->
1988 <xsl:otherwise>
1989 <xsl:text> </xsl:text>
1990 <xsl:if test="@readonly='yes'">
1991 <xsl:text>nsresult (*Get</xsl:text>
1992 <xsl:call-template name="capitalize">
1993 <xsl:with-param name="str" select="@name"/>
1994 </xsl:call-template>
1995 <xsl:text>)(</xsl:text>
1996 <xsl:value-of select="$iface" />
1997 <xsl:text> *pThis, </xsl:text>
1998 <xsl:apply-templates select="@type" mode="forwarder"/>
1999 <xsl:text> *</xsl:text>
2000 <xsl:value-of select="@name"/>
2001 <xsl:text>);&#x0A;</xsl:text>
2002 </xsl:if>
2003 <xsl:choose>
2004 <xsl:when test="@readonly='yes'">
2005 </xsl:when>
2006 <xsl:otherwise>
2007 <xsl:text>nsresult (*Get</xsl:text>
2008 <xsl:call-template name="capitalize">
2009 <xsl:with-param name="str" select="@name"/>
2010 </xsl:call-template>
2011 <xsl:text>)(</xsl:text>
2012 <xsl:value-of select="$iface" />
2013 <xsl:text> *pThis, </xsl:text>
2014 <xsl:apply-templates select="@type" mode="forwarder"/>
2015 <xsl:text> *</xsl:text>
2016 <xsl:value-of select="@name"/>
2017 <xsl:text>);&#x0A; </xsl:text>
2018 <xsl:text>nsresult (*Set</xsl:text>
2019 <xsl:call-template name="capitalize">
2020 <xsl:with-param name="str" select="@name"/>
2021 </xsl:call-template>
2022 <xsl:text>)(</xsl:text>
2023 <xsl:value-of select="$iface" />
2024 <xsl:text> *pThis, </xsl:text>
2025 <xsl:apply-templates select="@type" mode="forwarder"/>
2026 <xsl:text> </xsl:text>
2027 <xsl:value-of select="@name"/>
2028 <xsl:text>);&#x0A;</xsl:text>
2029 </xsl:otherwise>
2030 </xsl:choose>
2031 </xsl:otherwise>
2032 </xsl:choose>
2033 <xsl:text>&#x0A;</xsl:text>
2034</xsl:template>
2035
2036<xsl:template match="attribute" mode="cobjmacro">
2037 <xsl:param name="iface"/>
2038
2039 <!-- getter (COM compatible) -->
2040 <xsl:text>#define </xsl:text>
2041 <xsl:value-of select="concat($iface, '_get_')"/>
2042 <xsl:call-template name="capitalize">
2043 <xsl:with-param name="str" select="@name"/>
2044 </xsl:call-template>
2045 <xsl:text>(p, a</xsl:text>
2046 <xsl:call-template name="capitalize">
2047 <xsl:with-param name="str" select="@name"/>
2048 </xsl:call-template>
2049 <xsl:text>) ((p)->lpVtbl->Get</xsl:text>
2050 <xsl:call-template name="capitalize">
2051 <xsl:with-param name="str" select="@name"/>
2052 </xsl:call-template>
2053 <xsl:text>(p, a</xsl:text>
2054 <xsl:call-template name="capitalize">
2055 <xsl:with-param name="str" select="@name"/>
2056 </xsl:call-template>
2057 <xsl:text>))&#x0A;</xsl:text>
2058
2059 <!-- getter (XPCOM compatible) -->
2060 <xsl:text>#define </xsl:text>
2061 <xsl:value-of select="concat($iface, '_Get')"/>
2062 <xsl:call-template name="capitalize">
2063 <xsl:with-param name="str" select="@name"/>
2064 </xsl:call-template>
2065 <xsl:text>(p, a</xsl:text>
2066 <xsl:call-template name="capitalize">
2067 <xsl:with-param name="str" select="@name"/>
2068 </xsl:call-template>
2069 <xsl:text>) ((p)->lpVtbl->Get</xsl:text>
2070 <xsl:call-template name="capitalize">
2071 <xsl:with-param name="str" select="@name"/>
2072 </xsl:call-template>
2073 <xsl:text>(p, a</xsl:text>
2074 <xsl:call-template name="capitalize">
2075 <xsl:with-param name="str" select="@name"/>
2076 </xsl:call-template>
2077 <xsl:text>))&#x0A;</xsl:text>
2078
2079 <xsl:if test="not(@readonly='yes')">
2080 <!-- setter (COM compatible) -->
2081 <xsl:text>#define </xsl:text>
2082 <xsl:value-of select="concat($iface, '_put_')"/>
2083 <xsl:call-template name="capitalize">
2084 <xsl:with-param name="str" select="@name"/>
2085 </xsl:call-template>
2086 <xsl:text>(p, a</xsl:text>
2087 <xsl:call-template name="capitalize">
2088 <xsl:with-param name="str" select="@name"/>
2089 </xsl:call-template>
2090 <xsl:text>) ((p)->lpVtbl->Set</xsl:text>
2091 <xsl:call-template name="capitalize">
2092 <xsl:with-param name="str" select="@name"/>
2093 </xsl:call-template>
2094 <xsl:text>(p, a</xsl:text>
2095 <xsl:call-template name="capitalize">
2096 <xsl:with-param name="str" select="@name"/>
2097 </xsl:call-template>
2098 <xsl:text>))&#x0A;</xsl:text>
2099
2100 <!-- setter (XPCOM compatible) -->
2101 <xsl:text>#define </xsl:text>
2102 <xsl:value-of select="concat($iface, '_Set')"/>
2103 <xsl:call-template name="capitalize">
2104 <xsl:with-param name="str" select="@name"/>
2105 </xsl:call-template>
2106 <xsl:text>(p, a</xsl:text>
2107 <xsl:call-template name="capitalize">
2108 <xsl:with-param name="str" select="@name"/>
2109 </xsl:call-template>
2110 <xsl:text>) ((p)->lpVtbl->Set</xsl:text>
2111 <xsl:call-template name="capitalize">
2112 <xsl:with-param name="str" select="@name"/>
2113 </xsl:call-template>
2114 <xsl:text>(p, a</xsl:text>
2115 <xsl:call-template name="capitalize">
2116 <xsl:with-param name="str" select="@name"/>
2117 </xsl:call-template>
2118 <xsl:text>))&#x0A;</xsl:text>
2119
2120 </xsl:if>
2121</xsl:template>
2122
2123<!--
2124 * methods
2125-->
2126<xsl:template match="method">
2127 <xsl:param name="iface" select="ancestor::interface/@name"/>
2128
2129 <xsl:if test="param/@mod='ptr'">
2130 <!-- methods using native types must be non-scriptable
2131 <xsl:text> [noscript]&#x0A;</xsl:text>-->
2132 </xsl:if>
2133 <xsl:text> nsresult (*</xsl:text>
2134 <xsl:call-template name="capitalize">
2135 <xsl:with-param name="str" select="@name"/>
2136 </xsl:call-template>
2137 <xsl:if test="param">
2138 <xsl:text>)(&#x0A;</xsl:text>
2139 <xsl:text> </xsl:text>
2140 <xsl:value-of select="$iface" />
2141 <xsl:text> *pThis,&#x0A;</xsl:text>
2142 <xsl:for-each select="param [position() != last()]">
2143 <xsl:text> </xsl:text>
2144 <xsl:apply-templates select="."/>
2145 <xsl:text>,&#x0A;</xsl:text>
2146 </xsl:for-each>
2147 <xsl:text> </xsl:text>
2148 <xsl:apply-templates select="param [last()]"/>
2149 <xsl:text>&#x0A; );&#x0A;</xsl:text>
2150 </xsl:if>
2151 <xsl:if test="not(param)">
2152 <xsl:text>)(</xsl:text>
2153 <xsl:value-of select="$iface" />
2154 <xsl:text> *pThis );&#x0A;</xsl:text>
2155 </xsl:if>
2156 <xsl:text>&#x0A;</xsl:text>
2157</xsl:template>
2158
2159<xsl:template match="method" mode="cobjmacro">
2160 <xsl:param name="iface"/>
2161
2162 <xsl:text>#define </xsl:text>
2163 <xsl:value-of select="concat($iface, '_')"/>
2164 <xsl:call-template name="capitalize">
2165 <xsl:with-param name="str" select="@name"/>
2166 </xsl:call-template>
2167 <xsl:text>(p</xsl:text>
2168 <xsl:for-each select="param">
2169 <xsl:text>, a</xsl:text>
2170 <xsl:call-template name="capitalize">
2171 <xsl:with-param name="str" select="@name"/>
2172 </xsl:call-template>
2173 </xsl:for-each>
2174 <xsl:text>) ((p)->lpVtbl-></xsl:text>
2175 <xsl:call-template name="capitalize">
2176 <xsl:with-param name="str" select="@name"/>
2177 </xsl:call-template>
2178 <xsl:text>(p</xsl:text>
2179 <xsl:for-each select="param">
2180 <xsl:text>, a</xsl:text>
2181 <xsl:call-template name="capitalize">
2182 <xsl:with-param name="str" select="@name"/>
2183 </xsl:call-template>
2184 </xsl:for-each>
2185 <xsl:text>))&#x0A;</xsl:text>
2186</xsl:template>
2187
2188
2189<!--
2190 * modules
2191-->
2192<xsl:template match="module">
2193 <xsl:apply-templates select="class"/>
2194</xsl:template>
2195
2196
2197<!--
2198 * co-classes
2199-->
2200<xsl:template match="module/class">
2201 <!-- class and contract id -->
2202 <xsl:text>&#x0A;</xsl:text>
2203 <xsl:text>#define NS_</xsl:text>
2204 <xsl:call-template name="string-to-upper">
2205 <xsl:with-param name="str" select="@name"/>
2206 </xsl:call-template>
2207 <xsl:text>_CID { \&#x0A;</xsl:text>
2208 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
2209 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
2210 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
2211 <xsl:text>, \&#x0A; </xsl:text>
2212 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
2213 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
2214 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
2215 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
2216 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
2217 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
2218 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
2219 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
2220 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
2221 <xsl:text>#define NS_</xsl:text>
2222 <xsl:call-template name="string-to-upper">
2223 <xsl:with-param name="str" select="@name"/>
2224 </xsl:call-template>
2225 <!-- Contract ID -->
2226 <xsl:text>_CONTRACTID &quot;@</xsl:text>
2227 <xsl:value-of select="@namespace"/>
2228 <xsl:text>/</xsl:text>
2229 <xsl:value-of select="@name"/>
2230 <xsl:text>;1&quot;&#x0A;</xsl:text>
2231 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32 -->
2232 <xsl:text>/* COM compatibility */&#x0A;</xsl:text>
2233 <xsl:text>VBOX_EXTERN_CONST(nsCID, CLSID_</xsl:text>
2234 <xsl:value-of select="@name"/>
2235 <xsl:text>);&#x0A;</xsl:text>
2236 <xsl:text>&#x0A;&#x0A;</xsl:text>
2237</xsl:template>
2238
2239
2240<!--
2241 * enums
2242-->
2243<xsl:template match="enum">
2244 <xsl:text>/* Start of enum </xsl:text>
2245 <xsl:value-of select="@name"/>
2246 <xsl:text> declaration */&#x0A;</xsl:text>
2247 <xsl:text>#define </xsl:text>
2248 <xsl:call-template name="string-to-upper">
2249 <xsl:with-param name="str" select="@name"/>
2250 </xsl:call-template>
2251 <xsl:value-of select="concat('_IID_STR &quot;',@uuid,'&quot;')"/>
2252 <xsl:text>&#x0A;</xsl:text>
2253 <xsl:text>#define </xsl:text>
2254 <xsl:call-template name="string-to-upper">
2255 <xsl:with-param name="str" select="@name"/>
2256 </xsl:call-template>
2257 <xsl:text>_IID { \&#x0A;</xsl:text>
2258 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
2259 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
2260 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
2261 <xsl:text>, \&#x0A; </xsl:text>
2262 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
2263 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
2264 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
2265 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
2266 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
2267 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
2268 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
2269 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
2270 <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
2271 <xsl:text>typedef enum </xsl:text>
2272 <xsl:value-of select="@name"/>
2273 <xsl:text>&#x0A;{&#x0A;</xsl:text>
2274 <xsl:variable name="this" select="."/>
2275 <xsl:for-each select="const">
2276 <xsl:text> </xsl:text>
2277 <xsl:value-of select="$this/@name"/>
2278 <xsl:text>_</xsl:text>
2279 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
2280 <xsl:if test="position() != last()">
2281 <xsl:text>,</xsl:text>
2282 </xsl:if>
2283 <xsl:text>&#x0A;</xsl:text>
2284 </xsl:for-each>
2285 <xsl:text>} </xsl:text>
2286 <xsl:value-of select="@name"/>
2287 <xsl:text>;&#x0A;</xsl:text>
2288 <xsl:text>/* End of enum </xsl:text>
2289 <xsl:value-of select="@name"/>
2290 <xsl:text> declaration */
2291#define </xsl:text>
2292 <xsl:value-of select="concat(@name, '_T PRUint32&#x0A;&#x0A;&#x0A;')"/>
2293</xsl:template>
2294
2295
2296<!--
2297 * method parameters
2298-->
2299<xsl:template match="method/param">
2300 <xsl:choose>
2301 <!-- safearray parameters -->
2302 <xsl:when test="@safearray='yes'">
2303 <!-- array size -->
2304 <xsl:choose>
2305 <xsl:when test="@dir='in'">
2306 <xsl:text>PRUint32 </xsl:text>
2307 <xsl:value-of select="@name"/>
2308 <xsl:text>Size,&#x0A;</xsl:text>
2309 </xsl:when>
2310 <xsl:when test="@dir='out'">
2311 <xsl:text>PRUint32 *</xsl:text>
2312 <xsl:value-of select="@name"/>
2313 <xsl:text>Size,&#x0A;</xsl:text>
2314 </xsl:when>
2315 <xsl:when test="@dir='return'">
2316 <xsl:text>PRUint32 *</xsl:text>
2317 <xsl:value-of select="@name"/>
2318 <xsl:text>Size,&#x0A;</xsl:text>
2319 </xsl:when>
2320 <xsl:otherwise>
2321 <xsl:text>PRUint32 </xsl:text>
2322 <xsl:value-of select="@name"/>
2323 <xsl:text>Size,&#x0A;</xsl:text>
2324 </xsl:otherwise>
2325 </xsl:choose>
2326 <!-- array pointer -->
2327 <xsl:text> </xsl:text>
2328 <xsl:choose>
2329 <xsl:when test="@dir='in'">
2330 <xsl:apply-templates select="@type" mode="forwarder"/>
2331 <xsl:text>*</xsl:text>
2332 </xsl:when>
2333 <xsl:when test="@dir='out'">
2334 <xsl:apply-templates select="@type" mode="forwarder"/>
2335 <xsl:text>**</xsl:text>
2336 </xsl:when>
2337 <xsl:when test="@dir='return'">
2338 <xsl:apply-templates select="@type" mode="forwarder"/>
2339 <xsl:text>**</xsl:text>
2340 </xsl:when>
2341 <xsl:otherwise>
2342 <xsl:apply-templates select="@type" mode="forwarder"/>
2343 <xsl:text>*</xsl:text>
2344 </xsl:otherwise>
2345 </xsl:choose>
2346 <xsl:text> </xsl:text>
2347 <xsl:value-of select="@name"/>
2348 </xsl:when>
2349 <!-- normal and array parameters -->
2350 <xsl:otherwise>
2351 <xsl:choose>
2352 <xsl:when test="@dir='in'">
2353 <xsl:apply-templates select="@type" mode="forwarder"/>
2354 <xsl:text></xsl:text>
2355 </xsl:when>
2356 <xsl:when test="@dir='out'">
2357 <xsl:apply-templates select="@type" mode="forwarder"/>
2358 <xsl:text> *</xsl:text>
2359 </xsl:when>
2360 <xsl:when test="@dir='return'">
2361 <xsl:apply-templates select="@type" mode="forwarder"/>
2362 <xsl:text> *</xsl:text>
2363 </xsl:when>
2364 <xsl:otherwise>
2365 <xsl:apply-templates select="@type" mode="forwarder"/>
2366 <xsl:text></xsl:text>
2367 </xsl:otherwise>
2368 </xsl:choose>
2369 <xsl:text> </xsl:text>
2370 <xsl:value-of select="@name"/>
2371 </xsl:otherwise>
2372 </xsl:choose>
2373</xsl:template>
2374
2375<xsl:template match="method/param" mode="forwarder">
2376 <xsl:if test="@safearray='yes'">
2377 <xsl:text>PRUint32</xsl:text>
2378 <xsl:if test="@dir='out' or @dir='return'">
2379 <xsl:text> *</xsl:text>
2380 </xsl:if>
2381 <xsl:text> a</xsl:text>
2382 <xsl:call-template name="capitalize">
2383 <xsl:with-param name="str" select="@name"/>
2384 </xsl:call-template>
2385 <xsl:text>Size, </xsl:text>
2386 </xsl:if>
2387 <xsl:apply-templates select="@type" mode="forwarder"/>
2388 <xsl:if test="@dir='out' or @dir='return'">
2389 <xsl:text> *</xsl:text>
2390 </xsl:if>
2391 <xsl:if test="@safearray='yes'">
2392 <xsl:text> *</xsl:text>
2393 </xsl:if>
2394 <xsl:text> a</xsl:text>
2395 <xsl:call-template name="capitalize">
2396 <xsl:with-param name="str" select="@name"/>
2397 </xsl:call-template>
2398</xsl:template>
2399
2400
2401<!--
2402 * attribute/parameter type conversion
2403-->
2404<xsl:template match="attribute/@type | param/@type">
2405 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
2406
2407 <xsl:choose>
2408 <!-- modifiers (ignored for 'enumeration' attributes)-->
2409 <xsl:when test="name(current())='type' and ../@mod">
2410 <xsl:choose>
2411 <xsl:when test="../@mod='ptr'">
2412 <xsl:choose>
2413 <!-- standard types -->
2414 <!--xsl:when test=".='result'">??</xsl:when-->
2415 <xsl:when test=".='boolean'">booleanPtr</xsl:when>
2416 <xsl:when test=".='octet'">octetPtr</xsl:when>
2417 <xsl:when test=".='short'">shortPtr</xsl:when>
2418 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
2419 <xsl:when test=".='long'">longPtr</xsl:when>
2420 <xsl:when test=".='long long'">llongPtr</xsl:when>
2421 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
2422 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
2423 <xsl:otherwise>
2424 <xsl:message terminate="yes">
2425 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2426 <xsl:text>attribute 'mod=</xsl:text>
2427 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2428 <xsl:text>' cannot be used with type </xsl:text>
2429 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2430 </xsl:message>
2431 </xsl:otherwise>
2432 </xsl:choose>
2433 </xsl:when>
2434 <xsl:when test="../@mod='string'">
2435 <xsl:choose>
2436 <!-- standard types -->
2437 <!--xsl:when test=".='result'">??</xsl:when-->
2438 <xsl:when test=".='uuid'">wstring</xsl:when>
2439 <xsl:otherwise>
2440 <xsl:message terminate="yes">
2441 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2442 <xsl:text>attribute 'mod=</xsl:text>
2443 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2444 <xsl:text>' cannot be used with type </xsl:text>
2445 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2446 </xsl:message>
2447 </xsl:otherwise>
2448 </xsl:choose>
2449 </xsl:when>
2450 <xsl:otherwise>
2451 <xsl:message terminate="yes">
2452 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2453 <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
2454 <xsl:text>of attribute 'mod' is invalid!</xsl:text>
2455 </xsl:message>
2456 </xsl:otherwise>
2457 </xsl:choose>
2458 </xsl:when>
2459 <!-- no modifiers -->
2460 <xsl:otherwise>
2461 <xsl:choose>
2462 <!-- standard types -->
2463 <xsl:when test=".='result'">nsresult</xsl:when>
2464 <xsl:when test=".='boolean'">boolean</xsl:when>
2465 <xsl:when test=".='octet'">octet</xsl:when>
2466 <xsl:when test=".='short'">short</xsl:when>
2467 <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
2468 <xsl:when test=".='long'">long</xsl:when>
2469 <xsl:when test=".='long long'">long long</xsl:when>
2470 <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
2471 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
2472 <xsl:when test=".='char'">char</xsl:when>
2473 <xsl:when test=".='wchar'">wchar</xsl:when>
2474 <xsl:when test=".='string'">string</xsl:when>
2475 <xsl:when test=".='wstring'">wstring</xsl:when>
2476 <!-- UUID type -->
2477 <xsl:when test=".='uuid'">
2478 <xsl:choose>
2479 <xsl:when test="name(..)='attribute'">
2480 <xsl:choose>
2481 <xsl:when test="../@readonly='yes'">
2482 <xsl:text>nsIDPtr</xsl:text>
2483 </xsl:when>
2484 <xsl:otherwise>
2485 <xsl:message terminate="yes">
2486 <xsl:value-of select="../@name"/>
2487 <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
2488 </xsl:message>
2489 </xsl:otherwise>
2490 </xsl:choose>
2491 </xsl:when>
2492 <xsl:when test="name(..)='param'">
2493 <xsl:choose>
2494 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
2495 <xsl:text>nsIDRef</xsl:text>
2496 </xsl:when>
2497 <xsl:otherwise>
2498 <xsl:text>nsIDPtr</xsl:text>
2499 </xsl:otherwise>
2500 </xsl:choose>
2501 </xsl:when>
2502 </xsl:choose>
2503 </xsl:when>
2504 <!-- system interface types -->
2505 <xsl:when test=".='$unknown'">nsISupports</xsl:when>
2506 <xsl:otherwise>
2507 <xsl:choose>
2508 <!-- enum types -->
2509 <xsl:when test="
2510 (ancestor::library/enum[@name=current()]) or
2511 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
2512 ">
2513 <xsl:text>PRUint32</xsl:text>
2514 </xsl:when>
2515 <!-- custom interface types -->
2516 <xsl:when test="
2517 (name(current())='enumerator' and
2518 ((ancestor::library/enumerator[@name=current()]) or
2519 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
2520 ) or
2521 ((ancestor::library/interface[@name=current()]) or
2522 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
2523 )
2524 ">
2525 <xsl:value-of select="."/>
2526 </xsl:when>
2527 <!-- other types -->
2528 <xsl:otherwise>
2529 <xsl:message terminate="yes">
2530 <xsl:text>Unknown parameter type: </xsl:text>
2531 <xsl:value-of select="."/>
2532 </xsl:message>
2533 </xsl:otherwise>
2534 </xsl:choose>
2535 </xsl:otherwise>
2536 </xsl:choose>
2537 </xsl:otherwise>
2538 </xsl:choose>
2539</xsl:template>
2540
2541<xsl:template match="attribute/@type | param/@type" mode="forwarder">
2542
2543 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
2544
2545 <xsl:choose>
2546 <!-- modifiers (ignored for 'enumeration' attributes)-->
2547 <xsl:when test="name(current())='type' and ../@mod">
2548 <xsl:choose>
2549 <xsl:when test="../@mod='ptr'">
2550 <xsl:choose>
2551 <!-- standard types -->
2552 <!--xsl:when test=".='result'">??</xsl:when-->
2553 <xsl:when test=".='boolean'">PRBool *</xsl:when>
2554 <xsl:when test=".='octet'">PRUint8 *</xsl:when>
2555 <xsl:when test=".='short'">PRInt16 *</xsl:when>
2556 <xsl:when test=".='unsigned short'">PRUint16 *</xsl:when>
2557 <xsl:when test=".='long'">PRInt32 *</xsl:when>
2558 <xsl:when test=".='long long'">PRInt64 *</xsl:when>
2559 <xsl:when test=".='unsigned long'">PRUint32 *</xsl:when>
2560 <xsl:when test=".='unsigned long long'">PRUint64 *</xsl:when>
2561 <xsl:otherwise>
2562 <xsl:message terminate="yes">
2563 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2564 <xsl:text>attribute 'mod=</xsl:text>
2565 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2566 <xsl:text>' cannot be used with type </xsl:text>
2567 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2568 </xsl:message>
2569 </xsl:otherwise>
2570 </xsl:choose>
2571 </xsl:when>
2572 <xsl:when test="../@mod='string'">
2573 <xsl:choose>
2574 <!-- standard types -->
2575 <!--xsl:when test=".='result'">??</xsl:when-->
2576 <xsl:when test=".='uuid'">PRUnichar *</xsl:when>
2577 <xsl:otherwise>
2578 <xsl:message terminate="yes">
2579 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
2580 <xsl:text>attribute 'mod=</xsl:text>
2581 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
2582 <xsl:text>' cannot be used with type </xsl:text>
2583 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
2584 </xsl:message>
2585 </xsl:otherwise>
2586 </xsl:choose>
2587 </xsl:when>
2588 </xsl:choose>
2589 </xsl:when>
2590 <!-- no modifiers -->
2591 <xsl:otherwise>
2592 <xsl:choose>
2593 <!-- standard types -->
2594 <xsl:when test=".='result'">nsresult</xsl:when>
2595 <xsl:when test=".='boolean'">PRBool</xsl:when>
2596 <xsl:when test=".='octet'">PRUint8</xsl:when>
2597 <xsl:when test=".='short'">PRInt16</xsl:when>
2598 <xsl:when test=".='unsigned short'">PRUint16</xsl:when>
2599 <xsl:when test=".='long'">PRInt32</xsl:when>
2600 <xsl:when test=".='long long'">PRInt64</xsl:when>
2601 <xsl:when test=".='unsigned long'">PRUint32</xsl:when>
2602 <xsl:when test=".='unsigned long long'">PRUint64</xsl:when>
2603 <xsl:when test=".='char'">char</xsl:when>
2604 <xsl:when test=".='wchar'">PRUnichar</xsl:when>
2605 <!-- string types -->
2606 <xsl:when test=".='string'">char *</xsl:when>
2607 <xsl:when test=".='wstring'">PRUnichar *</xsl:when>
2608 <!-- UUID type -->
2609 <xsl:when test=".='uuid'">
2610 <xsl:choose>
2611 <xsl:when test="name(..)='attribute'">
2612 <xsl:choose>
2613 <xsl:when test="../@readonly='yes'">
2614 <xsl:text>nsID *</xsl:text>
2615 </xsl:when>
2616 </xsl:choose>
2617 </xsl:when>
2618 <xsl:when test="name(..)='param'">
2619 <xsl:choose>
2620 <xsl:when test="../@dir='in' and not(../@safearray='yes')">
2621 <xsl:text>const nsID *</xsl:text>
2622 </xsl:when>
2623 <xsl:otherwise>
2624 <xsl:text>nsID *</xsl:text>
2625 </xsl:otherwise>
2626 </xsl:choose>
2627 </xsl:when>
2628 </xsl:choose>
2629 </xsl:when>
2630 <!-- system interface types -->
2631 <xsl:when test=".='$unknown'">nsISupports *</xsl:when>
2632 <xsl:otherwise>
2633 <xsl:choose>
2634 <!-- enum types -->
2635 <xsl:when test="
2636 (ancestor::library/enum[@name=current()]) or
2637 (ancestor::library/if[@target=$self_target]/enum[@name=current()])
2638 ">
2639 <xsl:text>PRUint32</xsl:text>
2640 </xsl:when>
2641 <!-- custom interface types -->
2642 <xsl:when test="
2643 (name(current())='enumerator' and
2644 ((ancestor::library/enumerator[@name=current()]) or
2645 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
2646 ) or
2647 ((ancestor::library/interface[@name=current()]) or
2648 (ancestor::library/if[@target=$self_target]/interface[@name=current()])
2649 )
2650 ">
2651 <xsl:value-of select="."/>
2652 <xsl:text> *</xsl:text>
2653 </xsl:when>
2654 <!-- other types -->
2655 </xsl:choose>
2656 </xsl:otherwise>
2657 </xsl:choose>
2658 </xsl:otherwise>
2659 </xsl:choose>
2660</xsl:template>
2661
2662</xsl:stylesheet>
2663
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