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

</xsl:text>
|
---|
1691 | </xsl:template>
|
---|
1692 |
|
---|
1693 |
|
---|
1694 | <!--
|
---|
1695 | * enums
|
---|
1696 | -->
|
---|
1697 | <xsl:template match="enum">
|
---|
1698 | <xsl:text>/* Start of enum </xsl:text>
|
---|
1699 | <xsl:value-of select="@name"/>
|
---|
1700 | <xsl:text> Declaration */
</xsl:text>
|
---|
1701 | <xsl:text>#define </xsl:text>
|
---|
1702 | <xsl:call-template name="uppercase">
|
---|
1703 | <xsl:with-param name="str" select="@name"/>
|
---|
1704 | </xsl:call-template>
|
---|
1705 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1706 | <xsl:text>
</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:text>_IID { \
</xsl:text>
|
---|
1712 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1713 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1714 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1715 | <xsl:text>, \
 </xsl:text>
|
---|
1716 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1717 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1718 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1719 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1720 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1721 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1722 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1723 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1724 | <xsl:text> } \
}
</xsl:text>
|
---|
1725 | <xsl:text>enum </xsl:text>
|
---|
1726 | <xsl:value-of select="@name"/>
|
---|
1727 | <xsl:text>
{
</xsl:text>
|
---|
1728 | <xsl:variable name="this" select="."/>
|
---|
1729 | <xsl:for-each select="const">
|
---|
1730 | <xsl:text> </xsl:text>
|
---|
1731 | <xsl:value-of select="$this/@name"/>
|
---|
1732 | <xsl:text>_</xsl:text>
|
---|
1733 | <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
|
---|
1734 | <xsl:if test="position() != last()">
|
---|
1735 | <xsl:text>,</xsl:text>
|
---|
1736 | </xsl:if>
|
---|
1737 | <xsl:text>
</xsl:text>
|
---|
1738 | </xsl:for-each>
|
---|
1739 | <xsl:text>};
</xsl:text>
|
---|
1740 | <xsl:text>/* End of enum </xsl:text>
|
---|
1741 | <xsl:value-of select="@name"/>
|
---|
1742 | <xsl:text> Declaration */


