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 |
|
---|
673 |
|
---|
674 | /**
|
---|
675 | * An "interface id" which can be used to uniquely identify a given
|
---|
676 | * interface.
|
---|
677 | * A "unique identifier". This is modeled after OSF DCE UUIDs.
|
---|
678 | */
|
---|
679 |
|
---|
680 | struct nsID {
|
---|
681 | PRUint32 m0;
|
---|
682 | PRUint16 m1;
|
---|
683 | PRUint16 m2;
|
---|
684 | PRUint8 m3[8];
|
---|
685 | };
|
---|
686 |
|
---|
687 | typedef struct nsID nsID;
|
---|
688 | typedef nsID nsIID;
|
---|
689 |
|
---|
690 | struct nsISupports; /* forward declaration */
|
---|
691 | struct nsIStackFrame; /* forward declaration */
|
---|
692 | struct nsIException; /* forward declaration */
|
---|
693 | typedef struct nsISupports nsISupports; /* forward declaration */
|
---|
694 | typedef struct nsIStackFrame nsIStackFrame; /* forward declaration */
|
---|
695 | typedef struct nsIException nsIException; /* forward declaration */
|
---|
696 |
|
---|
697 | /**
|
---|
698 | * IID for the nsISupports interface
|
---|
699 | * {00000000-0000-0000-c000-000000000046}
|
---|
700 | *
|
---|
701 | * To maintain binary compatibility with COM's IUnknown, we define the IID
|
---|
702 | * of nsISupports to be the same as that of COM's IUnknown.
|
---|
703 | */
|
---|
704 | #define NS_ISUPPORTS_IID \
|
---|
705 | { 0x00000000, 0x0000, 0x0000, \
|
---|
706 | {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
---|
707 |
|
---|
708 | /**
|
---|
709 | * Reference count values
|
---|
710 | *
|
---|
711 | * This is the return type for AddRef() and Release() in nsISupports.
|
---|
712 | * IUnknown of COM returns an unsigned long from equivalent functions.
|
---|
713 | * The following ifdef exists to maintain binary compatibility with
|
---|
714 | * IUnknown.
|
---|
715 | */
|
---|
716 |
|
---|
717 | /**
|
---|
718 | * Basic component object model interface. Objects which implement
|
---|
719 | * this interface support runtime interface discovery (QueryInterface)
|
---|
720 | * and a reference counted memory model (AddRef/Release). This is
|
---|
721 | * modelled after the win32 IUnknown API.
|
---|
722 | */
|
---|
723 | struct nsISupports_vtbl {
|
---|
724 |
|
---|
725 | /**
|
---|
726 | * @name Methods
|
---|
727 | */
|
---|
728 |
|
---|
729 | /**
|
---|
730 | * A run time mechanism for interface discovery.
|
---|
731 | * @param aIID [in] A requested interface IID
|
---|
732 | * @param aInstancePtr [out] A pointer to an interface pointer to
|
---|
733 | * receive the result.
|
---|
734 | * @return NS_OK if the interface is supported by the associated
|
---|
735 | * instance, NS_NOINTERFACE if it is not.
|
---|
736 | * NS_ERROR_INVALID_POINTER if aInstancePtr is NULL.
|
---|
737 | */
|
---|
738 | nsresult (*QueryInterface)(nsISupports *pThis, const nsID *iid, void **resultp);
|
---|
739 | /**
|
---|
740 | * Increases the reference count for this interface.
|
---|
741 | * The associated instance will not be deleted unless
|
---|
742 | * the reference count is returned to zero.
|
---|
743 | *
|
---|
744 | * @return The resulting reference count.
|
---|
745 | */
|
---|
746 | nsresult (*AddRef)(nsISupports *pThis);
|
---|
747 |
|
---|
748 | /**
|
---|
749 | * Decreases the reference count for this interface.
|
---|
750 | * Generally, if the reference count returns to zero,
|
---|
751 | * the associated instance is deleted.
|
---|
752 | *
|
---|
753 | * @return The resulting reference count.
|
---|
754 | */
|
---|
755 | nsresult (*Release)(nsISupports *pThis);
|
---|
756 |
|
---|
757 | };
|
---|
758 |
|
---|
759 | struct nsISupports {
|
---|
760 | struct nsISupports_vtbl *vtbl;
|
---|
761 | };
|
---|
762 |
|
---|
763 | /* starting interface: nsIException */
|
---|
764 | #define NS_IEXCEPTION_IID_STR "f3a8d3b4-c424-4edc-8bf6-8974c983ba78"
|
---|
765 |
|
---|
766 | #define NS_IEXCEPTION_IID \
|
---|
767 | {0xf3a8d3b4, 0xc424, 0x4edc, \
|
---|
768 | { 0x8b, 0xf6, 0x89, 0x74, 0xc9, 0x83, 0xba, 0x78 }}
|
---|
769 |
|
---|
770 | struct nsIException_vtbl {
|
---|
771 |
|
---|
772 | /* Methods from the Class nsISupports */
|
---|
773 | struct nsISupports_vtbl nsisupports;
|
---|
774 |
|
---|
775 | /* readonly attribute string message; */
|
---|
776 | nsresult (*GetMessage)(nsIException *pThis, PRUnichar * *aMessage);
|
---|
777 |
|
---|
778 | /* readonly attribute nsresult (*result; */
|
---|
779 | nsresult (*GetResult)(nsIException *pThis, nsresult *aResult);
|
---|
780 |
|
---|
781 | /* readonly attribute string name; */
|
---|
782 | nsresult (*GetName)(nsIException *pThis, PRUnichar * *aName);
|
---|
783 |
|
---|
784 | /* readonly attribute string filename; */
|
---|
785 | nsresult (*GetFilename)(nsIException *pThis, PRUnichar * *aFilename);
|
---|
786 |
|
---|
787 | /* readonly attribute PRUint32 lineNumber; */
|
---|
788 | nsresult (*GetLineNumber)(nsIException *pThis, PRUint32 *aLineNumber);
|
---|
789 |
|
---|
790 | /* readonly attribute PRUint32 columnNumber; */
|
---|
791 | nsresult (*GetColumnNumber)(nsIException *pThis, PRUint32 *aColumnNumber);
|
---|
792 |
|
---|
793 | /* readonly attribute nsIStackFrame location; */
|
---|
794 | nsresult (*GetLocation)(nsIException *pThis, nsIStackFrame * *aLocation);
|
---|
795 |
|
---|
796 | /* readonly attribute nsIException inner; */
|
---|
797 | nsresult (*GetInner)(nsIException *pThis, nsIException * *aInner);
|
---|
798 |
|
---|
799 | /* readonly attribute nsISupports data; */
|
---|
800 | nsresult (*GetData)(nsIException *pThis, nsISupports * *aData);
|
---|
801 |
|
---|
802 | /* string toString (); */
|
---|
803 | nsresult (*ToString)(nsIException *pThis, PRUnichar **_retval);
|
---|
804 | };
|
---|
805 |
|
---|
806 | struct nsIException {
|
---|
807 | struct nsIException_vtbl *vtbl;
|
---|
808 | };
|
---|
809 |
|
---|
810 | /* starting interface: nsIStackFrame */
|
---|
811 | #define NS_ISTACKFRAME_IID_STR "91d82105-7c62-4f8b-9779-154277c0ee90"
|
---|
812 |
|
---|
813 | #define NS_ISTACKFRAME_IID \
|
---|
814 | {0x91d82105, 0x7c62, 0x4f8b, \
|
---|
815 | { 0x97, 0x79, 0x15, 0x42, 0x77, 0xc0, 0xee, 0x90 }}
|
---|
816 |
|
---|
817 | struct nsIStackFrame_vtbl {
|
---|
818 |
|
---|
819 | /* Methods from the Class nsISupports */
|
---|
820 | struct nsISupports_vtbl nsisupports;
|
---|
821 |
|
---|
822 | /* readonly attribute PRUint32 language; */
|
---|
823 | nsresult (*GetLanguage)(nsIStackFrame *pThis, PRUint32 *aLanguage);
|
---|
824 |
|
---|
825 | /* readonly attribute string languageName; */
|
---|
826 | nsresult (*GetLanguageName)(nsIStackFrame *pThis, PRUnichar * *aLanguageName);
|
---|
827 |
|
---|
828 | /* readonly attribute string filename; */
|
---|
829 | nsresult (*GetFilename)(nsIStackFrame *pThis, PRUnichar * *aFilename);
|
---|
830 |
|
---|
831 | /* readonly attribute string name; */
|
---|
832 | nsresult (*GetName)(nsIStackFrame *pThis, PRUnichar * *aName);
|
---|
833 |
|
---|
834 | /* readonly attribute PRInt32 lineNumber; */
|
---|
835 | nsresult (*GetLineNumber)(nsIStackFrame *pThis, PRInt32 *aLineNumber);
|
---|
836 |
|
---|
837 | /* readonly attribute string sourceLine; */
|
---|
838 | nsresult (*GetSourceLine)(nsIStackFrame *pThis, PRUnichar * *aSourceLine);
|
---|
839 |
|
---|
840 | /* readonly attribute nsIStackFrame caller; */
|
---|
841 | nsresult (*GetCaller)(nsIStackFrame *pThis, nsIStackFrame * *aCaller);
|
---|
842 |
|
---|
843 | /* string toString (); */
|
---|
844 | nsresult (*ToString)(nsIStackFrame *pThis, PRUnichar **_retval);
|
---|
845 | };
|
---|
846 |
|
---|
847 | struct nsIStackFrame {
|
---|
848 | struct nsIStackFrame_vtbl *vtbl;
|
---|
849 | };
|
---|
850 |
|
---|
851 | /* starting interface: nsIEventTarget */
|
---|
852 | #define NS_IEVENTTARGET_IID_STR "ea99ad5b-cc67-4efb-97c9-2ef620a59f2a"
|
---|
853 |
|
---|
854 | #define NS_IEVENTTARGET_IID \
|
---|
855 | {0xea99ad5b, 0xcc67, 0x4efb, \
|
---|
856 | { 0x97, 0xc9, 0x2e, 0xf6, 0x20, 0xa5, 0x9f, 0x2a }}
|
---|
857 |
|
---|
858 | struct nsIEventTarget;
|
---|
859 | typedef struct nsIEventTarget nsIEventTarget;
|
---|
860 |
|
---|
861 | struct nsIEventTarget_vtbl {
|
---|
862 |
|
---|
863 | struct nsISupports_vtbl nsisupports;
|
---|
864 |
|
---|
865 | nsresult (*PostEvent)(nsIEventTarget *pThis, PLEvent * aEvent);
|
---|
866 |
|
---|
867 | nsresult (*IsOnCurrentThread)(nsIEventTarget *pThis, PRBool *_retval);
|
---|
868 |
|
---|
869 | };
|
---|
870 |
|
---|
871 | struct nsIEventTarget {
|
---|
872 | struct nsIEventTarget_vtbl *vtbl;
|
---|
873 | };
|
---|
874 |
|
---|
875 | /* starting interface: nsIEventQueue */
|
---|
876 | #define NS_IEVENTQUEUE_IID_STR "176afb41-00a4-11d3-9f2a-00400553eef0"
|
---|
877 |
|
---|
878 | #define NS_IEVENTQUEUE_IID \
|
---|
879 | {0x176afb41, 0x00a4, 0x11d3, \
|
---|
880 | { 0x9f, 0x2a, 0x00, 0x40, 0x05, 0x53, 0xee, 0xf0 }}
|
---|
881 |
|
---|
882 | struct nsIEventQueue;
|
---|
883 | typedef struct nsIEventQueue nsIEventQueue;
|
---|
884 |
|
---|
885 | struct nsIEventQueue_vtbl {
|
---|
886 |
|
---|
887 | struct nsIEventTarget_vtbl nsieventtarget;
|
---|
888 |
|
---|
889 | nsresult (*InitEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor);
|
---|
890 |
|
---|
891 | nsresult (*PostSynchronousEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * *aResult);
|
---|
892 |
|
---|
893 | nsresult (*PendingEvents)(nsIEventQueue *pThis, PRBool *_retval);
|
---|
894 |
|
---|
895 | nsresult (*ProcessPendingEvents)(nsIEventQueue *pThis);
|
---|
896 |
|
---|
897 | nsresult (*EventLoop)(nsIEventQueue *pThis);
|
---|
898 |
|
---|
899 | nsresult (*EventAvailable)(nsIEventQueue *pThis, PRBool *aResult);
|
---|
900 |
|
---|
901 | nsresult (*GetEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
|
---|
902 |
|
---|
903 | nsresult (*HandleEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
|
---|
904 |
|
---|
905 | nsresult (*WaitForEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
|
---|
906 |
|
---|
907 | PRInt32 (*GetEventQueueSelectFD)(nsIEventQueue *pThis);
|
---|
908 |
|
---|
909 | nsresult (*Init)(nsIEventQueue *pThis, PRBool aNative);
|
---|
910 |
|
---|
911 | nsresult (*InitFromPRThread)(nsIEventQueue *pThis, PRThread * thread, PRBool aNative);
|
---|
912 |
|
---|
913 | nsresult (*InitFromPLQueue)(nsIEventQueue *pThis, PLEventQueue * aQueue);
|
---|
914 |
|
---|
915 | nsresult (*EnterMonitor)(nsIEventQueue *pThis);
|
---|
916 |
|
---|
917 | nsresult (*ExitMonitor)(nsIEventQueue *pThis);
|
---|
918 |
|
---|
919 | nsresult (*RevokeEvents)(nsIEventQueue *pThis, void * owner);
|
---|
920 |
|
---|
921 | nsresult (*GetPLEventQueue)(nsIEventQueue *pThis, PLEventQueue * *_retval);
|
---|
922 |
|
---|
923 | nsresult (*IsQueueNative)(nsIEventQueue *pThis, PRBool *_retval);
|
---|
924 |
|
---|
925 | nsresult (*StopAcceptingEvents)(nsIEventQueue *pThis);
|
---|
926 |
|
---|
927 | };
|
---|
928 |
|
---|
929 | struct nsIEventQueue {
|
---|
930 | struct nsIEventQueue_vtbl *vtbl;
|
---|
931 | };
|
---|
932 |
|
---|
933 | </xsl:text>
|
---|
934 | <xsl:apply-templates/>
|
---|
935 | <xsl:text>
|
---|
936 | #endif /* !__cplusplus */
|
---|
937 |
|
---|
938 | #ifdef IN_VBOXXPCOMC
|
---|
939 | # define VBOXXPCOMC_DECL(type) PR_EXPORT(type)
|
---|
940 | #else
|
---|
941 | # define VBOXXPCOMC_DECL(type) PR_IMPORT(type)
|
---|
942 | #endif
|
---|
943 |
|
---|
944 | #ifdef __cplusplus
|
---|
945 | extern "C" {
|
---|
946 | #endif
|
---|
947 |
|
---|
948 |
|
---|
949 | /**
|
---|
950 | * Function table for dynamic linking.
|
---|
951 | * Use VBoxGetFunctions() to obtain the pointer to it.
|
---|
952 | */
|
---|
953 | typedef struct VBOXXPCOMC
|
---|
954 | {
|
---|
955 | /** The size of the structure. */
|
---|
956 | unsigned cb;
|
---|
957 | /** The structure version. */
|
---|
958 | unsigned uVersion;
|
---|
959 |
|
---|
960 | unsigned int (*pfnGetVersion)(void);
|
---|
961 |
|
---|
962 | void (*pfnComInitialize)(IVirtualBox **virtualBox, ISession **session);
|
---|
963 | void (*pfnComUninitialize)(void);
|
---|
964 |
|
---|
965 | void (*pfnComUnallocMem)(void *pv);
|
---|
966 | void (*pfnUtf16Free)(PRUnichar *pwszString);
|
---|
967 | void (*pfnUtf8Free)(char *pszString);
|
---|
968 |
|
---|
969 | int (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
|
---|
970 | int (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
|
---|
971 |
|
---|
972 | void (*pfnGetEventQueue)(nsIEventQueue **eventQueue);
|
---|
973 |
|
---|
974 | /** Tail version, same as uVersion. */
|
---|
975 | unsigned uEndVersion;
|
---|
976 | } VBOXXPCOMC;
|
---|
977 | /** Pointer to a const VBoxXPCOMC function table. */
|
---|
978 | typedef VBOXXPCOMC const *PCVBOXXPCOM;
|
---|
979 |
|
---|
980 | /** The current interface version.
|
---|
981 | * For use with VBoxGetXPCOMCFunctions and to be found in
|
---|
982 | * VBOXXPCOMC::uVersion. */
|
---|
983 | #define VBOX_XPCOMC_VERSION 0x00020000U
|
---|
984 |
|
---|
985 | VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
|
---|
986 | /** Typedef for VBoxGetXPCOMCFunctions. */
|
---|
987 | typedef PCVBOXXPCOM (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
|
---|
988 |
|
---|
989 | /** The symbol name of VBoxGetXPCOMCFunctions. */
|
---|
990 | #if defined(__OS2__)
|
---|
991 | # define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "_VBoxGetXPCOMCFunctions"
|
---|
992 | #else
|
---|
993 | # define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "VBoxGetXPCOMCFunctions"
|
---|
994 | #endif
|
---|
995 |
|
---|
996 |
|
---|
997 | #ifdef __cplusplus
|
---|
998 | }
|
---|
999 | #endif
|
---|
1000 |
|
---|
1001 | #endif /* !___VirtualBox_CXPCOM_h */
|
---|
1002 | </xsl:text>
|
---|
1003 | </xsl:template>
|
---|
1004 |
|
---|
1005 | <!--
|
---|
1006 | * ignore all |if|s except those for XPIDL target
|
---|
1007 | <xsl:template match="if">
|
---|
1008 | <xsl:if test="@target='xpidl'">
|
---|
1009 | <xsl:apply-templates/>
|
---|
1010 | </xsl:if>
|
---|
1011 | </xsl:template>
|
---|
1012 | <xsl:template match="if" mode="forward">
|
---|
1013 | <xsl:if test="@target='xpidl'">
|
---|
1014 | <xsl:apply-templates mode="forward"/>
|
---|
1015 | </xsl:if>
|
---|
1016 | </xsl:template>
|
---|
1017 | <xsl:template match="if" mode="forwarder">
|
---|
1018 | <xsl:if test="@target='midl'">
|
---|
1019 | <xsl:apply-templates mode="forwarder"/>
|
---|
1020 | </xsl:if>
|
---|
1021 | </xsl:template>
|
---|
1022 |
|
---|
1023 | -->
|
---|
1024 |
|
---|
1025 | <!--
|
---|
1026 | * cpp_quote
|
---|
1027 | <xsl:template match="cpp">
|
---|
1028 | <xsl:if test="text()">
|
---|
1029 | <xsl:text>%{C++</xsl:text>
|
---|
1030 | <xsl:value-of select="text()"/>
|
---|
1031 | <xsl:text>
%}

</xsl:text>
|
---|
1032 | </xsl:if>
|
---|
1033 | <xsl:if test="not(text()) and @line">
|
---|
1034 | <xsl:text>%{C++
</xsl:text>
|
---|
1035 | <xsl:value-of select="@line"/>
|
---|
1036 | <xsl:text>
%}

</xsl:text>
|
---|
1037 | </xsl:if>
|
---|
1038 | </xsl:template>
|
---|
1039 | -->
|
---|
1040 |
|
---|
1041 |
|
---|
1042 | <!--
|
---|
1043 | * #if statement (@if attribute)
|
---|
1044 | * @note
|
---|
1045 | * xpidl doesn't support any preprocessor defines other than #include
|
---|
1046 | * (it just ignores them), so the generated IDL will most likely be
|
---|
1047 | * invalid. So for now we forbid using @if attributes
|
---|
1048 | -->
|
---|
1049 | <xsl:template match="@if" mode="begin">
|
---|
1050 | <xsl:message terminate="yes">
|
---|
1051 | @if attributes are not currently allowed because xpidl lacks
|
---|
1052 | support for #ifdef and stuff.
|
---|
1053 | </xsl:message>
|
---|
1054 | <xsl:text>#if </xsl:text>
|
---|
1055 | <xsl:value-of select="."/>
|
---|
1056 | <xsl:text>
</xsl:text>
|
---|
1057 | </xsl:template>
|
---|
1058 | <xsl:template match="@if" mode="end">
|
---|
1059 | <xsl:text>#endif
</xsl:text>
|
---|
1060 | </xsl:template>
|
---|
1061 |
|
---|
1062 |
|
---|
1063 | <!--
|
---|
1064 | * libraries
|
---|
1065 | -->
|
---|
1066 | <xsl:template match="library">
|
---|
1067 | <!-- result codes -->
|
---|
1068 | <xsl:text>
</xsl:text>
|
---|
1069 | <xsl:for-each select="result">
|
---|
1070 | <xsl:apply-templates select="."/>
|
---|
1071 | </xsl:for-each>
|
---|
1072 | <xsl:text>

</xsl:text>
|
---|
1073 | <!-- forward declarations -->
|
---|
1074 | <xsl:apply-templates select="if | interface | collection | enumerator" mode="forward"/>
|
---|
1075 | <xsl:text>
</xsl:text>
|
---|
1076 | <!-- typedef'ing the struct declarations -->
|
---|
1077 | <xsl:apply-templates select="if | interface | collection | enumerator" mode="typedef"/>
|
---|
1078 | <xsl:text>
</xsl:text>
|
---|
1079 | <!-- all enums go first -->
|
---|
1080 | <xsl:apply-templates select="enum | if/enum"/>
|
---|
1081 | <!-- everything else but result codes and enums -->
|
---|
1082 | <xsl:apply-templates select="*[not(self::result or self::enum) and
|
---|
1083 | not(self::if[result] or self::if[enum])]"/>
|
---|
1084 | <!-- -->
|
---|
1085 | </xsl:template>
|
---|
1086 |
|
---|
1087 |
|
---|
1088 | <!--
|
---|
1089 | * result codes
|
---|
1090 | -->
|
---|
1091 | <xsl:template match="result">
|
---|
1092 | <xsl:value-of select="concat('#define ',@name,' ',@value)"/>
|
---|
1093 | <xsl:text>
</xsl:text>
|
---|
1094 | </xsl:template>
|
---|
1095 |
|
---|
1096 |
|
---|
1097 | <!--
|
---|
1098 | * forward declarations
|
---|
1099 | -->
|
---|
1100 | <xsl:template match="interface | collection | enumerator" mode="forward">
|
---|
1101 | <xsl:text>struct </xsl:text>
|
---|
1102 | <xsl:value-of select="@name"/>
|
---|
1103 | <xsl:text>;
</xsl:text>
|
---|
1104 | </xsl:template>
|
---|
1105 |
|
---|
1106 |
|
---|
1107 | <!--
|
---|
1108 | * typedef'ing the struct declarations
|
---|
1109 | -->
|
---|
1110 | <xsl:template match="interface | collection | enumerator" mode="typedef">
|
---|
1111 | <xsl:text>typedef struct </xsl:text>
|
---|
1112 | <xsl:value-of select="@name"/>
|
---|
1113 | <xsl:text> </xsl:text>
|
---|
1114 | <xsl:value-of select="@name"/>
|
---|
1115 | <xsl:text>;
</xsl:text>
|
---|
1116 | </xsl:template>
|
---|
1117 |
|
---|
1118 |
|
---|
1119 | <!--
|
---|
1120 | * interfaces
|
---|
1121 | -->
|
---|
1122 | <xsl:template match="interface">
|
---|
1123 | <xsl:text>/* Start of struct </xsl:text>
|
---|
1124 | <xsl:value-of select="@name"/>
|
---|
1125 | <xsl:text> Declaration */
</xsl:text>
|
---|
1126 | <xsl:text>#define </xsl:text>
|
---|
1127 | <xsl:call-template name="uppercase">
|
---|
1128 | <xsl:with-param name="str" select="@name"/>
|
---|
1129 | </xsl:call-template>
|
---|
1130 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1131 | <xsl:text>
</xsl:text>
|
---|
1132 | <xsl:text>#define </xsl:text>
|
---|
1133 | <xsl:call-template name="uppercase">
|
---|
1134 | <xsl:with-param name="str" select="@name"/>
|
---|
1135 | </xsl:call-template>
|
---|
1136 | <xsl:text>_IID { \
</xsl:text>
|
---|
1137 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1138 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1139 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1140 | <xsl:text>, \
 </xsl:text>
|
---|
1141 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1142 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1143 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1144 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1145 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1146 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1147 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1148 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1149 | <xsl:text> } \
}
</xsl:text>
|
---|
1150 | <xsl:text>struct </xsl:text>
|
---|
1151 | <xsl:value-of select="@name"/>
|
---|
1152 | <xsl:text>_vtbl
{
</xsl:text>
|
---|
1153 | <xsl:text> </xsl:text>
|
---|
1154 | <xsl:choose>
|
---|
1155 | <xsl:when test="@extends='$unknown'">struct nsISupports_vtbl nsisupports;</xsl:when>
|
---|
1156 | <xsl:when test="@extends='$dispatched'">struct nsISupports_vtbl nsisupports;</xsl:when>
|
---|
1157 | <xsl:when test="@extends='$errorinfo'">struct nsIException_vtbl nsiexception;</xsl:when>
|
---|
1158 | <xsl:otherwise>
|
---|
1159 | <xsl:text>struct </xsl:text>
|
---|
1160 | <xsl:value-of select="@extends"/>
|
---|
1161 | <xsl:text>_vtbl </xsl:text>
|
---|
1162 | <xsl:call-template name="lowercase">
|
---|
1163 | <xsl:with-param name="str" select="@extends"/>
|
---|
1164 | </xsl:call-template>
|
---|
1165 | <xsl:text>;</xsl:text>
|
---|
1166 | </xsl:otherwise>
|
---|
1167 | </xsl:choose>
|
---|
1168 | <xsl:text>

</xsl:text>
|
---|
1169 | <!-- attributes (properties) -->
|
---|
1170 | <xsl:apply-templates select="attribute"/>
|
---|
1171 | <!-- methods -->
|
---|
1172 | <xsl:apply-templates select="method"/>
|
---|
1173 | <!-- 'if' enclosed elements, unsorted -->
|
---|
1174 | <xsl:apply-templates select="if"/>
|
---|
1175 | <!-- -->
|
---|
1176 | <xsl:text>};</xsl:text>
|
---|
1177 | <xsl:text>

</xsl:text>
|
---|
1178 | <xsl:text>struct </xsl:text>
|
---|
1179 | <xsl:value-of select="@name"/>
|
---|
1180 | <xsl:text>
{
 struct </xsl:text>
|
---|
1181 | <xsl:value-of select="@name"/>
|
---|
1182 | <xsl:text>_vtbl *vtbl;
};
</xsl:text>
|
---|
1183 | <xsl:text>/* End of struct </xsl:text>
|
---|
1184 | <xsl:value-of select="@name"/>
|
---|
1185 | <xsl:text> Declaration */


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

</xsl:text>
|
---|
1636 | </xsl:template>
|
---|
1637 |
|
---|
1638 |
|
---|
1639 | <!--
|
---|
1640 | * enumerators
|
---|
1641 | -->
|
---|
1642 | <xsl:template match="enumerator">
|
---|
1643 | <xsl:text>/* Start of struct </xsl:text>
|
---|
1644 | <xsl:value-of select="@name"/>
|
---|
1645 | <xsl:text> Declaration */
</xsl:text>
|
---|
1646 | <xsl:text>#define </xsl:text>
|
---|
1647 | <xsl:call-template name="uppercase">
|
---|
1648 | <xsl:with-param name="str" select="@name"/>
|
---|
1649 | </xsl:call-template>
|
---|
1650 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1651 | <xsl:text>
</xsl:text>
|
---|
1652 | <xsl:text>#define </xsl:text>
|
---|
1653 | <xsl:call-template name="uppercase">
|
---|
1654 | <xsl:with-param name="str" select="@name"/>
|
---|
1655 | </xsl:call-template>
|
---|
1656 | <xsl:text>_IID { \
</xsl:text>
|
---|
1657 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1658 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1659 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1660 | <xsl:text>, \
 </xsl:text>
|
---|
1661 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1662 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1663 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1664 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1665 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1666 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1667 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1668 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1669 | <xsl:text> } \
}
</xsl:text>
|
---|
1670 | <xsl:text>struct </xsl:text>
|
---|
1671 | <xsl:value-of select="@name"/>
|
---|
1672 | <xsl:text>_vtbl
{
</xsl:text>
|
---|
1673 | <xsl:text> struct nsISupports_vtbl nsisupports;

</xsl:text>
|
---|
1674 | <!-- attributes (properties) -->
|
---|
1675 | <xsl:text> nsresult (*HasMore)(</xsl:text>
|
---|
1676 | <xsl:value-of select="@name" />
|
---|
1677 | <xsl:text> *pThis, PRBool *more);

</xsl:text>
|
---|
1678 | <!-- GetNext -->
|
---|
1679 | <xsl:text> nsresult (*GetNext)(</xsl:text>
|
---|
1680 | <xsl:value-of select="@name" />
|
---|
1681 | <xsl:text> *pThis, </xsl:text>
|
---|
1682 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1683 | <xsl:text> *next);

</xsl:text>
|
---|
1684 | <xsl:text>};</xsl:text>
|
---|
1685 | <xsl:text>

</xsl:text>
|
---|
1686 | <xsl:text>struct </xsl:text>
|
---|
1687 | <xsl:value-of select="@name"/>
|
---|
1688 | <xsl:text>
{
 struct </xsl:text>
|
---|
1689 | <xsl:value-of select="@name"/>
|
---|
1690 | <xsl:text>_vtbl *vtbl;
};
</xsl:text>
|
---|
1691 | <xsl:text>/* End of struct </xsl:text>
|
---|
1692 | <xsl:value-of select="@name"/>
|
---|
1693 | <xsl:text> Declaration */


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

</xsl:text>
|
---|
1738 | <!-- Count -->
|
---|
1739 | <xsl:text> nsresult (*GetCount)(</xsl:text>
|
---|
1740 | <xsl:value-of select="@name" />
|
---|
1741 | <xsl:text> *pThis, PRUint32 *aCount);

</xsl:text>
|
---|
1742 | <!-- GetItemAt -->
|
---|
1743 | <xsl:text> nsresult (*GetItemAt)(</xsl:text>
|
---|
1744 | <xsl:value-of select="@name" />
|
---|
1745 | <xsl:text> *pThis, PRUint32 index, </xsl:text>
|
---|
1746 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1747 | <xsl:text> **item);

</xsl:text>
|
---|
1748 | <!-- Enumerate -->
|
---|
1749 | <xsl:text> nsresult (*Enumerate)(</xsl:text>
|
---|
1750 | <xsl:value-of select="@name" />
|
---|
1751 | <xsl:text> *pThis, </xsl:text>
|
---|
1752 | <xsl:apply-templates select="@enumerator"/>
|
---|
1753 | <xsl:text> **enumerator);

</xsl:text>
|
---|
1754 | <!-- other extra attributes (properties) -->
|
---|
1755 | <xsl:apply-templates select="attribute"/>
|
---|
1756 | <!-- other extra methods -->
|
---|
1757 | <xsl:apply-templates select="method"/>
|
---|
1758 | <!-- 'if' enclosed elements, unsorted -->
|
---|
1759 | <xsl:apply-templates select="if"/>
|
---|
1760 | <xsl:text>};</xsl:text>
|
---|
1761 | <xsl:text>

</xsl:text>
|
---|
1762 | <xsl:text>struct </xsl:text>
|
---|
1763 | <xsl:value-of select="@name"/>
|
---|
1764 | <xsl:text>
{
 struct </xsl:text>
|
---|
1765 | <xsl:value-of select="@name"/>
|
---|
1766 | <xsl:text>_vtbl *vtbl;
};
</xsl:text>
|
---|
1767 | <xsl:text>/* End of struct </xsl:text>
|
---|
1768 | <xsl:value-of select="@name"/>
|
---|
1769 | <xsl:text> Declaration */


</xsl:text>
|
---|
1770 | </xsl:template>
|
---|
1771 |
|
---|
1772 |
|
---|
1773 | <!--
|
---|
1774 | * enums
|
---|
1775 | -->
|
---|
1776 | <xsl:template match="enum">
|
---|
1777 | <xsl:text>/* Start of enum </xsl:text>
|
---|
1778 | <xsl:value-of select="@name"/>
|
---|
1779 | <xsl:text> Declaration */
</xsl:text>
|
---|
1780 | <xsl:text>#define </xsl:text>
|
---|
1781 | <xsl:call-template name="uppercase">
|
---|
1782 | <xsl:with-param name="str" select="@name"/>
|
---|
1783 | </xsl:call-template>
|
---|
1784 | <xsl:value-of select="concat('_IID_STR "',@uuid,'"')"/>
|
---|
1785 | <xsl:text>
</xsl:text>
|
---|
1786 | <xsl:text>#define </xsl:text>
|
---|
1787 | <xsl:call-template name="uppercase">
|
---|
1788 | <xsl:with-param name="str" select="@name"/>
|
---|
1789 | </xsl:call-template>
|
---|
1790 | <xsl:text>_IID { \
</xsl:text>
|
---|
1791 | <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/>
|
---|
1792 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/>
|
---|
1793 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/>
|
---|
1794 | <xsl:text>, \
 </xsl:text>
|
---|
1795 | <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/>
|
---|
1796 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/>
|
---|
1797 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/>
|
---|
1798 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/>
|
---|
1799 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/>
|
---|
1800 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/>
|
---|
1801 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/>
|
---|
1802 | <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
|
---|
1803 | <xsl:text> } \
}
</xsl:text>
|
---|
1804 | <xsl:text>enum </xsl:text>
|
---|
1805 | <xsl:value-of select="@name"/>
|
---|
1806 | <xsl:text>
{
</xsl:text>
|
---|
1807 | <xsl:variable name="this" select="."/>
|
---|
1808 | <xsl:for-each select="const">
|
---|
1809 | <xsl:text> </xsl:text>
|
---|
1810 | <xsl:value-of select="$this/@name"/>
|
---|
1811 | <xsl:text>_</xsl:text>
|
---|
1812 | <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>
|
---|
1813 | <xsl:if test="position() != last()">
|
---|
1814 | <xsl:text>,</xsl:text>
|
---|
1815 | </xsl:if>
|
---|
1816 | <xsl:text>
</xsl:text>
|
---|
1817 | </xsl:for-each>
|
---|
1818 | <xsl:text>};
</xsl:text>
|
---|
1819 | <xsl:text>/* End of enum </xsl:text>
|
---|
1820 | <xsl:value-of select="@name"/>
|
---|
1821 | <xsl:text> Declaration */


</xsl:text>
|
---|
1822 | </xsl:template>
|
---|
1823 |
|
---|
1824 |
|
---|
1825 | <!--
|
---|
1826 | * method parameters
|
---|
1827 | -->
|
---|
1828 | <xsl:template match="method/param">
|
---|
1829 | <xsl:choose>
|
---|
1830 | <!-- safearray parameters -->
|
---|
1831 | <xsl:when test="@safearray='yes'">
|
---|
1832 | <!-- array size -->
|
---|
1833 | <xsl:choose>
|
---|
1834 | <xsl:when test="@dir='in'">
|
---|
1835 | <xsl:text>PRUint32 </xsl:text>
|
---|
1836 | <xsl:value-of select="@name"/>
|
---|
1837 | <xsl:text>Size,
</xsl:text>
|
---|
1838 | </xsl:when>
|
---|
1839 | <xsl:when test="@dir='out'">
|
---|
1840 | <xsl:text>PRUint32 *</xsl:text>
|
---|
1841 | <xsl:value-of select="@name"/>
|
---|
1842 | <xsl:text>Size,
</xsl:text>
|
---|
1843 | </xsl:when>
|
---|
1844 | <xsl:when test="@dir='return'">
|
---|
1845 | <xsl:text>PRUint32 *</xsl:text>
|
---|
1846 | <xsl:value-of select="@name"/>
|
---|
1847 | <xsl:text>Size,
</xsl:text>
|
---|
1848 | </xsl:when>
|
---|
1849 | <xsl:otherwise>
|
---|
1850 | <xsl:text>PRUint32 </xsl:text>
|
---|
1851 | <xsl:value-of select="@name"/>
|
---|
1852 | <xsl:text>Size,
</xsl:text>
|
---|
1853 | </xsl:otherwise>
|
---|
1854 | </xsl:choose>
|
---|
1855 | <!-- array pointer -->
|
---|
1856 | <xsl:text> </xsl:text>
|
---|
1857 | <xsl:choose>
|
---|
1858 | <xsl:when test="@dir='in'">
|
---|
1859 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1860 | <xsl:text>*</xsl:text>
|
---|
1861 | </xsl:when>
|
---|
1862 | <xsl:when test="@dir='out'">
|
---|
1863 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1864 | <xsl:if test="@type='wstring'">
|
---|
1865 | <xsl:text>*</xsl:text>
|
---|
1866 | </xsl:if>
|
---|
1867 | <xsl:text>*</xsl:text>
|
---|
1868 | </xsl:when>
|
---|
1869 | <xsl:when test="@dir='return'">
|
---|
1870 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1871 | <xsl:text>**</xsl:text>
|
---|
1872 | </xsl:when>
|
---|
1873 | <xsl:otherwise>
|
---|
1874 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1875 | <xsl:text>*</xsl:text>
|
---|
1876 | </xsl:otherwise>
|
---|
1877 | </xsl:choose>
|
---|
1878 | <xsl:text> </xsl:text>
|
---|
1879 | <xsl:value-of select="@name"/>
|
---|
1880 | </xsl:when>
|
---|
1881 | <!-- normal and array parameters -->
|
---|
1882 | <xsl:otherwise>
|
---|
1883 | <xsl:if test="@array">
|
---|
1884 | <xsl:if test="@dir='return'">
|
---|
1885 | <xsl:message terminate="yes">
|
---|
1886 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
1887 | <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text>
|
---|
1888 | </xsl:message>
|
---|
1889 | </xsl:if>
|
---|
1890 | <xsl:text>[array, </xsl:text>
|
---|
1891 | <xsl:choose>
|
---|
1892 | <xsl:when test="../param[@name=current()/@array]">
|
---|
1893 | <xsl:if test="../param[@name=current()/@array]/@dir != @dir">
|
---|
1894 | <xsl:message terminate="yes">
|
---|
1895 | <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
|
---|
1896 | <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/>
|
---|
1897 | <xsl:text> must have the same direction</xsl:text>
|
---|
1898 | </xsl:message>
|
---|
1899 | </xsl:if>
|
---|
1900 | <xsl:text>size_is(</xsl:text>
|
---|
1901 | <xsl:value-of select="@array"/>
|
---|
1902 | <xsl:text>)</xsl:text>
|
---|
1903 | </xsl:when>
|
---|
1904 | <xsl:otherwise>
|
---|
1905 | <xsl:message terminate="yes">
|
---|
1906 | <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
|
---|
1907 | <xsl:text>array attribute refers to non-existent param: </xsl:text>
|
---|
1908 | <xsl:value-of select="@array"/>
|
---|
1909 | </xsl:message>
|
---|
1910 | </xsl:otherwise>
|
---|
1911 | </xsl:choose>
|
---|
1912 | <xsl:text>] </xsl:text>
|
---|
1913 | </xsl:if>
|
---|
1914 | <xsl:choose>
|
---|
1915 | <xsl:when test="@dir='in'">
|
---|
1916 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1917 | <xsl:text></xsl:text>
|
---|
1918 | </xsl:when>
|
---|
1919 | <xsl:when test="@dir='out'">
|
---|
1920 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1921 | <xsl:text> *</xsl:text>
|
---|
1922 | </xsl:when>
|
---|
1923 | <xsl:when test="@dir='return'">
|
---|
1924 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1925 | <xsl:text> *</xsl:text>
|
---|
1926 | </xsl:when>
|
---|
1927 | <xsl:otherwise>
|
---|
1928 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1929 | <xsl:text></xsl:text>
|
---|
1930 | </xsl:otherwise>
|
---|
1931 | </xsl:choose>
|
---|
1932 | <xsl:text> </xsl:text>
|
---|
1933 | <xsl:value-of select="@name"/>
|
---|
1934 | </xsl:otherwise>
|
---|
1935 | </xsl:choose>
|
---|
1936 | </xsl:template>
|
---|
1937 |
|
---|
1938 | <xsl:template match="method/param" mode="forwarder">
|
---|
1939 | <xsl:if test="@safearray='yes'">
|
---|
1940 | <xsl:text>PRUint32</xsl:text>
|
---|
1941 | <xsl:if test="@dir='out' or @dir='return'">
|
---|
1942 | <xsl:text> *</xsl:text>
|
---|
1943 | </xsl:if>
|
---|
1944 | <xsl:text> a</xsl:text>
|
---|
1945 | <xsl:call-template name="capitalize">
|
---|
1946 | <xsl:with-param name="str" select="@name"/>
|
---|
1947 | </xsl:call-template>
|
---|
1948 | <xsl:text>Size, </xsl:text>
|
---|
1949 | </xsl:if>
|
---|
1950 | <xsl:apply-templates select="@type" mode="forwarder"/>
|
---|
1951 | <xsl:if test="@dir='out' or @dir='return'">
|
---|
1952 | <xsl:text> *</xsl:text>
|
---|
1953 | </xsl:if>
|
---|
1954 | <xsl:if test="@safearray='yes'">
|
---|
1955 | <xsl:text> *</xsl:text>
|
---|
1956 | </xsl:if>
|
---|
1957 | <xsl:text> a</xsl:text>
|
---|
1958 | <xsl:call-template name="capitalize">
|
---|
1959 | <xsl:with-param name="str" select="@name"/>
|
---|
1960 | </xsl:call-template>
|
---|
1961 | </xsl:template>
|
---|
1962 |
|
---|
1963 |
|
---|
1964 | <!--
|
---|
1965 | * attribute/parameter type conversion
|
---|
1966 | -->
|
---|
1967 | <xsl:template match="
|
---|
1968 | attribute/@type | param/@type |
|
---|
1969 | enumerator/@type | collection/@type | collection/@enumerator
|
---|
1970 | ">
|
---|
1971 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
1972 |
|
---|
1973 | <xsl:if test="../@array and ../@safearray='yes'">
|
---|
1974 | <xsl:message terminate="yes">
|
---|
1975 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
1976 | <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
|
---|
1977 | </xsl:message>
|
---|
1978 | </xsl:if>
|
---|
1979 |
|
---|
1980 | <xsl:choose>
|
---|
1981 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
1982 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
1983 | <xsl:choose>
|
---|
1984 | <xsl:when test="../@mod='ptr'">
|
---|
1985 | <xsl:choose>
|
---|
1986 | <!-- standard types -->
|
---|
1987 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
1988 | <xsl:when test=".='boolean'">booleanPtr</xsl:when>
|
---|
1989 | <xsl:when test=".='octet'">octetPtr</xsl:when>
|
---|
1990 | <xsl:when test=".='short'">shortPtr</xsl:when>
|
---|
1991 | <xsl:when test=".='unsigned short'">ushortPtr</xsl:when>
|
---|
1992 | <xsl:when test=".='long'">longPtr</xsl:when>
|
---|
1993 | <xsl:when test=".='long long'">llongPtr</xsl:when>
|
---|
1994 | <xsl:when test=".='unsigned long'">ulongPtr</xsl:when>
|
---|
1995 | <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when>
|
---|
1996 | <xsl:when test=".='char'">charPtr</xsl:when>
|
---|
1997 | <!--xsl:when test=".='string'">??</xsl:when-->
|
---|
1998 | <xsl:when test=".='wchar'">wcharPtr</xsl:when>
|
---|
1999 | <!--xsl:when test=".='wstring'">??</xsl:when-->
|
---|
2000 | <xsl:otherwise>
|
---|
2001 | <xsl:message terminate="yes">
|
---|
2002 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
2003 | <xsl:text>attribute 'mod=</xsl:text>
|
---|
2004 | <xsl:value-of select="concat('"',../@mod,'"')"/>
|
---|
2005 | <xsl:text>' cannot be used with type </xsl:text>
|
---|
2006 | <xsl:value-of select="concat('"',current(),'"!')"/>
|
---|
2007 | </xsl:message>
|
---|
2008 | </xsl:otherwise>
|
---|
2009 | </xsl:choose>
|
---|
2010 | </xsl:when>
|
---|
2011 | <xsl:otherwise>
|
---|
2012 | <xsl:message terminate="yes">
|
---|
2013 | <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
|
---|
2014 | <xsl:value-of select="concat('value "',../@mod,'" ')"/>
|
---|
2015 | <xsl:text>of attribute 'mod' is invalid!</xsl:text>
|
---|
2016 | </xsl:message>
|
---|
2017 | </xsl:otherwise>
|
---|
2018 | </xsl:choose>
|
---|
2019 | </xsl:when>
|
---|
2020 | <!-- no modifiers -->
|
---|
2021 | <xsl:otherwise>
|
---|
2022 | <xsl:choose>
|
---|
2023 | <!-- standard types -->
|
---|
2024 | <xsl:when test=".='result'">nsresult</xsl:when>
|
---|
2025 | <xsl:when test=".='boolean'">boolean</xsl:when>
|
---|
2026 | <xsl:when test=".='octet'">octet</xsl:when>
|
---|
2027 | <xsl:when test=".='short'">short</xsl:when>
|
---|
2028 | <xsl:when test=".='unsigned short'">unsigned short</xsl:when>
|
---|
2029 | <xsl:when test=".='long'">long</xsl:when>
|
---|
2030 | <xsl:when test=".='long long'">long long</xsl:when>
|
---|
2031 | <xsl:when test=".='unsigned long'">unsigned long</xsl:when>
|
---|
2032 | <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when>
|
---|
2033 | <xsl:when test=".='char'">char</xsl:when>
|
---|
2034 | <xsl:when test=".='wchar'">wchar</xsl:when>
|
---|
2035 | <xsl:when test=".='string'">string</xsl:when>
|
---|
2036 | <xsl:when test=".='wstring'">wstring</xsl:when>
|
---|
2037 | <!-- UUID type -->
|
---|
2038 | <xsl:when test=".='uuid'">
|
---|
2039 | <xsl:choose>
|
---|
2040 | <xsl:when test="name(..)='attribute'">
|
---|
2041 | <xsl:choose>
|
---|
2042 | <xsl:when test="../@readonly='yes'">
|
---|
2043 | <xsl:text>nsIDPtr</xsl:text>
|
---|
2044 | </xsl:when>
|
---|
2045 | <xsl:otherwise>
|
---|
2046 | <xsl:message terminate="yes">
|
---|
2047 | <xsl:value-of select="../@name"/>
|
---|
2048 | <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text>
|
---|
2049 | </xsl:message>
|
---|
2050 | </xsl:otherwise>
|
---|
2051 | </xsl:choose>
|
---|
2052 | </xsl:when>
|
---|
2053 | <xsl:when test="name(..)='param'">
|
---|
2054 | <xsl:choose>
|
---|
2055 | <xsl:when test="../@dir='in' and not(../@safearray='yes')">
|
---|
2056 | <xsl:text>nsIDRef</xsl:text>
|
---|
2057 | </xsl:when>
|
---|
2058 | <xsl:otherwise>
|
---|
2059 | <xsl:text>nsIDPtr</xsl:text>
|
---|
2060 | </xsl:otherwise>
|
---|
2061 | </xsl:choose>
|
---|
2062 | </xsl:when>
|
---|
2063 | </xsl:choose>
|
---|
2064 | </xsl:when>
|
---|
2065 | <!-- system interface types -->
|
---|
2066 | <xsl:when test=".='$unknown'">nsISupports</xsl:when>
|
---|
2067 | <xsl:otherwise>
|
---|
2068 | <xsl:choose>
|
---|
2069 | <!-- enum types -->
|
---|
2070 | <xsl:when test="
|
---|
2071 | (ancestor::library/enum[@name=current()]) or
|
---|
2072 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
2073 | ">
|
---|
2074 | <xsl:text>PRUint32</xsl:text>
|
---|
2075 | </xsl:when>
|
---|
2076 | <!-- custom interface types -->
|
---|
2077 | <xsl:when test="
|
---|
2078 | (name(current())='enumerator' and
|
---|
2079 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
2080 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
2081 | ) or
|
---|
2082 | ((ancestor::library/interface[@name=current()]) or
|
---|
2083 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
2084 | ) or
|
---|
2085 | ((ancestor::library/collection[@name=current()]) or
|
---|
2086 | (ancestor::library/if[@target=$self_target]/collection[@name=current()])
|
---|
2087 | )
|
---|
2088 | ">
|
---|
2089 | <xsl:value-of select="."/>
|
---|
2090 | </xsl:when>
|
---|
2091 | <!-- other types -->
|
---|
2092 | <xsl:otherwise>
|
---|
2093 | <xsl:message terminate="yes">
|
---|
2094 | <xsl:text>Unknown parameter type: </xsl:text>
|
---|
2095 | <xsl:value-of select="."/>
|
---|
2096 | </xsl:message>
|
---|
2097 | </xsl:otherwise>
|
---|
2098 | </xsl:choose>
|
---|
2099 | </xsl:otherwise>
|
---|
2100 | </xsl:choose>
|
---|
2101 | </xsl:otherwise>
|
---|
2102 | </xsl:choose>
|
---|
2103 | </xsl:template>
|
---|
2104 |
|
---|
2105 | <xsl:template match="
|
---|
2106 | attribute/@type | param/@type |
|
---|
2107 | enumerator/@type | collection/@type | collection/@enumerator
|
---|
2108 | " mode="forwarder">
|
---|
2109 |
|
---|
2110 | <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
|
---|
2111 |
|
---|
2112 | <xsl:choose>
|
---|
2113 | <!-- modifiers (ignored for 'enumeration' attributes)-->
|
---|
2114 | <xsl:when test="name(current())='type' and ../@mod">
|
---|
2115 | <xsl:choose>
|
---|
2116 | <xsl:when test="../@mod='ptr'">
|
---|
2117 | <xsl:choose>
|
---|
2118 | <!-- standard types -->
|
---|
2119 | <!--xsl:when test=".='result'">??</xsl:when-->
|
---|
2120 | <xsl:when test=".='boolean'">PRBool *</xsl:when>
|
---|
2121 | <xsl:when test=".='octet'">PRUint8 *</xsl:when>
|
---|
2122 | <xsl:when test=".='short'">PRInt16 *</xsl:when>
|
---|
2123 | <xsl:when test=".='unsigned short'">PRUint16 *</xsl:when>
|
---|
2124 | <xsl:when test=".='long'">PRInt32 *</xsl:when>
|
---|
2125 | <xsl:when test=".='long long'">PRInt64 *</xsl:when>
|
---|
2126 | <xsl:when test=".='unsigned long'">PRUint32 *</xsl:when>
|
---|
2127 | <xsl:when test=".='unsigned long long'">PRUint64 *</xsl:when>
|
---|
2128 | <xsl:when test=".='char'">char *</xsl:when>
|
---|
2129 | <!--xsl:when test=".='string'">??</xsl:when-->
|
---|
2130 | <xsl:when test=".='wchar'">PRUnichar *</xsl:when>
|
---|
2131 | <!--xsl:when test=".='wstring'">??</xsl:when-->
|
---|
2132 | </xsl:choose>
|
---|
2133 | </xsl:when>
|
---|
2134 | </xsl:choose>
|
---|
2135 | </xsl:when>
|
---|
2136 | <!-- no modifiers -->
|
---|
2137 | <xsl:otherwise>
|
---|
2138 | <xsl:choose>
|
---|
2139 | <!-- standard types -->
|
---|
2140 | <xsl:when test=".='result'">nsresult</xsl:when>
|
---|
2141 | <xsl:when test=".='boolean'">PRBool</xsl:when>
|
---|
2142 | <xsl:when test=".='octet'">PRUint8</xsl:when>
|
---|
2143 | <xsl:when test=".='short'">PRInt16</xsl:when>
|
---|
2144 | <xsl:when test=".='unsigned short'">PRUint16</xsl:when>
|
---|
2145 | <xsl:when test=".='long'">PRInt32</xsl:when>
|
---|
2146 | <xsl:when test=".='long long'">PRInt64</xsl:when>
|
---|
2147 | <xsl:when test=".='unsigned long'">PRUint32</xsl:when>
|
---|
2148 | <xsl:when test=".='unsigned long long'">PRUint64</xsl:when>
|
---|
2149 | <xsl:when test=".='char'">char</xsl:when>
|
---|
2150 | <xsl:when test=".='wchar'">PRUnichar</xsl:when>
|
---|
2151 | <!-- string types -->
|
---|
2152 | <xsl:when test=".='string'">char *</xsl:when>
|
---|
2153 | <xsl:when test=".='wstring'">PRUnichar *</xsl:when>
|
---|
2154 | <!-- UUID type -->
|
---|
2155 | <xsl:when test=".='uuid'">
|
---|
2156 | <xsl:choose>
|
---|
2157 | <xsl:when test="name(..)='attribute'">
|
---|
2158 | <xsl:choose>
|
---|
2159 | <xsl:when test="../@readonly='yes'">
|
---|
2160 | <xsl:text>nsID *</xsl:text>
|
---|
2161 | </xsl:when>
|
---|
2162 | </xsl:choose>
|
---|
2163 | </xsl:when>
|
---|
2164 | <xsl:when test="name(..)='param'">
|
---|
2165 | <xsl:choose>
|
---|
2166 | <xsl:when test="../@dir='in' and not(../@safearray='yes')">
|
---|
2167 | <xsl:text>const nsID *</xsl:text>
|
---|
2168 | </xsl:when>
|
---|
2169 | <xsl:otherwise>
|
---|
2170 | <xsl:text>nsID *</xsl:text>
|
---|
2171 | </xsl:otherwise>
|
---|
2172 | </xsl:choose>
|
---|
2173 | </xsl:when>
|
---|
2174 | </xsl:choose>
|
---|
2175 | </xsl:when>
|
---|
2176 | <!-- system interface types -->
|
---|
2177 | <xsl:when test=".='$unknown'">nsISupports *</xsl:when>
|
---|
2178 | <xsl:otherwise>
|
---|
2179 | <xsl:choose>
|
---|
2180 | <!-- enum types -->
|
---|
2181 | <xsl:when test="
|
---|
2182 | (ancestor::library/enum[@name=current()]) or
|
---|
2183 | (ancestor::library/if[@target=$self_target]/enum[@name=current()])
|
---|
2184 | ">
|
---|
2185 | <xsl:text>PRUint32</xsl:text>
|
---|
2186 | </xsl:when>
|
---|
2187 | <!-- custom interface types -->
|
---|
2188 | <xsl:when test="
|
---|
2189 | (name(current())='enumerator' and
|
---|
2190 | ((ancestor::library/enumerator[@name=current()]) or
|
---|
2191 | (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
|
---|
2192 | ) or
|
---|
2193 | ((ancestor::library/interface[@name=current()]) or
|
---|
2194 | (ancestor::library/if[@target=$self_target]/interface[@name=current()])
|
---|
2195 | ) or
|
---|
2196 | ((ancestor::library/collection[@name=current()]) or
|
---|
2197 | (ancestor::library/if[@target=$self_target]/collection[@name=current()])
|
---|
2198 | )
|
---|
2199 | ">
|
---|
2200 | <xsl:value-of select="."/>
|
---|
2201 | <xsl:text> *</xsl:text>
|
---|
2202 | </xsl:when>
|
---|
2203 | <!-- other types -->
|
---|
2204 | </xsl:choose>
|
---|
2205 | </xsl:otherwise>
|
---|
2206 | </xsl:choose>
|
---|
2207 | </xsl:otherwise>
|
---|
2208 | </xsl:choose>
|
---|
2209 | </xsl:template>
|
---|
2210 |
|
---|
2211 | </xsl:stylesheet>
|
---|
2212 |
|
---|