1 | <?xml version="1.0"?>
|
---|
2 | <!-- $Id: xpidl.xsl 39869 2008-11-25 13:37:40Z dmik $ -->
|
---|
3 |
|
---|
4 | <!--
|
---|
5 | * A template to generate a XPCOM IDL compatible interface definition file
|
---|
6 | * from the generic interface definition expressed in XML.
|
---|
7 |
|
---|
8 | Copyright (C) 2008-2009 Sun Microsystems, Inc.
|
---|
9 |
|
---|
10 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | available from http://www.virtualbox.org. This file is free software;
|
---|
12 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | General Public License (GPL) as published by the Free Software
|
---|
14 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 |
|
---|
18 | Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | additional information or have any questions.
|
---|
21 | -->
|
---|
22 |
|
---|
23 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
---|
24 | <xsl:output method="text"/>
|
---|
25 |
|
---|
26 | <xsl:strip-space elements="*"/>
|
---|
27 |
|
---|
28 |
|
---|
29 | <!--
|
---|
30 | // helper definitions
|
---|
31 | /////////////////////////////////////////////////////////////////////////////
|
---|
32 | -->
|
---|
33 |
|
---|
34 | <!--
|
---|
35 | * capitalizes the first letter
|
---|
36 | -->
|
---|
37 | <xsl:template name="capitalize">
|
---|
38 | <xsl:param name="str" select="."/>
|
---|
39 | <xsl:value-of select="
|
---|
40 | concat(
|
---|
41 | translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
|
---|
42 | substring($str,2)
|
---|
43 | )
|
---|
44 | "/>
|
---|
45 | </xsl:template>
|
---|
46 |
|
---|
47 | <!--
|
---|
48 | * uncapitalizes the first letter only if the second one is not capital
|
---|
49 | * otherwise leaves the string unchanged
|
---|
50 | -->
|
---|
51 | <xsl:template name="uncapitalize">
|
---|
52 | <xsl:param name="str" select="."/>
|
---|
53 | <xsl:choose>
|
---|
54 | <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
|
---|
55 | <xsl:value-of select="
|
---|
56 | concat(
|
---|
57 | translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
|
---|
58 | substring($str,2)
|
---|
59 | )
|
---|
60 | "/>
|
---|
61 | </xsl:when>
|
---|
62 | <xsl:otherwise>
|
---|
63 | <xsl:value-of select="string($str)"/>
|
---|
64 | </xsl:otherwise>
|
---|
65 | </xsl:choose>
|
---|
66 | </xsl:template>
|
---|
67 |
|
---|
68 | <!--
|
---|
69 | * translates the string to uppercase
|
---|
70 | -->
|
---|
71 | <xsl:template name="uppercase">
|
---|
72 | <xsl:param name="str" select="."/>
|
---|
73 | <xsl:value-of select="
|
---|
74 | translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
---|
75 | "/>
|
---|
76 | </xsl:template>
|
---|
77 |
|
---|
78 |
|
---|
79 | <!--
|
---|
80 | * translates the string to lowercase
|
---|
81 | -->
|
---|
82 | <xsl:template name="lowercase">
|
---|
83 | <xsl:param name="str" select="."/>
|
---|
84 | <xsl:value-of select="
|
---|
85 | translate($str,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')
|
---|
86 | "/>
|
---|
87 | </xsl:template>
|
---|
88 |
|
---|
89 |
|
---|
90 | <!--
|
---|
91 | // templates
|
---|
92 | /////////////////////////////////////////////////////////////////////////////
|
---|
93 | -->
|
---|
94 |
|
---|
95 |
|
---|
96 | <!--
|
---|
97 | * not explicitly matched elements and attributes
|
---|
98 | -->
|
---|
99 | <xsl:template match="*"/>
|
---|
100 |
|
---|
101 |
|
---|
102 | <!--
|
---|
103 | * header
|
---|
104 | -->
|
---|
105 | <xsl:template match="/idl">
|
---|
106 | <xsl:text>
|
---|
107 | /*
|
---|
108 | * DO NOT EDIT! This is a generated file.
|
---|
109 | *
|
---|
110 | * XPCOM IDL (XPIDL) definition for VirtualBox Main API (COM interfaces)
|
---|
111 | * generated from XIDL (XML interface definition).
|
---|
112 | *
|
---|
113 | * Source : src/VBox/Main/idl/VirtualBox.xidl
|
---|
114 | * Generator : src/VBox/Main/idl/xpcidl.xsl
|
---|
115 | *
|
---|
116 | * This file contains portions from the following Mozilla XPCOM files:
|
---|
117 | * xpcom/include/xpcom/nsID.h
|
---|
118 | * xpcom/include/nsIException.h
|
---|
119 | * xpcom/include/nsprpub/prtypes.h
|
---|
120 | * xpcom/include/xpcom/nsISupportsBase.h
|
---|
121 | *
|
---|
122 | * These files were originally triple-licensed (MPL/GPL2/LGPL2.1). Sun
|
---|
123 | * elects to distribute this derived work under the LGPL2.1 only.
|
---|
124 | */
|
---|
125 |
|
---|
126 | /*
|
---|
127 | * Copyright (C) 2008-2009 Sun Microsystems, Inc.
|
---|
128 | *
|
---|
129 | * This file is part of a free software library; you can redistribute
|
---|
130 | * it and/or modify it under the terms of the GNU Lesser General
|
---|
131 | * Public License version 2.1 as published by the Free Software
|
---|
132 | * Foundation and shipped in the "COPYING" file with this library.
|
---|
133 | * The library is distributed in the hope that it will be useful,
|
---|
134 | * but WITHOUT ANY WARRANTY of any kind.
|
---|
135 | *
|
---|
136 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if
|
---|
137 | * any license choice other than GPL or LGPL is available it will
|
---|
138 | * apply instead, Sun elects to use only the Lesser General Public
|
---|
139 | * License version 2.1 (LGPLv2) at this time for any software where
|
---|
140 | * a choice of LGPL license versions is made available with the
|
---|
141 | * language indicating that LGPLv2 or any later version may be used,
|
---|
142 | * or where a choice of which version of the LGPL is applied is
|
---|
143 | * otherwise unspecified.
|
---|
144 | *
|
---|
145 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
146 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
147 | * additional information or have any questions.
|
---|
148 | */
|
---|
149 |
|
---|
150 | #ifndef ___VirtualBox_CXPCOM_h
|
---|
151 | #define ___VirtualBox_CXPCOM_h
|
---|
152 |
|
---|
153 | #ifdef __cplusplus
|
---|
154 | # include "VirtualBox_XPCOM.h"
|
---|
155 | #else /* !__cplusplus */
|
---|
156 |
|
---|
157 | #include <stddef.h>
|
---|
158 | #include "wchar.h"
|
---|
159 |
|
---|
160 | #if defined(WIN32)
|
---|
161 |
|
---|
162 | #define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
---|
163 | #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
---|
164 | #define PR_IMPORT(__type) __declspec(dllimport) __type
|
---|
165 | #define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
|
---|
166 |
|
---|
167 | #define PR_EXTERN(__type) extern __declspec(dllexport) __type
|
---|
168 | #define PR_IMPLEMENT(__type) __declspec(dllexport) __type
|
---|
169 | #define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
---|
170 | #define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
|
---|
171 |
|
---|
172 | #define PR_CALLBACK
|
---|
173 | #define PR_CALLBACK_DECL
|
---|
174 | #define PR_STATIC_CALLBACK(__x) static __x
|
---|
175 |
|
---|
176 | #elif defined(XP_BEOS)
|
---|
177 |
|
---|
178 | #define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
---|
179 | #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
---|
180 | #define PR_IMPORT(__type) extern __declspec(dllexport) __type
|
---|
181 | #define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
|
---|
182 |
|
---|
183 | #define PR_EXTERN(__type) extern __declspec(dllexport) __type
|
---|
184 | #define PR_IMPLEMENT(__type) __declspec(dllexport) __type
|
---|
185 | #define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
---|
186 | #define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
|
---|
187 |
|
---|
188 | #define PR_CALLBACK
|
---|
189 | #define PR_CALLBACK_DECL
|
---|
190 | #define PR_STATIC_CALLBACK(__x) static __x
|
---|
191 |
|
---|
192 | #elif defined(WIN16)
|
---|
193 |
|
---|
194 | #define PR_CALLBACK_DECL __cdecl
|
---|
195 |
|
---|
196 | #if defined(_WINDLL)
|
---|
197 | #define PR_EXPORT(__type) extern __type _cdecl _export _loadds
|
---|
198 | #define PR_IMPORT(__type) extern __type _cdecl _export _loadds
|
---|
199 | #define PR_EXPORT_DATA(__type) extern __type _export
|
---|
200 | #define PR_IMPORT_DATA(__type) extern __type _export
|
---|
201 |
|
---|
202 | #define PR_EXTERN(__type) extern __type _cdecl _export _loadds
|
---|
203 | #define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
|
---|
204 | #define PR_EXTERN_DATA(__type) extern __type _export
|
---|
205 | #define PR_IMPLEMENT_DATA(__type) __type _export
|
---|
206 |
|
---|
207 | #define PR_CALLBACK __cdecl __loadds
|
---|
208 | #define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
|
---|
209 |
|
---|
210 | #else /* this must be .EXE */
|
---|
211 | #define PR_EXPORT(__type) extern __type _cdecl _export
|
---|
212 | #define PR_IMPORT(__type) extern __type _cdecl _export
|
---|
213 | #define PR_EXPORT_DATA(__type) extern __type _export
|
---|
214 | #define PR_IMPORT_DATA(__type) extern __type _export
|
---|
215 |
|
---|
216 | #define PR_EXTERN(__type) extern __type _cdecl _export
|
---|
217 | #define PR_IMPLEMENT(__type) __type _cdecl _export
|
---|
218 | #define PR_EXTERN_DATA(__type) extern __type _export
|
---|
219 | #define PR_IMPLEMENT_DATA(__type) __type _export
|
---|
220 |
|
---|
221 | #define PR_CALLBACK __cdecl __loadds
|
---|
222 | #define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
|
---|
223 | #endif /* _WINDLL */
|
---|
224 |
|
---|
225 | #elif defined(XP_MAC)
|
---|
226 |
|
---|
227 | #define PR_EXPORT(__type) extern __declspec(export) __type
|
---|
228 | #define PR_EXPORT_DATA(__type) extern __declspec(export) __type
|
---|
229 | #define PR_IMPORT(__type) extern __declspec(export) __type
|
---|
230 | #define PR_IMPORT_DATA(__type) extern __declspec(export) __type
|
---|
231 |
|
---|
232 | #define PR_EXTERN(__type) extern __declspec(export) __type
|
---|
233 | #define PR_IMPLEMENT(__type) __declspec(export) __type
|
---|
234 | #define PR_EXTERN_DATA(__type) extern __declspec(export) __type
|
---|
235 | #define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
|
---|
236 |
|
---|
237 | #define PR_CALLBACK
|
---|
238 | #define PR_CALLBACK_DECL
|
---|
239 | #define PR_STATIC_CALLBACK(__x) static __x
|
---|
240 |
|
---|
241 | #elif defined(XP_OS2) && defined(__declspec)
|
---|
242 |
|
---|
243 | #define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
---|
244 | #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
---|
245 | #define PR_IMPORT(__type) __declspec(dllimport) __type
|
---|
246 | #define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
|
---|
247 |
|
---|
248 | #define PR_EXTERN(__type) extern __declspec(dllexport) __type
|
---|
249 | #define PR_IMPLEMENT(__type) __declspec(dllexport) __type
|
---|
250 | #define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
---|
251 | #define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
|
---|
252 |
|
---|
253 | #define PR_CALLBACK
|
---|
254 | #define PR_CALLBACK_DECL
|
---|
255 | #define PR_STATIC_CALLBACK(__x) static __x
|
---|
256 |
|
---|
257 | #elif defined(XP_OS2_VACPP)
|
---|
258 |
|
---|
259 | #define PR_EXPORT(__type) extern __type
|
---|
260 | #define PR_EXPORT_DATA(__type) extern __type
|
---|
261 | #define PR_IMPORT(__type) extern __type
|
---|
262 | #define PR_IMPORT_DATA(__type) extern __type
|
---|
263 |
|
---|
264 | #define PR_EXTERN(__type) extern __type
|
---|
265 | #define PR_IMPLEMENT(__type) __type
|
---|
266 | #define PR_EXTERN_DATA(__type) extern __type
|
---|
267 | #define PR_IMPLEMENT_DATA(__type) __type
|
---|
268 | #define PR_CALLBACK _Optlink
|
---|
269 | #define PR_CALLBACK_DECL
|
---|
270 | #define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
|
---|
271 |
|
---|
272 | #else /* Unix */
|
---|
273 |
|
---|
274 | # ifdef VBOX_HAVE_VISIBILITY_HIDDEN
|
---|
275 | # define PR_EXPORT(__type) __attribute__((visibility("default"))) extern __type
|
---|
276 | # define PR_EXPORT_DATA(__type) __attribute__((visibility("default"))) extern __type
|
---|
277 | # define PR_IMPORT(__type) extern __type
|
---|
278 | # define PR_IMPORT_DATA(__type) extern __type
|
---|
279 | # define PR_EXTERN(__type) __attribute__((visibility("default"))) extern __type
|
---|
280 | # define PR_IMPLEMENT(__type) __attribute__((visibility("default"))) __type
|
---|
281 | # define PR_EXTERN_DATA(__type) __attribute__((visibility("default"))) extern __type
|
---|
282 | # define PR_IMPLEMENT_DATA(__type) __attribute__((visibility("default"))) __type
|
---|
283 | # define PR_CALLBACK
|
---|
284 | # define PR_CALLBACK_DECL
|
---|
285 | # define PR_STATIC_CALLBACK(__x) static __x
|
---|
286 | # else
|
---|
287 | # define PR_EXPORT(__type) extern __type
|
---|
288 | # define PR_EXPORT_DATA(__type) extern __type
|
---|
289 | # define PR_IMPORT(__type) extern __type
|
---|
290 | # define PR_IMPORT_DATA(__type) extern __type
|
---|
291 | # define PR_EXTERN(__type) extern __type
|
---|
292 | # define PR_IMPLEMENT(__type) __type
|
---|
293 | # define PR_EXTERN_DATA(__type) extern __type
|
---|
294 | # define PR_IMPLEMENT_DATA(__type) __type
|
---|
295 | # define PR_CALLBACK
|
---|
296 | # define PR_CALLBACK_DECL
|
---|
297 | # define PR_STATIC_CALLBACK(__x) static __x
|
---|
298 | # endif
|
---|
299 | #endif
|
---|
300 |
|
---|
301 | #if defined(_NSPR_BUILD_)
|
---|
302 | #define NSPR_API(__type) PR_EXPORT(__type)
|
---|
303 | #define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
|
---|
304 | #else
|
---|
305 | #define NSPR_API(__type) PR_IMPORT(__type)
|
---|
306 | #define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | typedef unsigned char PRUint8;
|
---|
310 | #if (defined(HPUX) && defined(__cplusplus) \
|
---|
311 | && !defined(__GNUC__) && __cplusplus < 199707L) \
|
---|
312 | || (defined(SCO) && defined(__cplusplus) \
|
---|
313 | && !defined(__GNUC__) && __cplusplus == 1L)
|
---|
314 | typedef char PRInt8;
|
---|
315 | #else
|
---|
316 | typedef signed char PRInt8;
|
---|
317 | #endif
|
---|
318 |
|
---|
319 | #define PR_INT8_MAX 127
|
---|
320 | #define PR_INT8_MIN (-128)
|
---|
321 | #define PR_UINT8_MAX 255U
|
---|
322 |
|
---|
323 | typedef unsigned short PRUint16;
|
---|
324 | typedef short PRInt16;
|
---|
325 |
|
---|
326 | #define PR_INT16_MAX 32767
|
---|
327 | #define PR_INT16_MIN (-32768)
|
---|
328 | #define PR_UINT16_MAX 65535U
|
---|
329 |
|
---|
330 | typedef unsigned int PRUint32;
|
---|
331 | typedef int PRInt32;
|
---|
332 | #define PR_INT32(x) x
|
---|
333 | #define PR_UINT32(x) x ## U
|
---|
334 |
|
---|
335 | #define PR_INT32_MAX PR_INT32(2147483647)
|
---|
336 | #define PR_INT32_MIN (-PR_INT32_MAX - 1)
|
---|
337 | #define PR_UINT32_MAX PR_UINT32(4294967295)
|
---|
338 |
|
---|
339 | typedef long PRInt64;
|
---|
340 | typedef unsigned long PRUint64;
|
---|
341 | typedef int PRIntn;
|
---|
342 | typedef unsigned int PRUintn;
|
---|
343 |
|
---|
344 | typedef double PRFloat64;
|
---|
345 | typedef size_t PRSize;
|
---|
346 |
|
---|
347 | typedef ptrdiff_t PRPtrdiff;
|
---|
348 |
|
---|
349 | typedef unsigned long PRUptrdiff;
|
---|
350 |
|
---|
351 | typedef PRIntn PRBool;
|
---|
352 |
|
---|
353 | #define PR_TRUE 1
|
---|
354 | #define PR_FALSE 0
|
---|
355 |
|
---|
356 | typedef PRUint8 PRPackedBool;
|
---|
357 |
|
---|
358 | /*
|
---|
359 | ** Status code used by some routines that have a single point of failure or
|
---|
360 | ** special status return.
|
---|
361 | */
|
---|
362 | typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
|
---|
363 |
|
---|
364 | #ifndef __PRUNICHAR__
|
---|
365 | #define __PRUNICHAR__
|
---|
366 | #if defined(WIN32) || defined(XP_MAC)
|
---|
367 | typedef wchar_t PRUnichar;
|
---|
368 | #else
|
---|
369 | typedef PRUint16 PRUnichar;
|
---|
370 | #endif
|
---|
371 | #endif
|
---|
372 |
|
---|
373 | typedef long PRWord;
|
---|
374 | typedef unsigned long PRUword;
|
---|
375 |
|
---|
376 | #define nsnull 0
|
---|
377 | typedef PRUint32 nsresult;
|
---|
378 |
|
---|
379 | #if defined(__GNUC__) && (__GNUC__ > 2)
|
---|
380 | #define NS_LIKELY(x) (__builtin_expect((x), 1))
|
---|
381 | #define NS_UNLIKELY(x) (__builtin_expect((x), 0))
|
---|
382 | #else
|
---|
383 | #define NS_LIKELY(x) (x)
|
---|
384 | #define NS_UNLIKELY(x) (x)
|
---|
385 | #endif
|
---|
386 |
|
---|
387 | #define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000))
|
---|
388 | #define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000)))
|
---|
389 |
|
---|
390 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
391 | # define PR_IntervalNow VBoxNsprPR_IntervalNow
|
---|
392 | # define PR_TicksPerSecond VBoxNsprPR_TicksPerSecond
|
---|
393 | # define PR_SecondsToInterval VBoxNsprPR_SecondsToInterval
|
---|
394 | # define PR_MillisecondsToInterval VBoxNsprPR_MillisecondsToInterval
|
---|
395 | # define PR_MicrosecondsToInterval VBoxNsprPR_MicrosecondsToInterval
|
---|
396 | # define PR_IntervalToSeconds VBoxNsprPR_IntervalToSeconds
|
---|
397 | # define PR_IntervalToMilliseconds VBoxNsprPR_IntervalToMilliseconds
|
---|
398 | # define PR_IntervalToMicroseconds VBoxNsprPR_IntervalToMicroseconds
|
---|
399 | # define PR_EnterMonitor VBoxNsprPR_EnterMonitor
|
---|
400 | # define PR_ExitMonitor VBoxNsprPR_ExitMonitor
|
---|
401 | # define PR_Notify VBoxNsprPR_Notify
|
---|
402 | # define PR_NotifyAll VBoxNsprPR_NotifyAll
|
---|
403 | # define PR_Wait VBoxNsprPR_Wait
|
---|
404 | # define PR_NewMonitor VBoxNsprPR_NewMonitor
|
---|
405 | # define PR_DestroyMonitor VBoxNsprPR_DestroyMonitor
|
---|
406 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
407 |
|
---|
408 | typedef PRUint32 PRIntervalTime;
|
---|
409 |
|
---|
410 | #define PR_INTERVAL_MIN 1000UL
|
---|
411 | #define PR_INTERVAL_MAX 100000UL
|
---|
412 | #define PR_INTERVAL_NO_WAIT 0UL
|
---|
413 | #define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL
|
---|
414 |
|
---|
415 | NSPR_API(PRIntervalTime) PR_IntervalNow(void);
|
---|
416 | NSPR_API(PRUint32) PR_TicksPerSecond(void);
|
---|
417 | NSPR_API(PRIntervalTime) PR_SecondsToInterval(PRUint32 seconds);
|
---|
418 | NSPR_API(PRIntervalTime) PR_MillisecondsToInterval(PRUint32 milli);
|
---|
419 | NSPR_API(PRIntervalTime) PR_MicrosecondsToInterval(PRUint32 micro);
|
---|
420 | NSPR_API(PRUint32) PR_IntervalToSeconds(PRIntervalTime ticks);
|
---|
421 | NSPR_API(PRUint32) PR_IntervalToMilliseconds(PRIntervalTime ticks);
|
---|
422 | NSPR_API(PRUint32) PR_IntervalToMicroseconds(PRIntervalTime ticks);
|
---|
423 |
|
---|
424 | typedef struct PRMonitor PRMonitor;
|
---|
425 |
|
---|
426 | NSPR_API(PRMonitor*) PR_NewMonitor(void);
|
---|
427 | NSPR_API(void) PR_DestroyMonitor(PRMonitor *mon);
|
---|
428 | NSPR_API(void) PR_EnterMonitor(PRMonitor *mon);
|
---|
429 | NSPR_API(PRStatus) PR_ExitMonitor(PRMonitor *mon);
|
---|
430 | NSPR_API(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime ticks);
|
---|
431 | NSPR_API(PRStatus) PR_Notify(PRMonitor *mon);
|
---|
432 | NSPR_API(PRStatus) PR_NotifyAll(PRMonitor *mon);
|
---|
433 |
|
---|
434 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
435 | # define PR_CreateThread VBoxNsprPR_CreateThread
|
---|
436 | # define PR_JoinThread VBoxNsprPR_JoinThread
|
---|
437 | # define PR_Sleep VBoxNsprPR_Sleep
|
---|
438 | # define PR_GetCurrentThread VBoxNsprPR_GetCurrentThread
|
---|
439 | # define PR_GetThreadState VBoxNsprPR_GetThreadState
|
---|
440 | # define PR_SetThreadPrivate VBoxNsprPR_SetThreadPrivate
|
---|
441 | # define PR_GetThreadPrivate VBoxNsprPR_GetThreadPrivate
|
---|
442 | # define PR_NewThreadPrivateIndex VBoxNsprPR_NewThreadPrivateIndex
|
---|
443 | # define PR_GetThreadPriority VBoxNsprPR_GetThreadPriority
|
---|
444 | # define PR_SetThreadPriority VBoxNsprPR_SetThreadPriority
|
---|
445 | # define PR_Interrupt VBoxNsprPR_Interrupt
|
---|
446 | # define PR_ClearInterrupt VBoxNsprPR_ClearInterrupt
|
---|
447 | # define PR_BlockInterrupt VBoxNsprPR_BlockInterrupt
|
---|
448 | # define PR_UnblockInterrupt VBoxNsprPR_UnblockInterrupt
|
---|
449 | # define PR_GetThreadScope VBoxNsprPR_GetThreadScope
|
---|
450 | # define PR_GetThreadType VBoxNsprPR_GetThreadType
|
---|
451 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
452 |
|
---|
453 | typedef struct PRThread PRThread;
|
---|
454 | typedef struct PRThreadStack PRThreadStack;
|
---|
455 |
|
---|
456 | typedef enum PRThreadType {
|
---|
457 | PR_USER_THREAD,
|
---|
458 | PR_SYSTEM_THREAD
|
---|
459 | } PRThreadType;
|
---|
460 |
|
---|
461 | typedef enum PRThreadScope {
|
---|
462 | PR_LOCAL_THREAD,
|
---|
463 | PR_GLOBAL_THREAD,
|
---|
464 | PR_GLOBAL_BOUND_THREAD
|
---|
465 | } PRThreadScope;
|
---|
466 |
|
---|
467 | typedef enum PRThreadState {
|
---|
468 | PR_JOINABLE_THREAD,
|
---|
469 | PR_UNJOINABLE_THREAD
|
---|
470 | } PRThreadState;
|
---|
471 |
|
---|
472 | typedef enum PRThreadPriority
|
---|
473 | {
|
---|
474 | PR_PRIORITY_FIRST = 0, /* just a placeholder */
|
---|
475 | PR_PRIORITY_LOW = 0, /* the lowest possible priority */
|
---|
476 | PR_PRIORITY_NORMAL = 1, /* most common expected priority */
|
---|
477 | PR_PRIORITY_HIGH = 2, /* slightly more aggressive scheduling */
|
---|
478 | PR_PRIORITY_URGENT = 3, /* it does little good to have more than one */
|
---|
479 | PR_PRIORITY_LAST = 3 /* this is just a placeholder */
|
---|
480 | } PRThreadPriority;
|
---|
481 |
|
---|
482 | NSPR_API(PRThread*) PR_CreateThread(PRThreadType type,
|
---|
483 | void (PR_CALLBACK *start)(void *arg),
|
---|
484 | void *arg,
|
---|
485 | PRThreadPriority priority,
|
---|
486 | PRThreadScope scope,
|
---|
487 | PRThreadState state,
|
---|
488 | PRUint32 stackSize);
|
---|
489 | NSPR_API(PRStatus) PR_JoinThread(PRThread *thread);
|
---|
490 | NSPR_API(PRThread*) PR_GetCurrentThread(void);
|
---|
491 | #ifndef NO_NSPR_10_SUPPORT
|
---|
492 | #define PR_CurrentThread() PR_GetCurrentThread() /* for nspr1.0 compat. */
|
---|
493 | #endif /* NO_NSPR_10_SUPPORT */
|
---|
494 | NSPR_API(PRThreadPriority) PR_GetThreadPriority(const PRThread *thread);
|
---|
495 | NSPR_API(void) PR_SetThreadPriority(PRThread *thread, PRThreadPriority priority);
|
---|
496 |
|
---|
497 | typedef void (PR_CALLBACK *PRThreadPrivateDTOR)(void *priv);
|
---|
498 |
|
---|
499 | NSPR_API(PRStatus) PR_NewThreadPrivateIndex(
|
---|
500 | PRUintn *newIndex, PRThreadPrivateDTOR destructor);
|
---|
501 | NSPR_API(PRStatus) PR_SetThreadPrivate(PRUintn tpdIndex, void *priv);
|
---|
502 | NSPR_API(void*) PR_GetThreadPrivate(PRUintn tpdIndex);
|
---|
503 | NSPR_API(PRStatus) PR_Interrupt(PRThread *thread);
|
---|
504 | NSPR_API(void) PR_ClearInterrupt(void);
|
---|
505 | NSPR_API(void) PR_BlockInterrupt(void);
|
---|
506 | NSPR_API(void) PR_UnblockInterrupt(void);
|
---|
507 | NSPR_API(PRStatus) PR_Sleep(PRIntervalTime ticks);
|
---|
508 | NSPR_API(PRThreadScope) PR_GetThreadScope(const PRThread *thread);
|
---|
509 | NSPR_API(PRThreadType) PR_GetThreadType(const PRThread *thread);
|
---|
510 | NSPR_API(PRThreadState) PR_GetThreadState(const PRThread *thread);
|
---|
511 |
|
---|
512 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
513 | # define PR_DestroyLock VBoxNsprPR_DestroyLock
|
---|
514 | # define PR_Lock VBoxNsprPR_Lock
|
---|
515 | # define PR_NewLock VBoxNsprPR_NewLock
|
---|
516 | # define PR_Unlock VBoxNsprPR_Unlock
|
---|
517 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
518 |
|
---|
519 | typedef struct PRLock PRLock;
|
---|
520 |
|
---|
521 | NSPR_API(PRLock*) PR_NewLock(void);
|
---|
522 | NSPR_API(void) PR_DestroyLock(PRLock *lock);
|
---|
523 | NSPR_API(void) PR_Lock(PRLock *lock);
|
---|
524 | NSPR_API(PRStatus) PR_Unlock(PRLock *lock);
|
---|
525 |
|
---|
526 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
527 | # define PR_NewCondVar VBoxNsprPR_NewCondVar
|
---|
528 | # define PR_DestroyCondVar VBoxNsprPR_DestroyCondVar
|
---|
529 | # define PR_WaitCondVar VBoxNsprPR_WaitCondVar
|
---|
530 | # define PR_NotifyCondVar VBoxNsprPR_NotifyCondVar
|
---|
531 | # define PR_NotifyAllCondVar VBoxNsprPR_NotifyAllCondVar
|
---|
532 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
533 |
|
---|
534 | typedef struct PRCondVar PRCondVar;
|
---|
535 |
|
---|
536 | NSPR_API(PRCondVar*) PR_NewCondVar(PRLock *lock);
|
---|
537 | NSPR_API(void) PR_DestroyCondVar(PRCondVar *cvar);
|
---|
538 | NSPR_API(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout);
|
---|
539 | NSPR_API(PRStatus) PR_NotifyCondVar(PRCondVar *cvar);
|
---|
540 | NSPR_API(PRStatus) PR_NotifyAllCondVar(PRCondVar *cvar);
|
---|
541 |
|
---|
542 | typedef struct PRCListStr PRCList;
|
---|
543 |
|
---|
544 | struct PRCListStr {
|
---|
545 | PRCList *next;
|
---|
546 | PRCList *prev;
|
---|
547 | };
|
---|
548 |
|
---|
549 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
550 | # define PL_DestroyEvent VBoxNsplPL_DestroyEvent
|
---|
551 | # define PL_HandleEvent VBoxNsplPL_HandleEvent
|
---|
552 | # define PL_InitEvent VBoxNsplPL_InitEvent
|
---|
553 | # define PL_CreateEventQueue VBoxNsplPL_CreateEventQueue
|
---|
554 | # define PL_CreateMonitoredEventQueue VBoxNsplPL_CreateMonitoredEventQueue
|
---|
555 | # define PL_CreateNativeEventQueue VBoxNsplPL_CreateNativeEventQueue
|
---|
556 | # define PL_DequeueEvent VBoxNsplPL_DequeueEvent
|
---|
557 | # define PL_DestroyEventQueue VBoxNsplPL_DestroyEventQueue
|
---|
558 | # define PL_EventAvailable VBoxNsplPL_EventAvailable
|
---|
559 | # define PL_EventLoop VBoxNsplPL_EventLoop
|
---|
560 | # define PL_GetEvent VBoxNsplPL_GetEvent
|
---|
561 | # define PL_GetEventOwner VBoxNsplPL_GetEventOwner
|
---|
562 | # define PL_GetEventQueueMonitor VBoxNsplPL_GetEventQueueMonitor
|
---|
563 | # define PL_GetEventQueueSelectFD VBoxNsplPL_GetEventQueueSelectFD
|
---|
564 | # define PL_MapEvents VBoxNsplPL_MapEvents
|
---|
565 | # define PL_PostEvent VBoxNsplPL_PostEvent
|
---|
566 | # define PL_PostSynchronousEvent VBoxNsplPL_PostSynchronousEvent
|
---|
567 | # define PL_ProcessEventsBeforeID VBoxNsplPL_ProcessEventsBeforeID
|
---|
568 | # define PL_ProcessPendingEvents VBoxNsplPL_ProcessPendingEvents
|
---|
569 | # define PL_RegisterEventIDFunc VBoxNsplPL_RegisterEventIDFunc
|
---|
570 | # define PL_RevokeEvents VBoxNsplPL_RevokeEvents
|
---|
571 | # define PL_UnregisterEventIDFunc VBoxNsplPL_UnregisterEventIDFunc
|
---|
572 | # define PL_WaitForEvent VBoxNsplPL_WaitForEvent
|
---|
573 | # define PL_IsQueueNative VBoxNsplPL_IsQueueNative
|
---|
574 | # define PL_IsQueueOnCurrentThread VBoxNsplPL_IsQueueOnCurrentThread
|
---|
575 | # define PL_FavorPerformanceHint VBoxNsplPL_FavorPerformanceHint
|
---|
576 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
577 |
|
---|
578 | typedef struct PLEvent PLEvent;
|
---|
579 | typedef struct PLEventQueue PLEventQueue;
|
---|
580 |
|
---|
581 | PR_EXTERN(PLEventQueue*)
|
---|
582 | PL_CreateEventQueue(const char* name, PRThread* handlerThread);
|
---|
583 | PR_EXTERN(PLEventQueue *)
|
---|
584 | PL_CreateNativeEventQueue(
|
---|
585 | const char *name,
|
---|
586 | PRThread *handlerThread
|
---|
587 | );
|
---|
588 | PR_EXTERN(PLEventQueue *)
|
---|
589 | PL_CreateMonitoredEventQueue(
|
---|
590 | const char *name,
|
---|
591 | PRThread *handlerThread
|
---|
592 | );
|
---|
593 | PR_EXTERN(void)
|
---|
594 | PL_DestroyEventQueue(PLEventQueue* self);
|
---|
595 | PR_EXTERN(PRMonitor*)
|
---|
596 | PL_GetEventQueueMonitor(PLEventQueue* self);
|
---|
597 |
|
---|
598 | #define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
---|
599 | PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
---|
600 |
|
---|
601 | #define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
---|
602 | PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
---|
603 |
|
---|
604 | PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
---|
605 | PR_EXTERN(void*) PL_PostSynchronousEvent(PLEventQueue* self, PLEvent* event);
|
---|
606 | PR_EXTERN(PLEvent*) PL_GetEvent(PLEventQueue* self);
|
---|
607 | PR_EXTERN(PRBool) PL_EventAvailable(PLEventQueue* self);
|
---|
608 |
|
---|
609 | typedef void (PR_CALLBACK *PLEventFunProc)(PLEvent* event, void* data, PLEventQueue* queue);
|
---|
610 |
|
---|
611 | PR_EXTERN(void) PL_MapEvents(PLEventQueue* self, PLEventFunProc fun, void* data);
|
---|
612 | PR_EXTERN(void) PL_RevokeEvents(PLEventQueue* self, void* owner);
|
---|
613 | PR_EXTERN(void) PL_ProcessPendingEvents(PLEventQueue* self);
|
---|
614 | PR_EXTERN(PLEvent*) PL_WaitForEvent(PLEventQueue* self);
|
---|
615 | PR_EXTERN(void) PL_EventLoop(PLEventQueue* self);
|
---|
616 | PR_EXTERN(PRInt32) PL_GetEventQueueSelectFD(PLEventQueue* self);
|
---|
617 | PR_EXTERN(PRBool) PL_IsQueueOnCurrentThread( PLEventQueue *queue );
|
---|
618 | PR_EXTERN(PRBool) PL_IsQueueNative(PLEventQueue *queue);
|
---|
619 |
|
---|
620 | typedef void* (PR_CALLBACK *PLHandleEventProc)(PLEvent* self);
|
---|
621 | typedef void (PR_CALLBACK *PLDestroyEventProc)(PLEvent* self);
|
---|
622 | PR_EXTERN(void)
|
---|
623 | PL_InitEvent(PLEvent* self, void* owner,
|
---|
624 | PLHandleEventProc handler,
|
---|
625 | PLDestroyEventProc destructor);
|
---|
626 | PR_EXTERN(void*) PL_GetEventOwner(PLEvent* self);
|
---|
627 | PR_EXTERN(void) PL_HandleEvent(PLEvent* self);
|
---|
628 | PR_EXTERN(void) PL_DestroyEvent(PLEvent* self);
|
---|
629 | PR_EXTERN(void) PL_DequeueEvent(PLEvent* self, PLEventQueue* queue);
|
---|
630 | PR_EXTERN(void) PL_FavorPerformanceHint(PRBool favorPerformanceOverEventStarvation, PRUint32 starvationDelay);
|
---|
631 |
|
---|
632 | struct PLEvent {
|
---|
633 | PRCList link;
|
---|
634 | PLHandleEventProc handler;
|
---|
635 | PLDestroyEventProc destructor;
|
---|
636 | void* owner;
|
---|
637 | void* synchronousResult;
|
---|
638 | PRLock* lock;
|
---|
639 | PRCondVar* condVar;
|
---|
640 | PRBool handled;
|
---|
641 | #ifdef PL_POST_TIMINGS
|
---|
642 | PRIntervalTime postTime;
|
---|
643 | #endif
|
---|
644 | #ifdef XP_UNIX
|
---|
645 | unsigned long id;
|
---|
646 | #endif /* XP_UNIX */
|
---|
647 | /* other fields follow... */
|
---|
648 | };
|
---|
649 |
|
---|
650 | #if defined(XP_WIN) || defined(XP_OS2)
|
---|
651 |
|
---|
652 | PR_EXTERN(HWND)
|
---|
653 | PL_GetNativeEventReceiverWindow(
|
---|
654 | PLEventQueue *eqp
|
---|
655 | );
|
---|
656 | #endif /* XP_WIN || XP_OS2 */
|
---|
657 |
|
---|
658 | #ifdef XP_UNIX
|
---|
659 |
|
---|
660 | PR_EXTERN(PRInt32)
|
---|
661 | PL_ProcessEventsBeforeID(PLEventQueue *aSelf, unsigned long aID);
|
---|
662 |
|
---|
663 | typedef unsigned long (PR_CALLBACK *PLGetEventIDFunc)(void *aClosure);
|
---|
664 |
|
---|
665 | PR_EXTERN(void)
|
---|
666 | PL_RegisterEventIDFunc(PLEventQueue *aSelf, PLGetEventIDFunc aFunc,
|
---|
667 | void *aClosure);
|
---|
668 | PR_EXTERN(void) PL_UnregisterEventIDFunc(PLEventQueue *aSelf);
|
---|
669 |
|
---|
670 | #endif /* XP_UNIX */
|
---|
671 |
|
---|
672 | /* Standard "it worked" return value */
|
---|
673 | #define NS_OK 0
|
---|
674 |
|
---|
675 | #define NS_ERROR_BASE ((nsresult) 0xC1F30000)
|
---|
676 |
|
---|
677 | /* Returned when an instance is not initialized */
|
---|
678 | #define NS_ERROR_NOT_INITIALIZED (NS_ERROR_BASE + 1)
|
---|
679 |
|
---|
680 | /* Returned when an instance is already initialized */
|
---|
681 | #define NS_ERROR_ALREADY_INITIALIZED (NS_ERROR_BASE + 2)
|
---|
682 |
|
---|
683 | /* Returned by a not implemented function */
|
---|
684 | #define NS_ERROR_NOT_IMPLEMENTED ((nsresult) 0x80004001L)
|
---|
685 |
|
---|
686 | /* Returned when a given interface is not supported. */
|
---|
687 | #define NS_NOINTERFACE ((nsresult) 0x80004002L)
|
---|
688 | #define NS_ERROR_NO_INTERFACE NS_NOINTERFACE
|
---|
689 |
|
---|
690 | #define NS_ERROR_INVALID_POINTER ((nsresult) 0x80004003L)
|
---|
691 | #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
|
---|
692 |
|
---|
693 | /* Returned when a function aborts */
|
---|
694 | #define NS_ERROR_ABORT ((nsresult) 0x80004004L)
|
---|
695 |
|
---|
696 | /* Returned when a function fails */
|
---|
697 | #define NS_ERROR_FAILURE ((nsresult) 0x80004005L)
|
---|
698 |
|
---|
699 | /* Returned when an unexpected error occurs */
|
---|
700 | #define NS_ERROR_UNEXPECTED ((nsresult) 0x8000ffffL)
|
---|
701 |
|
---|
702 | /* Returned when a memory allocation fails */
|
---|
703 | #define NS_ERROR_OUT_OF_MEMORY ((nsresult) 0x8007000eL)
|
---|
704 |
|
---|
705 | /* Returned when an illegal value is passed */
|
---|
706 | #define NS_ERROR_ILLEGAL_VALUE ((nsresult) 0x80070057L)
|
---|
707 | #define NS_ERROR_INVALID_ARG NS_ERROR_ILLEGAL_VALUE
|
---|
708 |
|
---|
709 | /* Returned when a class doesn't allow aggregation */
|
---|
710 | #define NS_ERROR_NO_AGGREGATION ((nsresult) 0x80040110L)
|
---|
711 |
|
---|
712 | /* Returned when an operation can't complete due to an unavailable resource */
|
---|
713 | #define NS_ERROR_NOT_AVAILABLE ((nsresult) 0x80040111L)
|
---|
714 |
|
---|
715 | /* Returned when a class is not registered */
|
---|
716 | #define NS_ERROR_FACTORY_NOT_REGISTERED ((nsresult) 0x80040154L)
|
---|
717 |
|
---|
718 | /* Returned when a class cannot be registered, but may be tried again later */
|
---|
719 | #define NS_ERROR_FACTORY_REGISTER_AGAIN ((nsresult) 0x80040155L)
|
---|
720 |
|
---|
721 | /* Returned when a dynamically loaded factory couldn't be found */
|
---|
722 | #define NS_ERROR_FACTORY_NOT_LOADED ((nsresult) 0x800401f8L)
|
---|
723 |
|
---|
724 | /* Returned when a factory doesn't support signatures */
|
---|
725 | #define NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT \
|
---|
726 | (NS_ERROR_BASE + 0x101)
|
---|
727 |
|
---|
728 | /* Returned when a factory already is registered */
|
---|
729 | #define NS_ERROR_FACTORY_EXISTS (NS_ERROR_BASE + 0x100)
|
---|
730 |
|
---|
731 |
|
---|
732 | /**
|
---|
733 | * An "interface id" which can be used to uniquely identify a given
|
---|
734 | * interface.
|
---|
735 | * A "unique identifier". This is modeled after OSF DCE UUIDs.
|
---|
736 | */
|
---|
737 |
|
---|
738 | struct nsID {
|
---|
739 | PRUint32 m0;
|
---|
740 | PRUint16 m1;
|
---|
741 | PRUint16 m2;
|
---|
742 | PRUint8 m3[8];
|
---|
743 | };
|
---|
744 |
|
---|
745 | typedef struct nsID nsID;
|
---|
746 | typedef nsID nsIID;
|
---|
747 |
|
---|
748 | struct nsISupports; /* forward declaration */
|
---|
749 | struct nsIStackFrame; /* forward declaration */
|
---|
750 | struct nsIException; /* forward declaration */
|
---|
751 | typedef struct nsISupports nsISupports; /* forward declaration */
|
---|
752 | typedef struct nsIStackFrame nsIStackFrame; /* forward declaration */
|
---|
753 | typedef struct nsIException nsIException; /* forward declaration */
|
---|
754 |
|
---|
755 | /**
|
---|
756 | * IID for the nsISupports interface
|
---|
757 | * {00000000-0000-0000-c000-000000000046}
|
---|
758 | *
|
---|
759 | * To maintain binary compatibility with COM's IUnknown, we define the IID
|
---|
760 | * of nsISupports to be the same as that of COM's IUnknown.
|
---|
761 | */
|
---|
762 | #define NS_ISUPPORTS_IID \
|
---|
763 | { 0x00000000, 0x0000, 0x0000, \
|
---|
764 | {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
---|
765 |
|
---|
766 | /**
|
---|
767 | * Reference count values
|
---|
768 | *
|
---|
769 | * This is the return type for AddRef() and Release() in nsISupports.
|
---|
770 | * IUnknown of COM returns an unsigned long from equivalent functions.
|
---|
771 | * The following ifdef exists to maintain binary compatibility with
|
---|
772 | * IUnknown.
|
---|
773 | */
|
---|
774 |
|
---|
775 | /**
|
---|
776 | * Basic component object model interface. Objects which implement
|
---|
777 | * this interface support runtime interface discovery (QueryInterface)
|
---|
778 | * and a reference counted memory model (AddRef/Release). This is
|
---|
779 | * modelled after the win32 IUnknown API.
|
---|
780 | */
|
---|
781 | struct nsISupports_vtbl {
|
---|
782 |
|
---|
783 | /**
|
---|
784 | * @name Methods
|
---|
785 | */
|
---|
786 |
|
---|
787 | /**
|
---|
788 | * A run time mechanism for interface discovery.
|
---|
789 | * @param aIID [in] A requested interface IID
|
---|
790 | * @param aInstancePtr [out] A pointer to an interface pointer to
|
---|
791 | * receive the result.
|
---|
792 | * @return NS_OK if the interface is supported by the associated
|
---|
793 | * instance, NS_NOINTERFACE if it is not.
|
---|
794 | * NS_ERROR_INVALID_POINTER if aInstancePtr is NULL.
|
---|
795 | */
|
---|
796 | nsresult (*QueryInterface)(nsISupports *pThis, const nsID *iid, void **resultp);
|
---|
797 | /**
|
---|
798 | * Increases the reference count for this interface.
|
---|
799 | * The associated instance will not be deleted unless
|
---|
800 | * the reference count is returned to zero.
|
---|
801 | *
|
---|
802 | * @return The resulting reference count.
|
---|
803 | */
|
---|
804 | nsresult (*AddRef)(nsISupports *pThis);
|
---|
805 |
|
---|
806 | /**
|
---|
807 | * Decreases the reference count for this interface.
|
---|
808 | * Generally, if the reference count returns to zero,
|
---|
809 | * the associated instance is deleted.
|
---|
810 | *
|
---|
811 | * @return The resulting reference count.
|
---|
812 | */
|
---|
813 | nsresult (*Release)(nsISupports *pThis);
|
---|
814 |
|
---|
815 | };
|
---|
816 |
|
---|
817 | struct nsISupports {
|
---|
818 | struct nsISupports_vtbl *vtbl;
|
---|
819 | };
|
---|
820 |
|
---|
821 | /* starting interface: nsIException */
|
---|
822 | #define NS_IEXCEPTION_IID_STR "f3a8d3b4-c424-4edc-8bf6-8974c983ba78"
|
---|
823 |
|
---|
824 | #define NS_IEXCEPTION_IID \
|
---|
825 | {0xf3a8d3b4, 0xc424, 0x4edc, \
|
---|
826 | { 0x8b, 0xf6, 0x89, 0x74, 0xc9, 0x83, 0xba, 0x78 }}
|
---|
827 |
|
---|
828 | struct nsIException_vtbl {
|
---|
829 |
|
---|
830 | /* Methods from the Class nsISupports */
|
---|
831 | struct nsISupports_vtbl nsisupports;
|
---|
832 |
|
---|
833 | /* readonly attribute string message; */
|
---|
834 | nsresult (*GetMessage)(nsIException *pThis, PRUnichar * *aMessage);
|
---|
835 |
|
---|
836 | /* readonly attribute nsresult (*result; */
|
---|
837 | nsresult (*GetResult)(nsIException *pThis, nsresult *aResult);
|
---|
838 |
|
---|
839 | /* readonly attribute string name; */
|
---|
840 | nsresult (*GetName)(nsIException *pThis, PRUnichar * *aName);
|
---|
841 |
|
---|
842 | /* readonly attribute string filename; */
|
---|
843 | nsresult (*GetFilename)(nsIException *pThis, PRUnichar * *aFilename);
|
---|
844 |
|
---|
845 | /* readonly attribute PRUint32 lineNumber; */
|
---|
846 | nsresult (*GetLineNumber)(nsIException *pThis, PRUint32 *aLineNumber);
|
---|
847 |
|
---|
848 | /* readonly attribute PRUint32 columnNumber; */
|
---|
849 | nsresult (*GetColumnNumber)(nsIException *pThis, PRUint32 *aColumnNumber);
|
---|
850 |
|
---|
851 | /* readonly attribute nsIStackFrame location; */
|
---|
852 | nsresult (*GetLocation)(nsIException *pThis, nsIStackFrame * *aLocation);
|
---|
853 |
|
---|
854 | /* readonly attribute nsIException inner; */
|
---|
855 | nsresult (*GetInner)(nsIException *pThis, nsIException * *aInner);
|
---|
856 |
|
---|
857 | /* readonly attribute nsISupports data; */
|
---|
858 | nsresult (*GetData)(nsIException *pThis, nsISupports * *aData);
|
---|
859 |
|
---|
860 | /* string toString (); */
|
---|
861 | nsresult (*ToString)(nsIException *pThis, PRUnichar **_retval);
|
---|
862 | };
|
---|
863 |
|
---|
864 | struct nsIException {
|
---|
865 | struct nsIException_vtbl *vtbl;
|
---|
866 | };
|
---|
867 |
|
---|
868 | /* starting interface: nsIStackFrame */
|
---|
869 | #define NS_ISTACKFRAME_IID_STR "91d82105-7c62-4f8b-9779-154277c0ee90"
|
---|
870 |
|
---|
871 | #define NS_ISTACKFRAME_IID \
|
---|
872 | {0x91d82105, 0x7c62, 0x4f8b, \
|
---|
873 | { 0x97, 0x79, 0x15, 0x42, 0x77, 0xc0, 0xee, 0x90 }}
|
---|
874 |
|
---|
875 | struct nsIStackFrame_vtbl {
|
---|
876 |
|
---|
877 | /* Methods from the Class nsISupports */
|
---|
878 | struct nsISupports_vtbl nsisupports;
|
---|
879 |
|
---|
880 | /* readonly attribute PRUint32 language; */
|
---|
881 | nsresult (*GetLanguage)(nsIStackFrame *pThis, PRUint32 *aLanguage);
|
---|
882 |
|
---|
883 | /* readonly attribute string languageName; */
|
---|
884 | nsresult (*GetLanguageName)(nsIStackFrame *pThis, PRUnichar * *aLanguageName);
|
---|
885 |
|
---|
886 | /* readonly attribute string filename; */
|
---|
887 | nsresult (*GetFilename)(nsIStackFrame *pThis, PRUnichar * *aFilename);
|
---|
888 |
|
---|
889 | /* readonly attribute string name; */
|
---|
890 | nsresult (*GetName)(nsIStackFrame *pThis, PRUnichar * *aName);
|
---|
891 |
|
---|
892 | /* readonly attribute PRInt32 lineNumber; */
|
---|
893 | nsresult (*GetLineNumber)(nsIStackFrame *pThis, PRInt32 *aLineNumber);
|
---|
894 |
|
---|
895 | /* readonly attribute string sourceLine; */
|
---|
896 | nsresult (*GetSourceLine)(nsIStackFrame *pThis, PRUnichar * *aSourceLine);
|
---|
897 |
|
---|
898 | /* readonly attribute nsIStackFrame caller; */
|
---|
899 | nsresult (*GetCaller)(nsIStackFrame *pThis, nsIStackFrame * *aCaller);
|
---|
900 |
|
---|
901 | /* string toString (); */
|
---|
902 | nsresult (*ToString)(nsIStackFrame *pThis, PRUnichar **_retval);
|
---|
903 | };
|
---|
904 |
|
---|
905 | struct nsIStackFrame {
|
---|
906 | struct nsIStackFrame_vtbl *vtbl;
|
---|
907 | };
|
---|
908 |
|
---|
909 | /* starting interface: nsIEventTarget */
|
---|
910 | #define NS_IEVENTTARGET_IID_STR "ea99ad5b-cc67-4efb-97c9-2ef620a59f2a"
|
---|
911 |
|
---|
912 | #define NS_IEVENTTARGET_IID \
|
---|
913 | {0xea99ad5b, 0xcc67, 0x4efb, \
|
---|
914 | { 0x97, 0xc9, 0x2e, 0xf6, 0x20, 0xa5, 0x9f, 0x2a }}
|
---|
915 |
|
---|
916 | struct nsIEventTarget;
|
---|
917 | typedef struct nsIEventTarget nsIEventTarget;
|
---|
918 |
|
---|
919 | struct nsIEventTarget_vtbl {
|
---|
920 |
|
---|
921 | struct nsISupports_vtbl nsisupports;
|
---|
922 |
|
---|
923 | nsresult (*PostEvent)(nsIEventTarget *pThis, PLEvent * aEvent);
|
---|
924 |
|
---|
925 | nsresult (*IsOnCurrentThread)(nsIEventTarget *pThis, PRBool *_retval);
|
---|
926 |
|
---|
927 | };
|
---|
928 |
|
---|
929 | struct nsIEventTarget {
|
---|
930 | struct nsIEventTarget_vtbl *vtbl;
|
---|
931 | };
|
---|
932 |
|
---|
933 | /* starting interface: nsIEventQueue */
|
---|
934 | #define NS_IEVENTQUEUE_IID_STR "176afb41-00a4-11d3-9f2a-00400553eef0"
|
---|
935 |
|
---|
936 | #define NS_IEVENTQUEUE_IID \
|
---|
937 | {0x176afb41, 0x00a4, 0x11d3, \
|
---|
938 | { 0x9f, 0x2a, 0x00, 0x40, 0x05, 0x53, 0xee, 0xf0 }}
|
---|
939 |
|
---|
940 | struct nsIEventQueue;
|
---|
941 | typedef struct nsIEventQueue nsIEventQueue;
|
---|
942 |
|
---|
943 | struct nsIEventQueue_vtbl {
|
---|
944 |
|
---|
945 | struct nsIEventTarget_vtbl nsieventtarget;
|
---|
946 |
|
---|
947 | nsresult (*InitEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor);
|
---|
948 |
|
---|
949 | nsresult (*PostSynchronousEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * *aResult);
|
---|
950 |
|
---|
951 | nsresult (*PendingEvents)(nsIEventQueue *pThis, PRBool *_retval);
|
---|
952 |
|
---|
953 | nsresult (*ProcessPendingEvents)(nsIEventQueue *pThis);
|
---|
954 |
|
---|
955 | nsresult (*EventLoop)(nsIEventQueue *pThis);
|
---|
956 |
|
---|
957 | nsresult (*EventAvailable)(nsIEventQueue *pThis, PRBool *aResult);
|
---|
958 |
|
---|
959 | nsresult (*GetEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
|
---|
960 |
|
---|
961 | nsresult (*HandleEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
|
---|
962 |
|
---|
963 | nsresult (*WaitForEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
|
---|
964 |
|
---|
965 | PRInt32 (*GetEventQueueSelectFD)(nsIEventQueue *pThis);
|
---|
966 |
|
---|
967 | nsresult (*Init)(nsIEventQueue *pThis, PRBool aNative);
|
---|
968 |
|
---|
969 | nsresult (*InitFromPRThread)(nsIEventQueue *pThis, PRThread * thread, PRBool aNative);
|
---|
970 |
|
---|
971 | nsresult (*InitFromPLQueue)(nsIEventQueue *pThis, PLEventQueue * aQueue);
|
---|
972 |
|
---|
973 | nsresult (*EnterMonitor)(nsIEventQueue *pThis);
|
---|
974 |
|
---|
975 | nsresult (*ExitMonitor)(nsIEventQueue *pThis);
|
---|
976 |
|
---|
977 | nsresult (*RevokeEvents)(nsIEventQueue *pThis, void * owner);
|
---|
978 |
|
---|
979 | nsresult (*GetPLEventQueue)(nsIEventQueue *pThis, PLEventQueue * *_retval);
|
---|
980 |
|
---|
981 | nsresult (*IsQueueNative)(nsIEventQueue *pThis, PRBool *_retval);
|
---|
982 |
|
---|
983 | nsresult (*StopAcceptingEvents)(nsIEventQueue *pThis);
|
---|
984 |
|
---|
985 | };
|
---|
986 |
|
---|
987 | struct nsIEventQueue {
|
---|
988 | struct nsIEventQueue_vtbl *vtbl;
|
---|
989 | };
|
---|
990 |
|
---|
991 | </xsl:text>
|
---|
992 | <xsl:apply-templates/>
|
---|
993 | <xsl:text>
|
---|
994 | #endif /* !__cplusplus */
|
---|
995 |
|
---|
996 | #ifdef IN_VBOXXPCOMC
|
---|
997 | # define VBOXXPCOMC_DECL(type) PR_EXPORT(type)
|
---|
998 | #else
|
---|
999 | # define VBOXXPCOMC_DECL(type) PR_IMPORT(type)
|
---|
1000 | #endif
|
---|
1001 |
|
---|
1002 | #ifdef __cplusplus
|
---|
1003 | extern "C" {
|
---|
1004 | #endif
|
---|
1005 |
|
---|
1006 |
|
---|
1007 | /**
|
---|
1008 | * Function table for dynamic linking.
|
---|
1009 | * Use VBoxGetFunctions() to obtain the pointer to it.
|
---|
1010 | */
|
---|
1011 | typedef struct VBOXXPCOMC
|
---|
1012 | {
|
---|
1013 | /** The size of the structure. */
|
---|
1014 | unsigned cb;
|
---|
1015 | /** The structure version. */
|
---|
1016 | unsigned uVersion;
|
---|
1017 |
|
---|
1018 | unsigned int (*pfnGetVersion)(void);
|
---|
1019 |
|
---|
1020 | void (*pfnComInitialize)(const char *pszVirtualBoxIID,
|
---|
1021 | IVirtualBox **ppVirtualBox,
|
---|
1022 | const char *pszSessionIID,
|
---|
1023 | ISession **ppSession);
|
---|
1024 | void (*pfnComUninitialize)(void);
|
---|
1025 |
|
---|
1026 | void (*pfnComUnallocMem)(void *pv);
|
---|
1027 | void (*pfnUtf16Free)(PRUnichar *pwszString);
|
---|
1028 | void (*pfnUtf8Free)(char *pszString);
|
---|
1029 |
|
---|
1030 | int (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
|
---|
1031 | int (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
|
---|
1032 |
|
---|
1033 | void (*pfnGetEventQueue)(nsIEventQueue **eventQueue);
|
---|
1034 |
|
---|
1035 | /** Tail version, same as uVersion. */
|
---|
1036 | unsigned uEndVersion;
|
---|
1037 | } VBOXXPCOMC;
|
---|
1038 | /** Pointer to a const VBoxXPCOMC function table. */
|
---|
1039 | typedef VBOXXPCOMC const *PCVBOXXPCOM;
|
---|
1040 |
|
---|
1041 | /** The current interface version.
|
---|
1042 | * For use with VBoxGetXPCOMCFunctions and to be found in
|
---|
1043 | * VBOXXPCOMC::uVersion. */
|
---|
1044 | #define VBOX_XPCOMC_VERSION 0x00020000U
|
---|
1045 |
|
---|
1046 | VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
|
---|
1047 | /** Typedef for VBoxGetXPCOMCFunctions. */
|
---|
1048 | typedef PCVBOXXPCOM (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
|
---|
1049 |
|
---|
1050 | /** The symbol name of VBoxGetXPCOMCFunctions. */
|
---|
1051 | #if defined(__OS2__)
|
---|
1052 | # define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "_VBoxGetXPCOMCFunctions"
|
---|
1053 | #else
|
---|
1054 | # define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "VBoxGetXPCOMCFunctions"
|
---|
1055 | #endif
|
---|
1056 |
|
---|
1057 |
|
---|
1058 | #ifdef __cplusplus
|
---|
1059 | }
|
---|
1060 | #endif
|
---|
1061 |
|
---|
1062 | #endif /* !___VirtualBox_CXPCOM_h */
|
---|
1063 | </xsl:text>
|
---|
1064 | </xsl:template>
|
---|
1065 |
|
---|
1066 | <!--
|
---|
1067 | * ignore all |if|s except those for XPIDL target
|
---|
1068 | <xsl:template match="if">
|
---|
1069 | <xsl:if test="@target='xpidl'">
|
---|
1070 | <xsl:apply-templates/>
|
---|
1071 | </xsl:if>
|
---|
1072 | </xsl:template>
|
---|
1073 | <xsl:template match="if" mode="forward">
|
---|
1074 | <xsl:if test="@target='xpidl'">
|
---|
1075 | <xsl:apply-templates mode="forward"/>
|
---|
1076 | </xsl:if>
|
---|
1077 | </xsl:template>
|
---|
1078 | <xsl:template match="if" mode="forwarder">
|
---|
1079 | <xsl:if test="@target='midl'">
|
---|
1080 | <xsl:apply-templates mode="forwarder"/>
|
---|
1081 | </xsl:if>
|
---|
1082 | </xsl:template>
|
---|
1083 |
|
---|
1084 | -->
|
---|
1085 |
|
---|
1086 | <!--
|
---|
1087 | * cpp_quote
|
---|
1088 | <xsl:template match="cpp">
|
---|
1089 | <xsl:if test="text()">
|
---|
1090 | <xsl:text>%{C++</xsl:text>
|
---|
1091 | <xsl:value-of select="text()"/>
|
---|
1092 | <xsl:text>
%}

</xsl:text>
|
---|
1093 | </xsl:if>
|
---|
1094 | <xsl:if test="not(text()) and @line">
|
---|
1095 | <xsl:text>%{C++
</xsl:text>
|
---|
1096 | <xsl:value-of select="@line"/>
|
---|
1097 | <xsl:text>
%}

</xsl:text>
|
---|
1098 | </xsl:if>
|
---|
1099 | </xsl:template>
|
---|
1100 | -->
|
---|
1101 |
|
---|
1102 |
|
---|
1103 | <!--
|
---|
1104 | * #if statement (@if attribute)
|
---|
1105 | * @note
|
---|
1106 | * xpidl doesn't support any preprocessor defines other than #include
|
---|
1107 | * (it just ignores them), so the generated IDL will most likely be
|
---|
1108 | * invalid. So for now we forbid using @if attributes
|
---|
1109 | -->
|
---|
1110 | <xsl:template match="@if" mode="begin">
|
---|
1111 | <xsl:message terminate="yes">
|
---|
1112 | @if attributes are not currently allowed because xpidl lacks
|
---|
1113 | support for #ifdef and stuff.
|
---|
1114 | </xsl:message>
|
---|
1115 | <xsl:text>#if </xsl:text>
|
---|
1116 | <xsl:value-of select="."/>
|
---|
1117 | <xsl:text>
</xsl:text>
|
---|
1118 | </xsl:template>
|
---|
1119 | <xsl:template match="@if" mode="end">
|
---|
1120 | <xsl:text>#endif
</xsl:text>
|
---|
1121 | </xsl:template>
|
---|
1122 |
|
---|
1123 |
|
---|
1124 | <!--
|
---|
1125 | * libraries
|
---|
1126 | -->
|
---|
1127 | <xsl:template match="library">
|
---|
1128 | <!-- result codes -->
|
---|
1129 | <xsl:text>
</xsl:text>
|
---|
1130 | <xsl:for-each select="result">
|
---|
1131 | <xsl:apply-templates select="."/>
|
---|
1132 | </xsl:for-each>
|
---|
1133 | <xsl:text>

</xsl:text>
|
---|
1134 | <!-- forward declarations -->
|
---|
1135 | <xsl:apply-templates select="if | interface | collection | enumerator" mode="forward"/>
|
---|
1136 | <xsl:text>
</xsl:text>
|
---|
1137 | <!-- typedef'ing the struct declarations -->
|
---|
1138 | <xsl:apply-templates select="if | interface | collection | enumerator" mode="typedef"/>
|
---|
1139 | <xsl:text>
</xsl:text>
|
---|
1140 | <!-- all enums go first -->
|
---|
1141 | <xsl:apply-templates select="enum | if/enum"/>
|
---|
1142 | <!-- everything else but result codes and enums -->
|
---|
1143 | <xsl:apply-templates select="*[not(self::result or self::enum) and
|
---|
1144 | not(self::if[result] or self::if[enum])]"/>
|
---|
1145 | <!-- -->
|
---|
1146 | </xsl:template>
|
---|
1147 |
|
---|
1148 |
|
---|
1149 | <!--
|
---|
1150 | * result codes
|
---|
1151 | -->
|
---|
1152 | <xsl:template match="result">
|
---|
1153 | <xsl:value-of select="concat('#define ',@name,' ',@value)"/>
|
---|
1154 | <xsl:text>
</xsl:text>
|
---|
1155 | </xsl:template>
|
---|
1156 |
|
---|
1157 |
|
---|
1158 | <!--
|
---|
1159 | * forward declarations
|
---|
1160 | -->
|
---|
1161 | <xsl:template match="interface | collection | enumerator" mode="forward">
|
---|
1162 | <xsl:text>struct </xsl:text>
|
---|
1163 | <xsl:value-of select="@name"/>
|
---|
1164 | <xsl:text>;
</xsl:text>
|
---|
1165 | </xsl:template>
|
---|
1166 |
|
---|
1167 |
|
---|
1168 | <!--
|
---|
1169 | * typedef'ing the struct declarations
|
---|
1170 | -->
|
---|
1171 | <xsl:template match="interface | collection | enumerator" mode="typedef">
|
---|
1172 | <xsl:text>typedef struct </xsl:text>
|
---|
1173 | <xsl:value-of select="@name"/>
|
---|
1174 | <xsl:text> </xsl:text>
|
---|
1175 | <xsl:value-of select="@name"/>
|
---|
1176 | <xsl:text>;
</xsl:text>
|
---|
1177 | </xsl:template>
|
---|
1178 |
|
---|
1179 |
|
---|
1180 | <!--
|
---|
1181 | * interfaces
|
---|
1182 | -->
|
---|
1183 | <xsl:template match="interface">
|
---|
1184 | <xsl:text>/* Start of struct </xsl:text>
|
---|
1185 | <xsl:value-of select="@name"/>
|
---|
1186 | <xsl:text> Declaration */
</xsl:text>
|
---|
1187 | <xsl:text>#define </xsl:text>
|
---|
1188 | <xsl:call-template name="uppercase">
|
---|
1189 | <xsl:with-param name="str" select="@name"/>
|
---|
1190 | </xsl:call-template>
|
---|
1191 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1192 | <xsl:text>
</xsl:text>
|
---|
1193 | <xsl:text>#define </xsl:text>
|
---|
1194 | <xsl:call-template name="uppercase">
|
---|
1195 | <xsl:with-param name="str" select="@name"/>
|
---|
1196 | </xsl:call-template>
|
---|
1197 | <xsl:text>_IID { \
</xsl:text>
|
---|
1198 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1199 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1200 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1201 | <xsl:text>, \
 </xsl:text>
|
---|
1202 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1203 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1204 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1205 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1206 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1207 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1208 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1209 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1210 | <xsl:text> } \
}
</xsl:text>
|
---|
1211 | <xsl:text>struct </xsl:text>
|
---|
1212 | <xsl:value-of select="@name"/>
|
---|
1213 | <xsl:text>_vtbl
{
</xsl:text>
|
---|
1214 | <xsl:text> </xsl:text>
|
---|
1215 | <xsl:choose>
|
---|
1216 | <xsl:when test="@extends='$unknown'">struct nsISupports_vtbl nsisupports;</xsl:when>
|
---|
1217 | <xsl:when test="@extends='$dispatched'">struct nsISupports_vtbl nsisupports;</xsl:when>
|
---|
1218 | <xsl:when test="@extends='$errorinfo'">struct nsIException_vtbl nsiexception;</xsl:when>
|
---|
1219 | <xsl:otherwise>
|
---|
1220 | <xsl:text>struct </xsl:text>
|
---|
1221 | <xsl:value-of select="@extends"/>
|
---|
1222 | <xsl:text>_vtbl </xsl:text>
|
---|
1223 | <xsl:call-template name="lowercase">
|
---|
1224 | <xsl:with-param name="str" select="@extends"/>
|
---|
1225 | </xsl:call-template>
|
---|
1226 | <xsl:text>;</xsl:text>
|
---|
1227 | </xsl:otherwise>
|
---|
1228 | </xsl:choose>
|
---|
1229 | <xsl:text>

</xsl:text>
|
---|
1230 | <!-- attributes (properties) -->
|
---|
1231 | <xsl:apply-templates select="attribute"/>
|
---|
1232 | <!-- methods -->
|
---|
1233 | <xsl:apply-templates select="method"/>
|
---|
1234 | <!-- 'if' enclosed elements, unsorted -->
|
---|
1235 | <xsl:apply-templates select="if"/>
|
---|
1236 | <!-- -->
|
---|
1237 | <xsl:text>};</xsl:text>
|
---|
1238 | <xsl:text>

</xsl:text>
|
---|
1239 | <xsl:text>struct </xsl:text>
|
---|
1240 | <xsl:value-of select="@name"/>
|
---|
1241 | <xsl:text>
{
 struct </xsl:text>
|
---|
1242 | <xsl:value-of select="@name"/>
|
---|
1243 | <xsl:text>_vtbl *vtbl;
};
</xsl:text>
|
---|
1244 | <xsl:text>/* End of struct </xsl:text>
|
---|
1245 | <xsl:value-of select="@name"/>
|
---|
1246 | <xsl:text> Declaration */


</xsl:text>
|
---|
1247 | </xsl:template>
|
---|
1248 |
|
---|
1249 |
|
---|
1250 | <!--
|
---|
1251 | * attributes
|
---|
1252 | -->
|
---|
1253 | <xsl:template match="interface//attribute | collection//attribute">
|
---|
1254 | <xsl:if test="@array">
|
---|
1255 | <xsl:message terminate="yes">
|
---|
1256 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
1257 | <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
|
---|
1258 | </xsl:message>
|
---|
1259 | </xsl:if>
|
---|
1260 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
1261 | <xsl:if test="@mod='ptr'">
|
---|
1262 | <!-- attributes using native types must be non-scriptable
|
---|
1263 | <xsl:text> [noscript]
</xsl:text>-->
|
---|
1264 | </xsl:if>
|
---|
1265 | <xsl:choose>
|
---|
1266 | <!-- safearray pseudo attribute -->
|
---|
1267 | <xsl:when test="@safearray='yes'">
|
---|
1268 | <!-- getter -->
|
---|
1269 | <xsl:text> nsresult (*Get</xsl:text>
|
---|
1270 | <xsl:call-template name="capitalize">
|
---|
1271 | <xsl:with-param name="str" select="@name"/>
|
---|
1272 | </xsl:call-template>
|
---|
1273 | <xsl:text>)(</xsl:text>
|
---|
1274 | <xsl:value-of select="../@name" />
|
---|
1275 | <xsl:text> *pThis, </xsl:text>
|
---|
1276 | <!-- array size -->
|
---|
1277 | <xsl:text>PRUint32 *</xsl:text>
|
---|
1278 | <xsl:value-of select="@name"/>
|
---|
1279 | <xsl:text>Size, </xsl:text>
|
---|
1280 | <!-- array pointer -->
|
---|
1281 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1282 | <xsl:text> **</xsl:text>
|
---|
1283 | <xsl:value-of select="@name"/>
|
---|
1284 | <xsl:text>);
</xsl:text>
|
---|
1285 | <!-- setter -->
|
---|
1286 | <xsl:if test="not(@readonly='yes')">
|
---|
1287 | <xsl:text> nsresult set</xsl:text>
|
---|
1288 | <xsl:call-template name="capitalize">
|
---|
1289 | <xsl:with-param name="str" select="@name"/>
|
---|
1290 | </xsl:call-template>
|
---|
1291 | <xsl:text> (
</xsl:text>
|
---|
1292 | <!-- array size -->
|
---|
1293 | <xsl:text> in unsigned long </xsl:text>
|
---|
1294 | <xsl:value-of select="@name"/>
|
---|
1295 | <xsl:text>Size,
</xsl:text>
|
---|
1296 | <!-- array pointer -->
|
---|
1297 | <xsl:text> [array, size_is(</xsl:text>
|
---|
1298 | <xsl:value-of select="@name"/>
|
---|
1299 | <xsl:text>Size)] in </xsl:text>
|
---|
1300 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1301 | <xsl:text> </xsl:text>
|
---|
1302 | <xsl:value-of select="@name"/>
|
---|
1303 | <xsl:text>
 );
</xsl:text>
|
---|
1304 | </xsl:if>
|
---|
1305 | </xsl:when>
|
---|
1306 | <!-- normal attribute -->
|
---|
1307 | <xsl:otherwise>
|
---|
1308 | <xsl:text> </xsl:text>
|
---|
1309 | <xsl:if test="@readonly='yes'">
|
---|
1310 | <xsl:text>nsresult (*Get</xsl:text>
|
---|
1311 | <xsl:call-template name="capitalize">
|
---|
1312 | <xsl:with-param name="str" select="@name"/>
|
---|
1313 | </xsl:call-template>
|
---|
1314 | <xsl:text>)(</xsl:text>
|
---|
1315 | <xsl:value-of select="../@name" />
|
---|
1316 | <xsl:text> *pThis, </xsl:text>
|
---|
1317 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1318 | <xsl:text> *</xsl:text>
|
---|
1319 | <xsl:value-of select="@name"/>
|
---|
1320 | <xsl:text>);
</xsl:text>
|
---|
1321 | </xsl:if>
|
---|
1322 | <xsl:choose>
|
---|
1323 | <xsl:when test="@readonly='yes'">
|
---|
1324 | </xsl:when>
|
---|
1325 | <xsl:otherwise>
|
---|
1326 | <xsl:text>nsresult (*Get</xsl:text>
|
---|
1327 | <xsl:call-template name="capitalize">
|
---|
1328 | <xsl:with-param name="str" select="@name"/>
|
---|
1329 | </xsl:call-template>
|
---|
1330 | <xsl:text>)(</xsl:text>
|
---|
1331 | <xsl:value-of select="../@name" />
|
---|
1332 | <xsl:text> *pThis, </xsl:text>
|
---|
1333 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1334 | <xsl:text> *</xsl:text>
|
---|
1335 | <xsl:value-of select="@name"/>
|
---|
1336 | <xsl:text>);
 </xsl:text>
|
---|
1337 | <xsl:text>nsresult (*Set</xsl:text>
|
---|
1338 | <xsl:call-template name="capitalize">
|
---|
1339 | <xsl:with-param name="str" select="@name"/>
|
---|
1340 | </xsl:call-template>
|
---|
1341 | <xsl:text>)(</xsl:text>
|
---|
1342 | <xsl:value-of select="../@name" />
|
---|
1343 | <xsl:text> *pThis, </xsl:text>
|
---|
1344 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1345 | <xsl:text> </xsl:text>
|
---|
1346 | <xsl:value-of select="@name"/>
|
---|
1347 | <xsl:text>);
</xsl:text>
|
---|
1348 | </xsl:otherwise>
|
---|
1349 | </xsl:choose>
|
---|
1350 | </xsl:otherwise>
|
---|
1351 | </xsl:choose>
|
---|
1352 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
1353 | <xsl:text>
</xsl:text>
|
---|
1354 | </xsl:template>
|
---|
1355 |
|
---|
1356 | <xsl:template match="interface//attribute | collection//attribute" mode="forwarder">
|
---|
1357 |
|
---|
1358 | <xsl:variable name="parent" select="ancestor::interface | ancestor::collection"/>
|
---|
1359 |
|
---|
1360 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
1361 |
|
---|
1362 | <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO(smth) -->
|
---|
1363 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1364 | <xsl:value-of select="$parent/@name"/>
|
---|
1365 | <xsl:text>_GETTER_</xsl:text>
|
---|
1366 | <xsl:call-template name="capitalize">
|
---|
1367 | <xsl:with-param name="str" select="@name"/>
|
---|
1368 | </xsl:call-template>
|
---|
1369 | <xsl:text>_TO(smth) NS_IMETHOD Get</xsl:text>
|
---|
1370 | <xsl:call-template name="capitalize">
|
---|
1371 | <xsl:with-param name="str" select="@name"/>
|
---|
1372 | </xsl:call-template>
|
---|
1373 | <xsl:text> (</xsl:text>
|
---|
1374 | <xsl:if test="@safearray='yes'">
|
---|
1375 | <xsl:text>PRUint32 * a</xsl:text>
|
---|
1376 | <xsl:call-template name="capitalize">
|
---|
1377 | <xsl:with-param name="str" select="@name"/>
|
---|
1378 | </xsl:call-template>
|
---|
1379 | <xsl:text>Size, </xsl:text>
|
---|
1380 | </xsl:if>
|
---|
1381 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1382 | <xsl:if test="@safearray='yes'">
|
---|
1383 | <xsl:text> *</xsl:text>
|
---|
1384 | </xsl:if>
|
---|
1385 | <xsl:text> * a</xsl:text>
|
---|
1386 | <xsl:call-template name="capitalize">
|
---|
1387 | <xsl:with-param name="str" select="@name"/>
|
---|
1388 | </xsl:call-template>
|
---|
1389 | <xsl:text>) { return smth Get</xsl:text>
|
---|
1390 | <xsl:call-template name="capitalize">
|
---|
1391 | <xsl:with-param name="str" select="@name"/>
|
---|
1392 | </xsl:call-template>
|
---|
1393 | <xsl:text> (</xsl:text>
|
---|
1394 | <xsl:if test="@safearray='yes'">
|
---|
1395 | <xsl:text>a</xsl:text>
|
---|
1396 | <xsl:call-template name="capitalize">
|
---|
1397 | <xsl:with-param name="str" select="@name"/>
|
---|
1398 | </xsl:call-template>
|
---|
1399 | <xsl:text>Size, </xsl:text>
|
---|
1400 | </xsl:if>
|
---|
1401 | <xsl:text>a</xsl:text>
|
---|
1402 | <xsl:call-template name="capitalize">
|
---|
1403 | <xsl:with-param name="str" select="@name"/>
|
---|
1404 | </xsl:call-template>
|
---|
1405 | <xsl:text>); }
</xsl:text>
|
---|
1406 | <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_OBJ(obj) -->
|
---|
1407 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1408 | <xsl:value-of select="$parent/@name"/>
|
---|
1409 | <xsl:text>_GETTER_</xsl:text>
|
---|
1410 | <xsl:call-template name="capitalize">
|
---|
1411 | <xsl:with-param name="str" select="@name"/>
|
---|
1412 | </xsl:call-template>
|
---|
1413 | <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
|
---|
1414 | <xsl:value-of select="$parent/@name"/>
|
---|
1415 | <xsl:text>_GETTER_</xsl:text>
|
---|
1416 | <xsl:call-template name="capitalize">
|
---|
1417 | <xsl:with-param name="str" select="@name"/>
|
---|
1418 | </xsl:call-template>
|
---|
1419 | <xsl:text>_TO ((obj)->)
</xsl:text>
|
---|
1420 | <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_BASE(base) -->
|
---|
1421 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1422 | <xsl:value-of select="$parent/@name"/>
|
---|
1423 | <xsl:text>_GETTER_</xsl:text>
|
---|
1424 | <xsl:call-template name="capitalize">
|
---|
1425 | <xsl:with-param name="str" select="@name"/>
|
---|
1426 | </xsl:call-template>
|
---|
1427 | <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
|
---|
1428 | <xsl:value-of select="$parent/@name"/>
|
---|
1429 | <xsl:text>_GETTER_</xsl:text>
|
---|
1430 | <xsl:call-template name="capitalize">
|
---|
1431 | <xsl:with-param name="str" select="@name"/>
|
---|
1432 | </xsl:call-template>
|
---|
1433 | <xsl:text>_TO (base::)
</xsl:text>
|
---|
1434 | <!-- -->
|
---|
1435 | <xsl:if test="not(@readonly='yes')">
|
---|
1436 | <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO(smth) -->
|
---|
1437 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1438 | <xsl:value-of select="$parent/@name"/>
|
---|
1439 | <xsl:text>_SETTER_</xsl:text>
|
---|
1440 | <xsl:call-template name="capitalize">
|
---|
1441 | <xsl:with-param name="str" select="@name"/>
|
---|
1442 | </xsl:call-template>
|
---|
1443 | <xsl:text>_TO(smth) NS_IMETHOD Set</xsl:text>
|
---|
1444 | <xsl:call-template name="capitalize">
|
---|
1445 | <xsl:with-param name="str" select="@name"/>
|
---|
1446 | </xsl:call-template>
|
---|
1447 | <xsl:text> (</xsl:text>
|
---|
1448 | <xsl:if test="@safearray='yes'">
|
---|
1449 | <xsl:text>PRUint32 a</xsl:text>
|
---|
1450 | <xsl:call-template name="capitalize">
|
---|
1451 | <xsl:with-param name="str" select="@name"/>
|
---|
1452 | </xsl:call-template>
|
---|
1453 | <xsl:text>Size, </xsl:text>
|
---|
1454 | </xsl:if>
|
---|
1455 | <xsl:if test="not(@safearray='yes') and (@type='string' or @type='wstring')">
|
---|
1456 | <xsl:text>const </xsl:text>
|
---|
1457 | </xsl:if>
|
---|
1458 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1459 | <xsl:if test="@safearray='yes'">
|
---|
1460 | <xsl:text> *</xsl:text>
|
---|
1461 | </xsl:if>
|
---|
1462 | <xsl:text> a</xsl:text>
|
---|
1463 | <xsl:call-template name="capitalize">
|
---|
1464 | <xsl:with-param name="str" select="@name"/>
|
---|
1465 | </xsl:call-template>
|
---|
1466 | <xsl:text>) { return smth Set</xsl:text>
|
---|
1467 | <xsl:call-template name="capitalize">
|
---|
1468 | <xsl:with-param name="str" select="@name"/>
|
---|
1469 | </xsl:call-template>
|
---|
1470 | <xsl:text> (a</xsl:text>
|
---|
1471 | <xsl:call-template name="capitalize">
|
---|
1472 | <xsl:with-param name="str" select="@name"/>
|
---|
1473 | </xsl:call-template>
|
---|
1474 | <xsl:text>); }
</xsl:text>
|
---|
1475 | <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_OBJ(obj) -->
|
---|
1476 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1477 | <xsl:value-of select="$parent/@name"/>
|
---|
1478 | <xsl:text>_SETTER_</xsl:text>
|
---|
1479 | <xsl:call-template name="capitalize">
|
---|
1480 | <xsl:with-param name="str" select="@name"/>
|
---|
1481 | </xsl:call-template>
|
---|
1482 | <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
|
---|
1483 | <xsl:value-of select="$parent/@name"/>
|
---|
1484 | <xsl:text>_SETTER_</xsl:text>
|
---|
1485 | <xsl:call-template name="capitalize">
|
---|
1486 | <xsl:with-param name="str" select="@name"/>
|
---|
1487 | </xsl:call-template>
|
---|
1488 | <xsl:text>_TO ((obj)->)
</xsl:text>
|
---|
1489 | <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_BASE(base) -->
|
---|
1490 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1491 | <xsl:value-of select="$parent/@name"/>
|
---|
1492 | <xsl:text>_SETTER_</xsl:text>
|
---|
1493 | <xsl:call-template name="capitalize">
|
---|
1494 | <xsl:with-param name="str" select="@name"/>
|
---|
1495 | </xsl:call-template>
|
---|
1496 | <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
|
---|
1497 | <xsl:value-of select="$parent/@name"/>
|
---|
1498 | <xsl:text>_SETTER_</xsl:text>
|
---|
1499 | <xsl:call-template name="capitalize">
|
---|
1500 | <xsl:with-param name="str" select="@name"/>
|
---|
1501 | </xsl:call-template>
|
---|
1502 | <xsl:text>_TO (base::)
</xsl:text>
|
---|
1503 | </xsl:if>
|
---|
1504 |
|
---|
1505 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
1506 |
|
---|
1507 | </xsl:template>
|
---|
1508 |
|
---|
1509 |
|
---|
1510 | <!--
|
---|
1511 | * methods
|
---|
1512 | -->
|
---|
1513 | <xsl:template match="interface//method | collection//method">
|
---|
1514 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
1515 | <xsl:if test="param/@mod='ptr'">
|
---|
1516 | <!-- methods using native types must be non-scriptable
|
---|
1517 | <xsl:text> [noscript]
</xsl:text>-->
|
---|
1518 | </xsl:if>
|
---|
1519 | <xsl:text> nsresult (*</xsl:text>
|
---|
1520 | <xsl:call-template name="capitalize">
|
---|
1521 | <xsl:with-param name="str" select="@name"/>
|
---|
1522 | </xsl:call-template>
|
---|
1523 | <xsl:if test="param">
|
---|
1524 | <xsl:text>)(
</xsl:text>
|
---|
1525 | <xsl:text> </xsl:text>
|
---|
1526 | <xsl:value-of select="../@name" />
|
---|
1527 | <xsl:text> *pThis,
</xsl:text>
|
---|
1528 | <xsl:for-each select="param [position() != last()]">
|
---|
1529 | <xsl:text> </xsl:text>
|
---|
1530 | <xsl:apply-templates select="."/>
|
---|
1531 | <xsl:text>,
</xsl:text>
|
---|
1532 | </xsl:for-each>
|
---|
1533 | <xsl:text> </xsl:text>
|
---|
1534 | <xsl:apply-templates select="param [last()]"/>
|
---|
1535 | <xsl:text>
 );
</xsl:text>
|
---|
1536 | </xsl:if>
|
---|
1537 | <xsl:if test="not(param)">
|
---|
1538 | <xsl:text>)(</xsl:text>
|
---|
1539 | <xsl:value-of select="../@name" />
|
---|
1540 | <xsl:text> *pThis );
</xsl:text>
|
---|
1541 | </xsl:if>
|
---|
1542 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
1543 | <xsl:text>
</xsl:text>
|
---|
1544 | </xsl:template>
|
---|
1545 |
|
---|
1546 | <xsl:template match="interface//method | collection//method" mode="forwarder">
|
---|
1547 |
|
---|
1548 | <xsl:variable name="parent" select="ancestor::interface | ancestor::collection"/>
|
---|
1549 |
|
---|
1550 | <xsl:apply-templates select="@if" mode="begin"/>
|
---|
1551 |
|
---|
1552 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1553 | <xsl:value-of select="$parent/@name"/>
|
---|
1554 | <xsl:text>_</xsl:text>
|
---|
1555 | <xsl:call-template name="capitalize">
|
---|
1556 | <xsl:with-param name="str" select="@name"/>
|
---|
1557 | </xsl:call-template>
|
---|
1558 | <xsl:text>_TO(smth) NS_IMETHOD </xsl:text>
|
---|
1559 | <xsl:call-template name="capitalize">
|
---|
1560 | <xsl:with-param name="str" select="@name"/>
|
---|
1561 | </xsl:call-template>
|
---|
1562 | <xsl:choose>
|
---|
1563 | <xsl:when test="param">
|
---|
1564 | <xsl:text> (</xsl:text>
|
---|
1565 | <xsl:for-each select="param [position() != last()]">
|
---|
1566 | <xsl:apply-templates select="." mode="forwarder"/>
|
---|
1567 | <xsl:text>, </xsl:text>
|
---|
1568 | </xsl:for-each>
|
---|
1569 | <xsl:apply-templates select="param [last()]" mode="forwarder"/>
|
---|
1570 | <xsl:text>) { return smth </xsl:text>
|
---|
1571 | <xsl:call-template name="capitalize">
|
---|
1572 | <xsl:with-param name="str" select="@name"/>
|
---|
1573 | </xsl:call-template>
|
---|
1574 | <xsl:text> (</xsl:text>
|
---|
1575 | <xsl:for-each select="param [position() != last()]">
|
---|
1576 | <xsl:if test="@safearray='yes'">
|
---|
1577 | <xsl:text>a</xsl:text>
|
---|
1578 | <xsl:call-template name="capitalize">
|
---|
1579 | <xsl:with-param name="str" select="@name"/>
|
---|
1580 | </xsl:call-template>
|
---|
1581 | <xsl:text>Size+++, </xsl:text>
|
---|
1582 | </xsl:if>
|
---|
1583 | <xsl:text>a</xsl:text>
|
---|
1584 | <xsl:call-template name="capitalize">
|
---|
1585 | <xsl:with-param name="str" select="@name"/>
|
---|
1586 | </xsl:call-template>
|
---|
1587 | <xsl:text>, </xsl:text>
|
---|
1588 | </xsl:for-each>
|
---|
1589 | <xsl:if test="param [last()]/@safearray='yes'">
|
---|
1590 | <xsl:text>a</xsl:text>
|
---|
1591 | <xsl:call-template name="capitalize">
|
---|
1592 | <xsl:with-param name="str" select="param [last()]/@name"/>
|
---|
1593 | </xsl:call-template>
|
---|
1594 | <xsl:text>Size, </xsl:text>
|
---|
1595 | </xsl:if>
|
---|
1596 | <xsl:text>a</xsl:text>
|
---|
1597 | <xsl:call-template name="capitalize">
|
---|
1598 | <xsl:with-param name="str" select="param [last()]/@name"/>
|
---|
1599 | </xsl:call-template>
|
---|
1600 | <xsl:text>); }</xsl:text>
|
---|
1601 | </xsl:when>
|
---|
1602 | <xsl:otherwise test="not(param)">
|
---|
1603 | <xsl:text>() { return smth </xsl:text>
|
---|
1604 | <xsl:call-template name="capitalize">
|
---|
1605 | <xsl:with-param name="str" select="@name"/>
|
---|
1606 | </xsl:call-template>
|
---|
1607 | <xsl:text>(); }</xsl:text>
|
---|
1608 | </xsl:otherwise>
|
---|
1609 | </xsl:choose>
|
---|
1610 | <xsl:text>
</xsl:text>
|
---|
1611 | <!-- COM_FORWARD_Interface_Method_TO_OBJ(obj) -->
|
---|
1612 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1613 | <xsl:value-of select="$parent/@name"/>
|
---|
1614 | <xsl:text>_</xsl:text>
|
---|
1615 | <xsl:call-template name="capitalize">
|
---|
1616 | <xsl:with-param name="str" select="@name"/>
|
---|
1617 | </xsl:call-template>
|
---|
1618 | <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
|
---|
1619 | <xsl:value-of select="$parent/@name"/>
|
---|
1620 | <xsl:text>_</xsl:text>
|
---|
1621 | <xsl:call-template name="capitalize">
|
---|
1622 | <xsl:with-param name="str" select="@name"/>
|
---|
1623 | </xsl:call-template>
|
---|
1624 | <xsl:text>_TO ((obj)->)
</xsl:text>
|
---|
1625 | <!-- COM_FORWARD_Interface_Method_TO_BASE(base) -->
|
---|
1626 | <xsl:text>#define COM_FORWARD_</xsl:text>
|
---|
1627 | <xsl:value-of select="$parent/@name"/>
|
---|
1628 | <xsl:text>_</xsl:text>
|
---|
1629 | <xsl:call-template name="capitalize">
|
---|
1630 | <xsl:with-param name="str" select="@name"/>
|
---|
1631 | </xsl:call-template>
|
---|
1632 | <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
|
---|
1633 | <xsl:value-of select="$parent/@name"/>
|
---|
1634 | <xsl:text>_</xsl:text>
|
---|
1635 | <xsl:call-template name="capitalize">
|
---|
1636 | <xsl:with-param name="str" select="@name"/>
|
---|
1637 | </xsl:call-template>
|
---|
1638 | <xsl:text>_TO (base::)
</xsl:text>
|
---|
1639 |
|
---|
1640 | <xsl:apply-templates select="@if" mode="end"/>
|
---|
1641 |
|
---|
1642 | </xsl:template>
|
---|
1643 |
|
---|
1644 |
|
---|
1645 | <!--
|
---|
1646 | * modules
|
---|
1647 | -->
|
---|
1648 | <xsl:template match="module">
|
---|
1649 | <xsl:apply-templates select="class"/>
|
---|
1650 | </xsl:template>
|
---|
1651 |
|
---|
1652 |
|
---|
1653 | <!--
|
---|
1654 | * co-classes
|
---|
1655 | -->
|
---|
1656 | <xsl:template match="module/class">
|
---|
1657 | <!-- class and contract id -->
|
---|
1658 | <xsl:text>
</xsl:text>
|
---|
1659 | <xsl:text>#define NS_</xsl:text>
|
---|
1660 | <xsl:call-template name="uppercase">
|
---|
1661 | <xsl:with-param name="str" select="@name"/>
|
---|
1662 | </xsl:call-template>
|
---|
1663 | <xsl:text>_CID { \
</xsl:text>
|
---|
1664 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1665 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1666 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1667 | <xsl:text>, \
 </xsl:text>
|
---|
1668 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1669 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1670 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1671 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1672 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1673 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1674 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1675 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1676 | <xsl:text> } \
}
</xsl:text>
|
---|
1677 | <xsl:text>#define NS_</xsl:text>
|
---|
1678 | <xsl:call-template name="uppercase">
|
---|
1679 | <xsl:with-param name="str" select="@name"/>
|
---|
1680 | </xsl:call-template>
|
---|
1681 | <!-- Contract ID -->
|
---|
1682 | <xsl:text>_CONTRACTID "@</xsl:text>
|
---|
1683 | <xsl:value-of select="@namespace"/>
|
---|
1684 | <xsl:text>/</xsl:text>
|
---|
1685 | <xsl:value-of select="@name"/>
|
---|
1686 | <xsl:text>;1"
</xsl:text>
|
---|
1687 | <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32 -->
|
---|
1688 | <xsl:text>/* for compatibility with Win32 */
</xsl:text>
|
---|
1689 | <xsl:text>#define CLSID_</xsl:text>
|
---|
1690 | <xsl:value-of select="@name"/>
|
---|
1691 | <xsl:text> (nsCID) NS_</xsl:text>
|
---|
1692 | <xsl:call-template name="uppercase">
|
---|
1693 | <xsl:with-param name="str" select="@name"/>
|
---|
1694 | </xsl:call-template>
|
---|
1695 | <xsl:text>_CID
</xsl:text>
|
---|
1696 | <xsl:text>

</xsl:text>
|
---|
1697 | </xsl:template>
|
---|
1698 |
|
---|
1699 |
|
---|
1700 | <!--
|
---|
1701 | * enumerators
|
---|
1702 | -->
|
---|
1703 | <xsl:template match="enumerator">
|
---|
1704 | <xsl:text>/* Start of struct </xsl:text>
|
---|
1705 | <xsl:value-of select="@name"/>
|
---|
1706 | <xsl:text> Declaration */
</xsl:text>
|
---|
1707 | <xsl:text>#define </xsl:text>
|
---|
1708 | <xsl:call-template name="uppercase">
|
---|
1709 | <xsl:with-param name="str" select="@name"/>
|
---|
1710 | </xsl:call-template>
|
---|
1711 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1712 | <xsl:text>
</xsl:text>
|
---|
1713 | <xsl:text>#define </xsl:text>
|
---|
1714 | <xsl:call-template name="uppercase">
|
---|
1715 | <xsl:with-param name="str" select="@name"/>
|
---|
1716 | </xsl:call-template>
|
---|
1717 | <xsl:text>_IID { \
</xsl:text>
|
---|
1718 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1719 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1720 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1721 | <xsl:text>, \
 </xsl:text>
|
---|
1722 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1723 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1724 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1725 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1726 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1727 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1728 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1729 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1730 | <xsl:text> } \
}
</xsl:text>
|
---|
1731 | <xsl:text>struct </xsl:text>
|
---|
1732 | <xsl:value-of select="@name"/>
|
---|
1733 | <xsl:text>_vtbl
{
</xsl:text>
|
---|
1734 | <xsl:text> struct nsISupports_vtbl nsisupports;

</xsl:text>
|
---|
1735 | <!-- attributes (properties) -->
|
---|
1736 | <xsl:text> nsresult (*HasMore)(</xsl:text>
|
---|
1737 | <xsl:value-of select="@name" />
|
---|
1738 | <xsl:text> *pThis, PRBool *more);

</xsl:text>
|
---|
1739 | <!-- GetNext -->
|
---|
1740 | <xsl:text> nsresult (*GetNext)(</xsl:text>
|
---|
1741 | <xsl:value-of select="@name" />
|
---|
1742 | <xsl:text> *pThis, </xsl:text>
|
---|
1743 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1744 | <xsl:text> *next);

</xsl:text>
|
---|
1745 | <xsl:text>};</xsl:text>
|
---|
1746 | <xsl:text>

</xsl:text>
|
---|
1747 | <xsl:text>struct </xsl:text>
|
---|
1748 | <xsl:value-of select="@name"/>
|
---|
1749 | <xsl:text>
{
 struct </xsl:text>
|
---|
1750 | <xsl:value-of select="@name"/>
|
---|
1751 | <xsl:text>_vtbl *vtbl;
};
</xsl:text>
|
---|
1752 | <xsl:text>/* End of struct </xsl:text>
|
---|
1753 | <xsl:value-of select="@name"/>
|
---|
1754 | <xsl:text> Declaration */


</xsl:text>
|
---|
1755 | </xsl:template>
|
---|
1756 |
|
---|
1757 |
|
---|
1758 | <!--
|
---|
1759 | * collections
|
---|
1760 | -->
|
---|
1761 | <xsl:template match="collection">
|
---|
1762 | <xsl:if test="not(@readonly='yes')">
|
---|
1763 | <xsl:message terminate="yes">
|
---|
1764 | <xsl:value-of select="concat(@name,': ')"/>
|
---|
1765 | <xsl:text>non-readonly collections are not currently supported</xsl:text>
|
---|
1766 | </xsl:message>
|
---|
1767 | </xsl:if>
|
---|
1768 | <xsl:text>/* Start of struct </xsl:text>
|
---|
1769 | <xsl:value-of select="@name"/>
|
---|
1770 | <xsl:text> Declaration */
</xsl:text>
|
---|
1771 | <xsl:text>#define </xsl:text>
|
---|
1772 | <xsl:call-template name="uppercase">
|
---|
1773 | <xsl:with-param name="str" select="@name"/>
|
---|
1774 | </xsl:call-template>
|
---|
1775 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1776 | <xsl:text>
</xsl:text>
|
---|
1777 | <xsl:text>#define </xsl:text>
|
---|
1778 | <xsl:call-template name="uppercase">
|
---|
1779 | <xsl:with-param name="str" select="@name"/>
|
---|
1780 | </xsl:call-template>
|
---|
1781 | <xsl:text>_IID { \
</xsl:text>
|
---|
1782 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1783 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1784 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1785 | <xsl:text>, \
 </xsl:text>
|
---|
1786 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1787 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1788 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1789 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1790 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1791 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1792 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1793 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1794 | <xsl:text> } \
}
</xsl:text>
|
---|
1795 | <xsl:text>struct </xsl:text>
|
---|
1796 | <xsl:value-of select="@name"/>
|
---|
1797 | <xsl:text>_vtbl
{
</xsl:text>
|
---|
1798 | <xsl:text> struct nsISupports_vtbl nsisupports;

</xsl:text>
|
---|
1799 | <!-- Count -->
|
---|
1800 | <xsl:text> nsresult (*GetCount)(</xsl:text>
|
---|
1801 | <xsl:value-of select="@name" />
|
---|
1802 | <xsl:text> *pThis, PRUint32 *aCount);

</xsl:text>
|
---|
1803 | <!-- GetItemAt -->
|
---|
1804 | <xsl:text> nsresult (*GetItemAt)(</xsl:text>
|
---|
1805 | <xsl:value-of select="@name" />
|
---|
1806 | <xsl:text> *pThis, PRUint32 index, </xsl:text>
|
---|
1807 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1808 | <xsl:text> **item);

</xsl:text>
|
---|
1809 | <!-- Enumerate -->
|
---|
1810 | <xsl:text> nsresult (*Enumerate)(</xsl:text>
|
---|
1811 | <xsl:value-of select="@name" />
|
---|
1812 | <xsl:text> *pThis, </xsl:text>
|
---|
1813 | <xsl:apply-templates select="@enumerator"/>
|
---|
1814 | <xsl:text> **enumerator);

</xsl:text>
|
---|
1815 | <!-- other extra attributes (properties) -->
|
---|
1816 | <xsl:apply-templates select="attribute"/>
|
---|
1817 | <!-- other extra methods -->
|
---|
1818 | <xsl:apply-templates select="method"/>
|
---|
1819 | <!-- 'if' enclosed elements, unsorted -->
|
---|
1820 | <xsl:apply-templates select="if"/>
|
---|
1821 | <xsl:text>};</xsl:text>
|
---|
1822 | <xsl:text>

</xsl:text>
|
---|
1823 | <xsl:text>struct </xsl:text>
|
---|
1824 | <xsl:value-of select="@name"/>
|
---|
1825 | <xsl:text>
{
 struct </xsl:text>
|
---|
1826 | <xsl:value-of select="@name"/>
|
---|
1827 | <xsl:text>_vtbl *vtbl;
};
</xsl:text>
|
---|
1828 | <xsl:text>/* End of struct </xsl:text>
|
---|
1829 | <xsl:value-of select="@name"/>
|
---|
1830 | <xsl:text> Declaration */


</xsl:text>
|
---|
1831 | </xsl:template>
|
---|
1832 |
|
---|
1833 |
|
---|
1834 | <!--
|
---|
1835 | * enums
|
---|
1836 | -->
|
---|
1837 | <xsl:template match="enum">
|
---|
1838 | <xsl:text>/* Start of enum </xsl:text>
|
---|
1839 | <xsl:value-of select="@name"/>
|
---|
1840 | <xsl:text> Declaration */
</xsl:text>
|
---|
1841 | <xsl:text>#define </xsl:text>
|
---|
1842 | <xsl:call-template name="uppercase">
|
---|
1843 | <xsl:with-param name="str" select="@name"/>
|
---|
1844 | </xsl:call-template>
|
---|
1845 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1846 | <xsl:text>
</xsl:text>
|
---|
1847 | <xsl:text>#define </xsl:text>
|
---|
1848 | <xsl:call-template name="uppercase">
|
---|
1849 | <xsl:with-param name="str" select="@name"/>
|
---|
1850 | </xsl:call-template>
|
---|
1851 | <xsl:text>_IID { \
</xsl:text>
|
---|
1852 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1853 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1854 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1855 | <xsl:text>, \
 </xsl:text>
|
---|
1856 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1857 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1858 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1859 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1860 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1861 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1862 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1863 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1864 | <xsl:text> } \
}
</xsl:text>
|
---|
1865 | <xsl:text>enum </xsl:text>
|
---|
1866 | <xsl:value-of select="@name"/>
|
---|
1867 | <xsl:text>
{
</xsl:text>
|
---|
1868 | <xsl:variable name="this" select="."/>
|
---|
1869 | <xsl:for-each select="const">
|
---|
1870 | <xsl:text> </xsl:text>
|
---|
1871 | <xsl:value-of select="$this/@name"/>
|
---|
1872 | <xsl:text>_</xsl:text>
|
---|
1873 | <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
|
---|
1874 | <xsl:if test="position() != last()">
|
---|
1875 | <xsl:text>,</xsl:text>
|
---|
1876 | </xsl:if>
|
---|
1877 | <xsl:text>
</xsl:text>
|
---|
1878 | </xsl:for-each>
|
---|
1879 | <xsl:text>};
</xsl:text>
|
---|
1880 | <xsl:text>/* End of enum </xsl:text>
|
---|
1881 | <xsl:value-of select="@name"/>
|
---|
1882 | <xsl:text> Declaration */


</xsl:text>
|
---|
1883 | </xsl:template>
|
---|
1884 |
|
---|
1885 |
|
---|
1886 | <!--
|
---|
1887 | * method parameters
|
---|
1888 | -->
|
---|
1889 | <xsl:template match="method/param">
|
---|
1890 | <xsl:choose>
|
---|
1891 | <!-- safearray parameters -->
|
---|
1892 | <xsl:when test="@safearray='yes'">
|
---|
1893 | <!-- array size -->
|
---|
1894 | <xsl:choose>
|
---|
1895 | <xsl:when test="@dir='in'">
|
---|
1896 | <xsl:text>PRUint32 </xsl:text>
|
---|
1897 | <xsl:value-of select="@name"/>
|
---|
1898 | <xsl:text>Size,
</xsl:text>
|
---|
1899 | </xsl:when>
|
---|
1900 | <xsl:when test="@dir='out'">
|
---|
1901 | <xsl:text>PRUint32 *</xsl:text>
|
---|
1902 | <xsl:value-of select="@name"/>
|
---|
1903 | <xsl:text>Size,
</xsl:text>
|
---|
1904 | </xsl:when>
|
---|
1905 | <xsl:when test="@dir='return'">
|
---|
1906 | <xsl:text>PRUint32 *</xsl:text>
|
---|
1907 | <xsl:value-of select="@name"/>
|
---|
1908 | <xsl:text>Size,
</xsl:text>
|
---|
1909 | </xsl:when>
|
---|
1910 | <xsl:otherwise>
|
---|
1911 | <xsl:text>PRUint32 </xsl:text>
|
---|
1912 | <xsl:value-of select="@name"/>
|
---|
1913 | <xsl:text>Size,
</xsl:text>
|
---|
1914 | </xsl:otherwise>
|
---|
1915 | </xsl:choose>
|
---|
1916 | <!-- array pointer -->
|
---|
1917 | <xsl:text> </xsl:text>
|
---|
1918 | <xsl:choose>
|
---|
1919 | <xsl:when test="@dir='in'">
|
---|
1920 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1921 | <xsl:text>*</xsl:text>
|
---|
1922 | </xsl:when>
|
---|
1923 | <xsl:when test="@dir='out'">
|
---|
1924 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1925 | <xsl:if test="@type='wstring'">
|
---|
1926 | <xsl:text>*</xsl:text>
|
---|
1927 | </xsl:if>
|
---|
1928 | <xsl:text>*</xsl:text>
|
---|
1929 | </xsl:when>
|
---|
1930 | <xsl:when test="@dir='return'">
|
---|
1931 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1932 | <xsl:text>**</xsl:text>
|
---|
1933 | </xsl:when>
|
---|
1934 | <xsl:otherwise>
|
---|
1935 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1936 | <xsl:text>*</xsl:text>
|
---|
1937 | </xsl:otherwise>
|
---|
1938 | </xsl:choose>
|
---|
1939 | <xsl:text> </xsl:text>
|
---|
1940 | <xsl:value-of select="@name"/>
|
---|
1941 | </xsl:when>
|
---|
1942 | <!-- normal and array parameters -->
|
---|
1943 | <xsl:otherwise>
|
---|
1944 | <xsl:if test="@array">
|
---|
1945 | <xsl:if test="@dir='return'">
|
---|
1946 | <xsl:message terminate="yes">
|
---|
1947 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
1948 | <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text>
|
---|
1949 | </xsl:message>
|
---|
1950 | </xsl:if>
|
---|
1951 | <xsl:text>[array, </xsl:text>
|
---|
1952 | <xsl:choose>
|
---|
1953 | <xsl:when test="../param[@name=current()/@array]">
|
---|
1954 | <xsl:if test="../param[@name=current()/@array]/@dir != @dir">
|
---|
1955 | <xsl:message terminate="yes">
|
---|
1956 | <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
|
---|
1957 | <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/>
|
---|
1958 | <xsl:text> must have the same direction</xsl:text>
|
---|
1959 | </xsl:message>
|
---|
1960 | </xsl:if>
|
---|
1961 | <xsl:text>size_is(</xsl:text>
|
---|
1962 | <xsl:value-of select="@array"/>
|
---|
1963 | <xsl:text>)</xsl:text>
|
---|
1964 | </xsl:when>
|
---|
1965 | <xsl:otherwise>
|
---|
1966 | <xsl:message terminate="yes">
|
---|
1967 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
1968 | <xsl:text>array attribute refers to non-existent param: </xsl:text>
|
---|
1969 | <xsl:value-of select="@array"/>
|
---|
1970 | </xsl:message>
|
---|
1971 | </xsl:otherwise>
|
---|
1972 | </xsl:choose>
|
---|
1973 | <xsl:text>] </xsl:text>
|
---|
1974 | </xsl:if>
|
---|
1975 | <xsl:choose>
|
---|
1976 | <xsl:when test="@dir='in'">
|
---|
1977 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1978 | <xsl:text></xsl:text>
|
---|
1979 | </xsl:when>
|
---|
1980 | <xsl:when test="@dir='out'">
|
---|
1981 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1982 | <xsl:text> *</xsl:text>
|
---|
1983 | </xsl:when>
|
---|
1984 | <xsl:when test="@dir='return'">
|
---|
1985 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1986 | <xsl:text> *</xsl:text>
|
---|
1987 | </xsl:when>
|
---|
1988 | <xsl:otherwise>
|
---|
1989 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1990 | <xsl:text></xsl:text>
|
---|
1991 | </xsl:otherwise>
|
---|
1992 | </xsl:choose>
|
---|
1993 | <xsl:text> </xsl:text>
|
---|
1994 | <xsl:value-of select="@name"/>
|
---|
1995 | </xsl:otherwise>
|
---|
1996 | </xsl:choose>
|
---|
1997 | </xsl:template>
|
---|
1998 |
|
---|
1999 | <xsl:template match="method/param" mode="forwarder">
|
---|
2000 | <xsl:if test="@safearray='yes'">
|
---|
2001 | <xsl:text>PRUint32</xsl:text>
|
---|
2002 | <xsl:if test="@dir='out' or @dir='return'">
|
---|
2003 | <xsl:text> *</xsl:text>
|
---|
2004 | </xsl:if>
|
---|
2005 | <xsl:text> a</xsl:text>
|
---|
2006 | <xsl:call-template name="capitalize">
|
---|
2007 | <xsl:with-param name="str" select="@name"/>
|
---|
2008 | </xsl:call-template>
|
---|
2009 | <xsl:text>Size, </xsl:text>
|
---|
2010 | </xsl:if>
|
---|
2011 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
2012 | <xsl:if test="@dir='out' or @dir='return'">
|
---|
2013 | <xsl:text> *</xsl:text>
|
---|
2014 | </xsl:if>
|
---|
2015 | <xsl:if test="@safearray='yes'">
|
---|
2016 | <xsl:text> *</xsl:text>
|
---|
2017 | </xsl:if>
|
---|
2018 | <xsl:text> a</xsl:text>
|
---|
2019 | <xsl:call-template name="capitalize">
|
---|
2020 | <xsl:with-param name="str" select="@name"/>
|
---|
2021 | </xsl:call-template>
|
---|
2022 | </xsl:template>
|
---|
2023 |
|
---|
2024 |
|
---|
2025 | <!--
|
---|
2026 | * attribute/parameter type conversion
|
---|
2027 | -->
|
---|
2028 | <xsl:template match="
|
---|
2029 | attribute/@type | param/@type |
|
---|
2030 | enumerator/@type | collection/@type | collection/@enumerator
|
---|
2031 | ">
|
---|
2032 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
2033 |
|
---|
2034 | <xsl:if test="../@array and ../@safearray='yes'">
|
---|
2035 | <xsl:message terminate="yes">
|
---|
2036 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
2037 | <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
|
---|
2038 | </xsl:message>
|
---|
2039 | </xsl:if>
|
---|
2040 |
|
---|
2041 | <xsl:choose>
|
---|
2042 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
2043 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
2044 | <xsl:choose>
|
---|
2045 | <xsl:when test="../@mod='ptr'">
|
---|
2046 | <xsl:choose>
|
---|
2047 | <!-- standard types -->
|
---|
2048 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
2049 | <xsl:when test=".='boolean'">booleanPtr</xsl:when>
|
---|
2050 | <xsl:when test=".='octet'">octetPtr</xsl:when>
|
---|
2051 | <xsl:when test=".='short'">shortPtr</xsl:when>
|
---|
2052 | <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
|
---|
2053 | <xsl:when test=".='long'">longPtr</xsl:when>
|
---|
2054 | <xsl:when test=".='long long'">llongPtr</xsl:when>
|
---|
2055 | <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
|
---|
2056 | <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
|
---|
2057 | <xsl:when test=".='char'">charPtr</xsl:when>
|
---|
2058 | <!--xsl:when test=".='string'">??</xsl:when-->
|
---|
2059 | <xsl:when test=".='wchar'">wcharPtr</xsl:when>
|
---|
2060 | <!--xsl:when test=".='wstring'">??</xsl:when-->
|
---|
2061 | <xsl:otherwise>
|
---|
2062 | <xsl:message terminate="yes">
|
---|
2063 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
2064 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
2065 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
2066 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
2067 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
2068 | </xsl:message>
|
---|
2069 | </xsl:otherwise>
|
---|
2070 | </xsl:choose>
|
---|
2071 | </xsl:when>
|
---|
2072 | <xsl:otherwise>
|
---|
2073 | <xsl:message terminate="yes">
|
---|
2074 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
2075 | <xsl:value-of select="concat('value "',../@mod,'" ')"/>
|
---|
2076 | <xsl:text>of attribute 'mod' is invalid!</xsl:text>
|
---|
2077 | </xsl:message>
|
---|
2078 | </xsl:otherwise>
|
---|
2079 | </xsl:choose>
|
---|
2080 | </xsl:when>
|
---|
2081 | <!-- no modifiers -->
|
---|
2082 | <xsl:otherwise>
|
---|
2083 | <xsl:choose>
|
---|
2084 | <!-- standard types -->
|
---|
2085 | <xsl:when test=".='result'">nsresult</xsl:when>
|
---|
2086 | <xsl:when test=".='boolean'">boolean</xsl:when>
|
---|
2087 | <xsl:when test=".='octet'">octet</xsl:when>
|
---|
2088 | <xsl:when test=".='short'">short</xsl:when>
|
---|
2089 | <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
|
---|
2090 | <xsl:when test=".='long'">long</xsl:when>
|
---|
2091 | <xsl:when test=".='long long'">long long</xsl:when>
|
---|
2092 | <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
|
---|
2093 | <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
|
---|
2094 | <xsl:when test=".='char'">char</xsl:when>
|
---|
2095 | <xsl:when test=".='wchar'">wchar</xsl:when>
|
---|
2096 | <xsl:when test=".='string'">string</xsl:when>
|
---|
2097 | <xsl:when test=".='wstring'">wstring</xsl:when>
|
---|
2098 | <!-- UUID type -->
|
---|
2099 | <xsl:when test=".='uuid'">
|
---|
2100 | <xsl:choose>
|
---|
2101 | <xsl:when test="name(..)='attribute'">
|
---|
2102 | <xsl:choose>
|
---|
2103 | <xsl:when test="../@readonly='yes'">
|
---|
2104 | <xsl:text>nsIDPtr</xsl:text>
|
---|
2105 | </xsl:when>
|
---|
2106 | <xsl:otherwise>
|
---|
2107 | <xsl:message terminate="yes">
|
---|
2108 | <xsl:value-of select="../@name"/>
|
---|
2109 | <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
|
---|
2110 | </xsl:message>
|
---|
2111 | </xsl:otherwise>
|
---|
2112 | </xsl:choose>
|
---|
2113 | </xsl:when>
|
---|
2114 | <xsl:when test="name(..)='param'">
|
---|
2115 | <xsl:choose>
|
---|
2116 | <xsl:when test="../@dir='in' and not(../@safearray='yes')">
|
---|
2117 | <xsl:text>nsIDRef</xsl:text>
|
---|
2118 | </xsl:when>
|
---|
2119 | <xsl:otherwise>
|
---|
2120 | <xsl:text>nsIDPtr</xsl:text>
|
---|
2121 | </xsl:otherwise>
|
---|
2122 | </xsl:choose>
|
---|
2123 | </xsl:when>
|
---|
2124 | </xsl:choose>
|
---|
2125 | </xsl:when>
|
---|
2126 | <!-- system interface types -->
|
---|
2127 | <xsl:when test=".='$unknown'">nsISupports</xsl:when>
|
---|
2128 | <xsl:otherwise>
|
---|
2129 | <xsl:choose>
|
---|
2130 | <!-- enum types -->
|
---|
2131 | <xsl:when test="
|
---|
2132 | (ancestor::library/enum[@name=current()]) or
|
---|
2133 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
2134 | ">
|
---|
2135 | <xsl:text>PRUint32</xsl:text>
|
---|
2136 | </xsl:when>
|
---|
2137 | <!-- custom interface types -->
|
---|
2138 | <xsl:when test="
|
---|
2139 | (name(current())='enumerator' and
|
---|
2140 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
2141 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
2142 | ) or
|
---|
2143 | ((ancestor::library/interface[@name=current()]) or
|
---|
2144 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
2145 | ) or
|
---|
2146 | ((ancestor::library/collection[@name=current()]) or
|
---|
2147 | (ancestor::library/if[@target=$self_target]/collection[@name=current()])
|
---|
2148 | )
|
---|
2149 | ">
|
---|
2150 | <xsl:value-of select="."/>
|
---|
2151 | </xsl:when>
|
---|
2152 | <!-- other types -->
|
---|
2153 | <xsl:otherwise>
|
---|
2154 | <xsl:message terminate="yes">
|
---|
2155 | <xsl:text>Unknown parameter type: </xsl:text>
|
---|
2156 | <xsl:value-of select="."/>
|
---|
2157 | </xsl:message>
|
---|
2158 | </xsl:otherwise>
|
---|
2159 | </xsl:choose>
|
---|
2160 | </xsl:otherwise>
|
---|
2161 | </xsl:choose>
|
---|
2162 | </xsl:otherwise>
|
---|
2163 | </xsl:choose>
|
---|
2164 | </xsl:template>
|
---|
2165 |
|
---|
2166 | <xsl:template match="
|
---|
2167 | attribute/@type | param/@type |
|
---|
2168 | enumerator/@type | collection/@type | collection/@enumerator
|
---|
2169 | " mode="forwarder">
|
---|
2170 |
|
---|
2171 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
2172 |
|
---|
2173 | <xsl:choose>
|
---|
2174 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
2175 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
2176 | <xsl:choose>
|
---|
2177 | <xsl:when test="../@mod='ptr'">
|
---|
2178 | <xsl:choose>
|
---|
2179 | <!-- standard types -->
|
---|
2180 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
2181 | <xsl:when test=".='boolean'">PRBool *</xsl:when>
|
---|
2182 | <xsl:when test=".='octet'">PRUint8 *</xsl:when>
|
---|
2183 | <xsl:when test=".='short'">PRInt16 *</xsl:when>
|
---|
2184 | <xsl:when test=".='unsigned short'">PRUint16 *</xsl:when>
|
---|
2185 | <xsl:when test=".='long'">PRInt32 *</xsl:when>
|
---|
2186 | <xsl:when test=".='long long'">PRInt64 *</xsl:when>
|
---|
2187 | <xsl:when test=".='unsigned long'">PRUint32 *</xsl:when>
|
---|
2188 | <xsl:when test=".='unsigned long long'">PRUint64 *</xsl:when>
|
---|
2189 | <xsl:when test=".='char'">char *</xsl:when>
|
---|
2190 | <!--xsl:when test=".='string'">??</xsl:when-->
|
---|
2191 | <xsl:when test=".='wchar'">PRUnichar *</xsl:when>
|
---|
2192 | <!--xsl:when test=".='wstring'">??</xsl:when-->
|
---|
2193 | </xsl:choose>
|
---|
2194 | </xsl:when>
|
---|
2195 | </xsl:choose>
|
---|
2196 | </xsl:when>
|
---|
2197 | <!-- no modifiers -->
|
---|
2198 | <xsl:otherwise>
|
---|
2199 | <xsl:choose>
|
---|
2200 | <!-- standard types -->
|
---|
2201 | <xsl:when test=".='result'">nsresult</xsl:when>
|
---|
2202 | <xsl:when test=".='boolean'">PRBool</xsl:when>
|
---|
2203 | <xsl:when test=".='octet'">PRUint8</xsl:when>
|
---|
2204 | <xsl:when test=".='short'">PRInt16</xsl:when>
|
---|
2205 | <xsl:when test=".='unsigned short'">PRUint16</xsl:when>
|
---|
2206 | <xsl:when test=".='long'">PRInt32</xsl:when>
|
---|
2207 | <xsl:when test=".='long long'">PRInt64</xsl:when>
|
---|
2208 | <xsl:when test=".='unsigned long'">PRUint32</xsl:when>
|
---|
2209 | <xsl:when test=".='unsigned long long'">PRUint64</xsl:when>
|
---|
2210 | <xsl:when test=".='char'">char</xsl:when>
|
---|
2211 | <xsl:when test=".='wchar'">PRUnichar</xsl:when>
|
---|
2212 | <!-- string types -->
|
---|
2213 | <xsl:when test=".='string'">char *</xsl:when>
|
---|
2214 | <xsl:when test=".='wstring'">PRUnichar *</xsl:when>
|
---|
2215 | <!-- UUID type -->
|
---|
2216 | <xsl:when test=".='uuid'">
|
---|
2217 | <xsl:choose>
|
---|
2218 | <xsl:when test="name(..)='attribute'">
|
---|
2219 | <xsl:choose>
|
---|
2220 | <xsl:when test="../@readonly='yes'">
|
---|
2221 | <xsl:text>nsID *</xsl:text>
|
---|
2222 | </xsl:when>
|
---|
2223 | </xsl:choose>
|
---|
2224 | </xsl:when>
|
---|
2225 | <xsl:when test="name(..)='param'">
|
---|
2226 | <xsl:choose>
|
---|
2227 | <xsl:when test="../@dir='in' and not(../@safearray='yes')">
|
---|
2228 | <xsl:text>const nsID *</xsl:text>
|
---|
2229 | </xsl:when>
|
---|
2230 | <xsl:otherwise>
|
---|
2231 | <xsl:text>nsID *</xsl:text>
|
---|
2232 | </xsl:otherwise>
|
---|
2233 | </xsl:choose>
|
---|
2234 | </xsl:when>
|
---|
2235 | </xsl:choose>
|
---|
2236 | </xsl:when>
|
---|
2237 | <!-- system interface types -->
|
---|
2238 | <xsl:when test=".='$unknown'">nsISupports *</xsl:when>
|
---|
2239 | <xsl:otherwise>
|
---|
2240 | <xsl:choose>
|
---|
2241 | <!-- enum types -->
|
---|
2242 | <xsl:when test="
|
---|
2243 | (ancestor::library/enum[@name=current()]) or
|
---|
2244 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
2245 | ">
|
---|
2246 | <xsl:text>PRUint32</xsl:text>
|
---|
2247 | </xsl:when>
|
---|
2248 | <!-- custom interface types -->
|
---|
2249 | <xsl:when test="
|
---|
2250 | (name(current())='enumerator' and
|
---|
2251 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
2252 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
2253 | ) or
|
---|
2254 | ((ancestor::library/interface[@name=current()]) or
|
---|
2255 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
2256 | ) or
|
---|
2257 | ((ancestor::library/collection[@name=current()]) or
|
---|
2258 | (ancestor::library/if[@target=$self_target]/collection[@name=current()])
|
---|
2259 | )
|
---|
2260 | ">
|
---|
2261 | <xsl:value-of select="."/>
|
---|
2262 | <xsl:text> *</xsl:text>
|
---|
2263 | </xsl:when>
|
---|
2264 | <!-- other types -->
|
---|
2265 | </xsl:choose>
|
---|
2266 | </xsl:otherwise>
|
---|
2267 | </xsl:choose>
|
---|
2268 | </xsl:otherwise>
|
---|
2269 | </xsl:choose>
|
---|
2270 | </xsl:template>
|
---|
2271 |
|
---|
2272 | </xsl:stylesheet>
|
---|
2273 |
|
---|