</xsl:text>
|
---|
1743 | </xsl:template>
|
---|
1744 |
|
---|
1745 |
|
---|
1746 | <!--
|
---|
1747 | * method parameters
|
---|
1748 | -->
|
---|
1749 | <xsl:template match="method/param">
|
---|
1750 | <xsl:choose>
|
---|
1751 | <!-- safearray parameters -->
|
---|
1752 | <xsl:when test="@safearray='yes'">
|
---|
1753 | <!-- array size -->
|
---|
1754 | <xsl:choose>
|
---|
1755 | <xsl:when test="@dir='in'">
|
---|
1756 | <xsl:text>PRUint32 </xsl:text>
|
---|
1757 | <xsl:value-of select="@name"/>
|
---|
1758 | <xsl:text>Size,
</xsl:text>
|
---|
1759 | </xsl:when>
|
---|
1760 | <xsl:when test="@dir='out'">
|
---|
1761 | <xsl:text>PRUint32 *</xsl:text>
|
---|
1762 | <xsl:value-of select="@name"/>
|
---|
1763 | <xsl:text>Size,
</xsl:text>
|
---|
1764 | </xsl:when>
|
---|
1765 | <xsl:when test="@dir='return'">
|
---|
1766 | <xsl:text>PRUint32 *</xsl:text>
|
---|
1767 | <xsl:value-of select="@name"/>
|
---|
1768 | <xsl:text>Size,
</xsl:text>
|
---|
1769 | </xsl:when>
|
---|
1770 | <xsl:otherwise>
|
---|
1771 | <xsl:text>PRUint32 </xsl:text>
|
---|
1772 | <xsl:value-of select="@name"/>
|
---|
1773 | <xsl:text>Size,
</xsl:text>
|
---|
1774 | </xsl:otherwise>
|
---|
1775 | </xsl:choose>
|
---|
1776 | <!-- array pointer -->
|
---|
1777 | <xsl:text> </xsl:text>
|
---|
1778 | <xsl:choose>
|
---|
1779 | <xsl:when test="@dir='in'">
|
---|
1780 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1781 | <xsl:text>*</xsl:text>
|
---|
1782 | </xsl:when>
|
---|
1783 | <xsl:when test="@dir='out'">
|
---|
1784 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1785 | <xsl:if test="@type='wstring'">
|
---|
1786 | <xsl:text>*</xsl:text>
|
---|
1787 | </xsl:if>
|
---|
1788 | <xsl:text>*</xsl:text>
|
---|
1789 | </xsl:when>
|
---|
1790 | <xsl:when test="@dir='return'">
|
---|
1791 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1792 | <xsl:text>**</xsl:text>
|
---|
1793 | </xsl:when>
|
---|
1794 | <xsl:otherwise>
|
---|
1795 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1796 | <xsl:text>*</xsl:text>
|
---|
1797 | </xsl:otherwise>
|
---|
1798 | </xsl:choose>
|
---|
1799 | <xsl:text> </xsl:text>
|
---|
1800 | <xsl:value-of select="@name"/>
|
---|
1801 | </xsl:when>
|
---|
1802 | <!-- normal and array parameters -->
|
---|
1803 | <xsl:otherwise>
|
---|
1804 | <xsl:choose>
|
---|
1805 | <xsl:when test="@dir='in'">
|
---|
1806 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1807 | <xsl:text></xsl:text>
|
---|
1808 | </xsl:when>
|
---|
1809 | <xsl:when test="@dir='out'">
|
---|
1810 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1811 | <xsl:text> *</xsl:text>
|
---|
1812 | </xsl:when>
|
---|
1813 | <xsl:when test="@dir='return'">
|
---|
1814 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1815 | <xsl:text> *</xsl:text>
|
---|
1816 | </xsl:when>
|
---|
1817 | <xsl:otherwise>
|
---|
1818 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1819 | <xsl:text></xsl:text>
|
---|
1820 | </xsl:otherwise>
|
---|
1821 | </xsl:choose>
|
---|
1822 | <xsl:text> </xsl:text>
|
---|
1823 | <xsl:value-of select="@name"/>
|
---|
1824 | </xsl:otherwise>
|
---|
1825 | </xsl:choose>
|
---|
1826 | </xsl:template>
|
---|
1827 |
|
---|
1828 | <xsl:template match="method/param" mode="forwarder">
|
---|
1829 | <xsl:if test="@safearray='yes'">
|
---|
1830 | <xsl:text>PRUint32</xsl:text>
|
---|
1831 | <xsl:if test="@dir='out' or @dir='return'">
|
---|
1832 | <xsl:text> *</xsl:text>
|
---|
1833 | </xsl:if>
|
---|
1834 | <xsl:text> a</xsl:text>
|
---|
1835 | <xsl:call-template name="capitalize">
|
---|
1836 | <xsl:with-param name="str" select="@name"/>
|
---|
1837 | </xsl:call-template>
|
---|
1838 | <xsl:text>Size, </xsl:text>
|
---|
1839 | </xsl:if>
|
---|
1840 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1841 | <xsl:if test="@dir='out' or @dir='return'">
|
---|
1842 | <xsl:text> *</xsl:text>
|
---|
1843 | </xsl:if>
|
---|
1844 | <xsl:if test="@safearray='yes'">
|
---|
1845 | <xsl:text> *</xsl:text>
|
---|
1846 | </xsl:if>
|
---|
1847 | <xsl:text> a</xsl:text>
|
---|
1848 | <xsl:call-template name="capitalize">
|
---|
1849 | <xsl:with-param name="str" select="@name"/>
|
---|
1850 | </xsl:call-template>
|
---|
1851 | </xsl:template>
|
---|
1852 |
|
---|
1853 |
|
---|
1854 | <!--
|
---|
1855 | * attribute/parameter type conversion
|
---|
1856 | -->
|
---|
1857 | <xsl:template match="attribute/@type | param/@type">
|
---|
1858 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
1859 |
|
---|
1860 | <xsl:choose>
|
---|
1861 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
1862 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
1863 | <xsl:choose>
|
---|
1864 | <xsl:when test="../@mod='ptr'">
|
---|
1865 | <xsl:choose>
|
---|
1866 | <!-- standard types -->
|
---|
1867 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
1868 | <xsl:when test=".='boolean'">booleanPtr</xsl:when>
|
---|
1869 | <xsl:when test=".='octet'">octetPtr</xsl:when>
|
---|
1870 | <xsl:when test=".='short'">shortPtr</xsl:when>
|
---|
1871 | <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
|
---|
1872 | <xsl:when test=".='long'">longPtr</xsl:when>
|
---|
1873 | <xsl:when test=".='long long'">llongPtr</xsl:when>
|
---|
1874 | <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
|
---|
1875 | <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
|
---|
1876 | <xsl:otherwise>
|
---|
1877 | <xsl:message terminate="yes">
|
---|
1878 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
1879 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
1880 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
1881 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
1882 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
1883 | </xsl:message>
|
---|
1884 | </xsl:otherwise>
|
---|
1885 | </xsl:choose>
|
---|
1886 | </xsl:when>
|
---|
1887 | <xsl:when test="../@mod='string'">
|
---|
1888 | <xsl:choose>
|
---|
1889 | <!-- standard types -->
|
---|
1890 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
1891 | <xsl:when test=".='uuid'">wstring</xsl:when>
|
---|
1892 | <xsl:otherwise>
|
---|
1893 | <xsl:message terminate="yes">
|
---|
1894 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
1895 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
1896 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
1897 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
1898 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
1899 | </xsl:message>
|
---|
1900 | </xsl:otherwise>
|
---|
1901 | </xsl:choose>
|
---|
1902 | </xsl:when>
|
---|
1903 | <xsl:otherwise>
|
---|
1904 | <xsl:message terminate="yes">
|
---|
1905 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
1906 | <xsl:value-of select="concat('value "',../@mod,'" ')"/>
|
---|
1907 | <xsl:text>of attribute 'mod' is invalid!</xsl:text>
|
---|
1908 | </xsl:message>
|
---|
1909 | </xsl:otherwise>
|
---|
1910 | </xsl:choose>
|
---|
1911 | </xsl:when>
|
---|
1912 | <!-- no modifiers -->
|
---|
1913 | <xsl:otherwise>
|
---|
1914 | <xsl:choose>
|
---|
1915 | <!-- standard types -->
|
---|
1916 | <xsl:when test=".='result'">nsresult</xsl:when>
|
---|
1917 | <xsl:when test=".='boolean'">boolean</xsl:when>
|
---|
1918 | <xsl:when test=".='octet'">octet</xsl:when>
|
---|
1919 | <xsl:when test=".='short'">short</xsl:when>
|
---|
1920 | <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
|
---|
1921 | <xsl:when test=".='long'">long</xsl:when>
|
---|
1922 | <xsl:when test=".='long long'">long long</xsl:when>
|
---|
1923 | <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
|
---|
1924 | <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
|
---|
1925 | <xsl:when test=".='char'">char</xsl:when>
|
---|
1926 | <xsl:when test=".='wchar'">wchar</xsl:when>
|
---|
1927 | <xsl:when test=".='string'">string</xsl:when>
|
---|
1928 | <xsl:when test=".='wstring'">wstring</xsl:when>
|
---|
1929 | <!-- UUID type -->
|
---|
1930 | <xsl:when test=".='uuid'">
|
---|
1931 | <xsl:choose>
|
---|
1932 | <xsl:when test="name(..)='attribute'">
|
---|
1933 | <xsl:choose>
|
---|
1934 | <xsl:when test="../@readonly='yes'">
|
---|
1935 | <xsl:text>nsIDPtr</xsl:text>
|
---|
1936 | </xsl:when>
|
---|
1937 | <xsl:otherwise>
|
---|
1938 | <xsl:message terminate="yes">
|
---|
1939 | <xsl:value-of select="../@name"/>
|
---|
1940 | <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
|
---|
1941 | </xsl:message>
|
---|
1942 | </xsl:otherwise>
|
---|
1943 | </xsl:choose>
|
---|
1944 | </xsl:when>
|
---|
1945 | <xsl:when test="name(..)='param'">
|
---|
1946 | <xsl:choose>
|
---|
1947 | <xsl:when test="../@dir='in' and not(../@safearray='yes')">
|
---|
1948 | <xsl:text>nsIDRef</xsl:text>
|
---|
1949 | </xsl:when>
|
---|
1950 | <xsl:otherwise>
|
---|
1951 | <xsl:text>nsIDPtr</xsl:text>
|
---|
1952 | </xsl:otherwise>
|
---|
1953 | </xsl:choose>
|
---|
1954 | </xsl:when>
|
---|
1955 | </xsl:choose>
|
---|
1956 | </xsl:when>
|
---|
1957 | <!-- system interface types -->
|
---|
1958 | <xsl:when test=".='$unknown'">nsISupports</xsl:when>
|
---|
1959 | <xsl:otherwise>
|
---|
1960 | <xsl:choose>
|
---|
1961 | <!-- enum types -->
|
---|
1962 | <xsl:when test="
|
---|
1963 | (ancestor::library/enum[@name=current()]) or
|
---|
1964 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
1965 | ">
|
---|
1966 | <xsl:text>PRUint32</xsl:text>
|
---|
1967 | </xsl:when>
|
---|
1968 | <!-- custom interface types -->
|
---|
1969 | <xsl:when test="
|
---|
1970 | (name(current())='enumerator' and
|
---|
1971 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
1972 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
1973 | ) or
|
---|
1974 | ((ancestor::library/interface[@name=current()]) or
|
---|
1975 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
1976 | )
|
---|
1977 | ">
|
---|
1978 | <xsl:value-of select="."/>
|
---|
1979 | </xsl:when>
|
---|
1980 | <!-- other types -->
|
---|
1981 | <xsl:otherwise>
|
---|
1982 | <xsl:message terminate="yes">
|
---|
1983 | <xsl:text>Unknown parameter type: </xsl:text>
|
---|
1984 | <xsl:value-of select="."/>
|
---|
1985 | </xsl:message>
|
---|
1986 | </xsl:otherwise>
|
---|
1987 | </xsl:choose>
|
---|
1988 | </xsl:otherwise>
|
---|
1989 | </xsl:choose>
|
---|
1990 | </xsl:otherwise>
|
---|
1991 | </xsl:choose>
|
---|
1992 | </xsl:template>
|
---|
1993 |
|
---|
1994 | <xsl:template match="attribute/@type | param/@type" mode="forwarder">
|
---|
1995 |
|
---|
1996 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
1997 |
|
---|
1998 | <xsl:choose>
|
---|
1999 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
2000 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
2001 | <xsl:choose>
|
---|
2002 | <xsl:when test="../@mod='ptr'">
|
---|
2003 | <xsl:choose>
|
---|
2004 | <!-- standard types -->
|
---|
2005 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
2006 | <xsl:when test=".='boolean'">PRBool *</xsl:when>
|
---|
2007 | <xsl:when test=".='octet'">PRUint8 *</xsl:when>
|
---|
2008 | <xsl:when test=".='short'">PRInt16 *</xsl:when>
|
---|
2009 | <xsl:when test=".='unsigned short'">PRUint16 *</xsl:when>
|
---|
2010 | <xsl:when test=".='long'">PRInt32 *</xsl:when>
|
---|
2011 | <xsl:when test=".='long long'">PRInt64 *</xsl:when>
|
---|
2012 | <xsl:when test=".='unsigned long'">PRUint32 *</xsl:when>
|
---|
2013 | <xsl:when test=".='unsigned long long'">PRUint64 *</xsl:when>
|
---|
2014 | <xsl:otherwise>
|
---|
2015 | <xsl:message terminate="yes">
|
---|
2016 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
2017 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
2018 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
2019 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
2020 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
2021 | </xsl:message>
|
---|
2022 | </xsl:otherwise>
|
---|
2023 | </xsl:choose>
|
---|
2024 | </xsl:when>
|
---|
2025 | <xsl:when test="../@mod='string'">
|
---|
2026 | <xsl:choose>
|
---|
2027 | <!-- standard types -->
|
---|
2028 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
2029 | <xsl:when test=".='uuid'">PRUnichar *</xsl:when>
|
---|
2030 | <xsl:otherwise>
|
---|
2031 | <xsl:message terminate="yes">
|
---|
2032 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
2033 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
2034 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
2035 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
2036 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
2037 | </xsl:message>
|
---|
2038 | </xsl:otherwise>
|
---|
2039 | </xsl:choose>
|
---|
2040 | </xsl:when>
|
---|
2041 | </xsl:choose>
|
---|
2042 | </xsl:when>
|
---|
2043 | <!-- no modifiers -->
|
---|
2044 | <xsl:otherwise>
|
---|
2045 | <xsl:choose>
|
---|
2046 | <!-- standard types -->
|
---|
2047 | <xsl:when test=".='result'">nsresult</xsl:when>
|
---|
2048 | <xsl:when test=".='boolean'">PRBool</xsl:when>
|
---|
2049 | <xsl:when test=".='octet'">PRUint8</xsl:when>
|
---|
2050 | <xsl:when test=".='short'">PRInt16</xsl:when>
|
---|
2051 | <xsl:when test=".='unsigned short'">PRUint16</xsl:when>
|
---|
2052 | <xsl:when test=".='long'">PRInt32</xsl:when>
|
---|
2053 | <xsl:when test=".='long long'">PRInt64</xsl:when>
|
---|
2054 | <xsl:when test=".='unsigned long'">PRUint32</xsl:when>
|
---|
2055 | <xsl:when test=".='unsigned long long'">PRUint64</xsl:when>
|
---|
2056 | <xsl:when test=".='char'">char</xsl:when>
|
---|
2057 | <xsl:when test=".='wchar'">PRUnichar</xsl:when>
|
---|
2058 | <!-- string types -->
|
---|
2059 | <xsl:when test=".='string'">char *</xsl:when>
|
---|
2060 | <xsl:when test=".='wstring'">PRUnichar *</xsl:when>
|
---|
2061 | <!-- UUID type -->
|
---|
2062 | <xsl:when test=".='uuid'">
|
---|
2063 | <xsl:choose>
|
---|
2064 | <xsl:when test="name(..)='attribute'">
|
---|
2065 | <xsl:choose>
|
---|
2066 | <xsl:when test="../@readonly='yes'">
|
---|
2067 | <xsl:text>nsID *</xsl:text>
|
---|
2068 | </xsl:when>
|
---|
2069 | </xsl:choose>
|
---|
2070 | </xsl:when>
|
---|
2071 | <xsl:when test="name(..)='param'">
|
---|
2072 | <xsl:choose>
|
---|
2073 | <xsl:when test="../@dir='in' and not(../@safearray='yes')">
|
---|
2074 | <xsl:text>const nsID *</xsl:text>
|
---|
2075 | </xsl:when>
|
---|
2076 | <xsl:otherwise>
|
---|
2077 | <xsl:text>nsID *</xsl:text>
|
---|
2078 | </xsl:otherwise>
|
---|
2079 | </xsl:choose>
|
---|
2080 | </xsl:when>
|
---|
2081 | </xsl:choose>
|
---|
2082 | </xsl:when>
|
---|
2083 | <!-- system interface types -->
|
---|
2084 | <xsl:when test=".='$unknown'">nsISupports *</xsl:when>
|
---|
2085 | <xsl:otherwise>
|
---|
2086 | <xsl:choose>
|
---|
2087 | <!-- enum types -->
|
---|
2088 | <xsl:when test="
|
---|
2089 | (ancestor::library/enum[@name=current()]) or
|
---|
2090 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
2091 | ">
|
---|
2092 | <xsl:text>PRUint32</xsl:text>
|
---|
2093 | </xsl:when>
|
---|
2094 | <!-- custom interface types -->
|
---|
2095 | <xsl:when test="
|
---|
2096 | (name(current())='enumerator' and
|
---|
2097 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
2098 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
2099 | ) or
|
---|
2100 | ((ancestor::library/interface[@name=current()]) or
|
---|
2101 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
2102 | )
|
---|
2103 | ">
|
---|
2104 | <xsl:value-of select="."/>
|
---|
2105 | <xsl:text> *</xsl:text>
|
---|
2106 | </xsl:when>
|
---|
2107 | <!-- other types -->
|
---|
2108 | </xsl:choose>
|
---|
2109 | </xsl:otherwise>
|
---|
2110 | </xsl:choose>
|
---|
2111 | </xsl:otherwise>
|
---|
2112 | </xsl:choose>
|
---|
2113 | </xsl:template>
|
---|
2114 |
|
---|
2115 | </xsl:stylesheet>
|
---|
2116 |
|
---|