VirtualBox

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

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

Main/cbinding: final touchups, and making things as COM compatible as possible, even where it shouldn't really matter

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

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