VirtualBox

source: vbox/trunk/src/VBox/Main/idl/midl.xsl@ 66274

Last change on this file since 66274 was 66274, checked in by vboxsync, 8 years ago

VBox/Main: ​bugref:3300: VBoxSVC from terminal server session is not 'visible' - added VBoxSDS implementation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 31.8 KB
Line 
1<?xml version="1.0"?>
2<!-- $Id: midl.xsl 66274 2017-03-28 00:19:45Z vboxsync $ -->
3
4<!--
5 * A template to generate a MS IDL compatible interface definition file
6 * from the generic interface definition expressed in XML.
7
8 Copyright (C) 2006-2016 Oracle Corporation
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
19<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
20<xsl:output method="text"/>
21
22<xsl:strip-space elements="*"/>
23
24<!-- Whether to generate proxy code and type library ('yes'), or just the type-library. -->
25<xsl:param name="g_fGenProxy" select="'no'"/>
26
27<!-- Whether to generate coclass and interfaces for VBoxSDS-->
28<xsl:param name="g_fVBoxWithSDS" select="'no'"/>
29
30<xsl:include href="typemap-shared.inc.xsl"/>
31
32
33<!--
34// templates
35/////////////////////////////////////////////////////////////////////////////
36-->
37
38<!--
39 * not explicitly matched elements and attributes
40-->
41<xsl:template match="*"/>
42
43
44<!--
45 * header
46-->
47 <xsl:template match="/idl">
48 <xsl:text>
49/*
50 * DO NOT EDIT! This is a generated file.
51 *
52 * MS IDL (MIDL) definition for VirtualBox Main API (COM interfaces)
53 * generated from XIDL (XML interface definition).
54 *
55 * Source : src/VBox/Main/idl/VirtualBox.xidl
56 * Generator : src/VBox/Main/idl/midl.xsl
57 */
58
59#if (__midl >= 501)
60midl_pragma warning(disable:2039) /* Disable warning MIDL2039 regarding interface not being automation
61 marshaling conformant and requiring NT 4.0 SP4 or greater. */
62midl_pragma warning(disable:2456) /* Disable warning MIDL2456 regarding SAFEARRAY(interface pointer). */
63midl_pragma warning(disable:2111) /* Disable warning MIDL2111 regarding identifier lengths exceeding 31 chars. */
64#endif
65
66import "unknwn.idl";
67
68</xsl:text>
69 <xsl:apply-templates/>
70</xsl:template>
71
72
73<!--
74 * ignore all |if|s except those for MIDL target
75-->
76<xsl:template match="if">
77 <xsl:if test="@target='midl'">
78 <xsl:apply-templates/>
79 </xsl:if>
80</xsl:template>
81<xsl:template match="if" mode="forward">
82 <xsl:if test="@target='midl'">
83 <xsl:apply-templates mode="forward"/>
84 </xsl:if>
85</xsl:template>
86<xsl:template match="if" mode="forwarder">
87 <xsl:param name="nameOnly"/>
88 <xsl:if test="@target='midl'">
89 <xsl:apply-templates mode="forwarder">
90 <xsl:with-param name="nameOnly" select="$nameOnly"/>
91 </xsl:apply-templates>
92 </xsl:if>
93</xsl:template>
94
95
96<!--
97 * cpp_quote
98-->
99<xsl:template match="cpp">
100 <xsl:text>cpp_quote("</xsl:text>
101 <xsl:value-of select="@line"/>
102 <xsl:text>")&#x0A;&#x0A;</xsl:text>
103</xsl:template>
104
105
106<!--
107 * #if statement (@if attribute)
108-->
109<xsl:template match="@if" mode="begin">
110 <xsl:text>#if </xsl:text>
111 <xsl:value-of select="."/>
112 <xsl:text>&#x0A;</xsl:text>
113</xsl:template>
114<xsl:template match="@if" mode="end">
115 <xsl:text>#endif&#x0A;</xsl:text>
116</xsl:template>
117
118
119<!--
120 * libraries
121-->
122<xsl:template match="library">
123 <xsl:if test="$g_fGenProxy = 'yes'">
124 <!-- Declare everything outside the library and then reference these
125 from inside the library statement. See:
126 http://msdn.microsoft.com/en-us/library/windows/desktop/aa366841(v=vs.85).aspx -->
127 <xsl:text>&#x0A;</xsl:text>
128 <!-- forward declarations -->
129 <xsl:apply-templates select="application/if | application/interface" mode="forward"/>
130 <xsl:text>&#x0A;</xsl:text>
131 <!-- all enums go first -->
132 <xsl:apply-templates select="application/enum | application/if[enum]"/>
133 <!-- declare the interfaces -->
134 <xsl:apply-templates select="application/if | application/interface"/>
135 </xsl:if>
136
137[
138 uuid(<xsl:value-of select="@uuid"/>),
139 version(<xsl:value-of select="@version"/>),
140 helpstring("<xsl:value-of select="@name"/> Type Library")
141]
142<xsl:text>library </xsl:text>
143 <xsl:value-of select="@name"/>
144 <xsl:text>&#x0A;{&#x0A;</xsl:text>
145 <xsl:text>&#x0A;importlib("stdole2.tlb");&#x0A;&#x0A;</xsl:text>
146 <!-- result codes -->
147 <xsl:for-each select="application/result">
148 <xsl:apply-templates select="."/>
149 </xsl:for-each>
150 <xsl:text>&#x0A;</xsl:text>
151 <xsl:text>&#x0A;</xsl:text>
152 <xsl:choose>
153 <xsl:when test="$g_fGenProxy = 'yes'">
154 <!-- reference enums and interfaces -->
155 <xsl:apply-templates select="application/if | application/interface" mode="forward"/>
156 <xsl:apply-templates select="application/enum | application/if[enum]" mode="forward"/>
157 <!-- the modules (i.e. everything else) -->
158 <xsl:apply-templates select="application/module | application/if[module]"/>
159 </xsl:when>
160 <xsl:otherwise>
161 <!-- forward declarations -->
162 <xsl:apply-templates select="application/if | application/interface" mode="forward"/>
163 <!-- all enums go first -->
164 <xsl:apply-templates select="application/enum | application/if[enum]"/>
165 <!-- everything else but result codes and enums -->
166 <xsl:apply-templates select=" application/interface | application/if[interface]
167 | application/module | application/if[module]"/>
168 </xsl:otherwise>
169 </xsl:choose>
170 <!-- -->
171 <xsl:text>}; /* library </xsl:text>
172 <xsl:value-of select="@name"/>
173 <xsl:text> */&#x0A;&#x0A;</xsl:text>
174</xsl:template>
175
176
177<!--
178 * applications
179-->
180<xsl:template match="application">
181 <xsl:apply-templates/>
182</xsl:template>
183<xsl:template match="application" mode="forward">
184 <xsl:apply-templates mode="forward"/>
185</xsl:template>
186
187
188<!--
189 * result codes
190-->
191<xsl:template match="result">
192 <xsl:text>cpp_quote("</xsl:text>
193 <xsl:value-of select="concat('#define ',@name,' ((HRESULT)',@value, ')')"/>
194 <xsl:text>")&#x0A;</xsl:text>
195</xsl:template>
196
197
198<!--
199 * forward declarations
200-->
201<xsl:template match="interface" mode="forward" name="template_interface_forward">
202 <xsl:text>interface </xsl:text>
203 <xsl:value-of select="@name"/>
204 <xsl:text>;&#x0A;</xsl:text>
205</xsl:template>
206
207
208<xsl:template match="enum" mode="forward">
209 <xsl:text>enum </xsl:text>
210 <xsl:value-of select="@name"/>
211 <xsl:text>;&#x0A;&#x0A;</xsl:text>
212</xsl:template>
213
214
215<!--
216 * interfaces
217-->
218<xsl:template match="interface" name="template_interface">[
219 uuid(<xsl:value-of select="@uuid"/>),
220 object,
221 dual,
222 oleautomation
223<xsl:if test="$g_fGenProxy = 'yes'">
224 <!-- Indicates to the typelib that we are using a proxy stub DLL and that interfaces
225 should have any ProxyStubClsid32 or TypeLib keys in the registry. -->
226 <xsl:text> , proxy</xsl:text>
227</xsl:if>
228]
229<xsl:text>interface </xsl:text>
230 <xsl:variable name="name" select="@name"/>
231 <xsl:value-of select="$name"/>
232 <xsl:text> : </xsl:text>
233 <xsl:choose>
234 <xsl:when test="@extends='$unknown'">IDispatch</xsl:when>
235 <xsl:when test="@extends='$errorinfo'">IErrorInfo</xsl:when>
236 <!-- TODO/FIXME/BUGBUG: The above $errorinfo value causes the following warning (/W4):
237warning MIDL2460 : dual interface should be derived from IDispatch : IVirtualBoxErrorInfo [ Interface 'IVirtualBoxErrorInfo' ]
238 -->
239 <xsl:otherwise><xsl:value-of select="@extends"/></xsl:otherwise>
240 </xsl:choose>
241 <xsl:call-template name="xsltprocNewlineOutputHack"/>
242 <xsl:text>{&#x0A;</xsl:text>
243 <!-- attributes (properties) -->
244 <xsl:apply-templates select="attribute"/>
245 <xsl:variable name="reservedAttributes" select="@reservedAttributes"/>
246 <xsl:if test="$reservedAttributes > 0">
247 <!-- tricky way to do a "for" loop without recursion -->
248 <xsl:for-each select="(//*)[position() &lt;= $reservedAttributes]">
249 <xsl:text> [propget] HRESULT InternalAndReservedAttribute</xsl:text>
250 <xsl:value-of select="concat(position(), $name)"/>
251 <xsl:text> ([out, retval] ULONG *aReserved);&#x0A;&#x0A;</xsl:text>
252 </xsl:for-each>
253 </xsl:if>
254 <!-- methods -->
255 <xsl:apply-templates select="method"/>
256 <xsl:variable name="reservedMethods" select="@reservedMethods"/>
257 <xsl:if test="$reservedMethods > 0">
258 <!-- tricky way to do a "for" loop without recursion -->
259 <xsl:for-each select="(//*)[position() &lt;= $reservedMethods]">
260 <xsl:text> HRESULT InternalAndReservedMethod</xsl:text>
261 <xsl:value-of select="concat(position(), $name)"/>
262 <xsl:text>();&#x0A;&#x0A;</xsl:text>
263 </xsl:for-each>
264 </xsl:if>
265 <!-- 'if' enclosed elements, unsorted -->
266 <xsl:apply-templates select="if"/>
267 <!-- -->
268 <xsl:text>}; /* interface </xsl:text>
269 <xsl:value-of select="$name"/>
270 <xsl:text> */&#x0A;&#x0A;</xsl:text>
271 <!-- Interface implementation forwarder macro -->
272 <xsl:text>/* Interface implementation forwarder macro */&#x0A;</xsl:text>
273 <!-- 1) individual methods -->
274 <xsl:apply-templates select="attribute" mode="forwarder"/>
275 <xsl:apply-templates select="method" mode="forwarder"/>
276 <xsl:apply-templates select="if" mode="forwarder"/>
277 <!-- 2) COM_FORWARD_Interface_TO(smth) -->
278 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
279 <xsl:value-of select="$name"/>
280 <xsl:text>_TO(smth) </xsl:text>
281 <xsl:apply-templates select="attribute" mode="forwarder">
282 <xsl:with-param name="nameOnly" select="'yes'"/>
283 </xsl:apply-templates>
284 <xsl:apply-templates select="method" mode="forwarder">
285 <xsl:with-param name="nameOnly" select="'yes'"/>
286 </xsl:apply-templates>
287 <xsl:apply-templates select="if" mode="forwarder">
288 <xsl:with-param name="nameOnly" select="'yes'"/>
289 </xsl:apply-templates>
290 <xsl:text>")&#x0A;</xsl:text>
291 <!-- 3) COM_FORWARD_Interface_TO_OBJ(obj) -->
292 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
293 <xsl:value-of select="$name"/>
294 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
295 <xsl:value-of select="$name"/>
296 <xsl:text>_TO ((obj)->)")&#x0A;</xsl:text>
297 <!-- 4) COM_FORWARD_Interface_TO_BASE(base) -->
298 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
299 <xsl:value-of select="$name"/>
300 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
301 <xsl:value-of select="$name"/>
302 <xsl:text>_TO (base::)")&#x0A;</xsl:text>
303 <!-- end -->
304 <xsl:text>&#x0A;</xsl:text>
305</xsl:template>
306
307
308<!--
309 * attributes
310-->
311<xsl:template match="interface//attribute">
312 <xsl:apply-templates select="@if" mode="begin"/>
313 <!-- getter -->
314 <xsl:text> [propget] HRESULT </xsl:text>
315 <xsl:call-template name="capitalize">
316 <xsl:with-param name="str" select="@name"/>
317 </xsl:call-template>
318 <xsl:text> ([out, retval] </xsl:text>
319 <xsl:if test="@safearray='yes'">
320 <xsl:text>SAFEARRAY(</xsl:text>
321 </xsl:if>
322 <xsl:apply-templates select="@type"/>
323 <xsl:if test="@safearray='yes'">
324 <xsl:text>)</xsl:text>
325 </xsl:if>
326 <xsl:text> * a</xsl:text>
327 <xsl:call-template name="capitalize">
328 <xsl:with-param name="str" select="@name"/>
329 </xsl:call-template>
330 <xsl:text>);&#x0A;</xsl:text>
331 <!-- setter -->
332 <xsl:if test="not(@readonly='yes')">
333 <xsl:text> [propput] HRESULT </xsl:text>
334 <xsl:call-template name="capitalize">
335 <xsl:with-param name="str" select="@name"/>
336 </xsl:call-template>
337 <xsl:text> ([in] </xsl:text>
338 <xsl:if test="@safearray='yes'">
339 <xsl:text>SAFEARRAY(</xsl:text>
340 </xsl:if>
341 <xsl:apply-templates select="@type"/>
342 <xsl:if test="@safearray='yes'">
343 <xsl:text>)</xsl:text>
344 </xsl:if>
345 <xsl:text> a</xsl:text>
346 <xsl:call-template name="capitalize">
347 <xsl:with-param name="str" select="@name"/>
348 </xsl:call-template>
349 <xsl:text>);&#x0A;</xsl:text>
350 </xsl:if>
351 <xsl:apply-templates select="@if" mode="end"/>
352 <xsl:text>&#x0A;</xsl:text>
353</xsl:template>
354
355<xsl:template match="interface//attribute" mode="forwarder">
356
357 <!-- if nameOnly='yes' then only the macro name is composed
358 followed by a space -->
359 <xsl:param name="nameOnly"/>
360
361 <xsl:variable name="parent" select="ancestor::interface"/>
362
363 <xsl:apply-templates select="@if" mode="begin"/>
364
365 <xsl:choose>
366 <xsl:when test="$nameOnly='yes'">
367 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO(smth) -->
368 <xsl:text>COM_FORWARD_</xsl:text>
369 <xsl:value-of select="$parent/@name"/>
370 <xsl:text>_GETTER_</xsl:text>
371 <xsl:call-template name="capitalize">
372 <xsl:with-param name="str" select="@name"/>
373 </xsl:call-template>
374 <xsl:text>_TO (smth) </xsl:text>
375 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO(smth) -->
376 <xsl:if test="not(@readonly='yes')">
377 <xsl:text>COM_FORWARD_</xsl:text>
378 <xsl:value-of select="$parent/@name"/>
379 <xsl:text>_SETTER_</xsl:text>
380 <xsl:call-template name="capitalize">
381 <xsl:with-param name="str" select="@name"/>
382 </xsl:call-template>
383 <xsl:text>_TO (smth) </xsl:text>
384 </xsl:if>
385 </xsl:when>
386 <xsl:otherwise>
387 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO(smth) -->
388 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
389 <xsl:value-of select="$parent/@name"/>
390 <xsl:text>_GETTER_</xsl:text>
391 <xsl:call-template name="capitalize">
392 <xsl:with-param name="str" select="@name"/>
393 </xsl:call-template>
394 <xsl:text>_TO(smth) HRESULT STDMETHODCALLTYPE get_</xsl:text>
395 <xsl:call-template name="capitalize">
396 <xsl:with-param name="str" select="@name"/>
397 </xsl:call-template>
398 <xsl:text> (</xsl:text>
399 <xsl:choose>
400 <xsl:when test="@safearray='yes'">
401 <xsl:text>SAFEARRAY *</xsl:text>
402 </xsl:when>
403 <xsl:otherwise>
404 <xsl:apply-templates select="@type"/>
405 </xsl:otherwise>
406 </xsl:choose>
407 <xsl:text> * a</xsl:text>
408 <xsl:call-template name="capitalize">
409 <xsl:with-param name="str" select="@name"/>
410 </xsl:call-template>
411 <xsl:text>) { return smth get_</xsl:text>
412 <xsl:call-template name="capitalize">
413 <xsl:with-param name="str" select="@name"/>
414 </xsl:call-template>
415 <xsl:text> (a</xsl:text>
416 <xsl:call-template name="capitalize">
417 <xsl:with-param name="str" select="@name"/>
418 </xsl:call-template>
419 <xsl:text>); }")&#x0A;</xsl:text>
420 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_OBJ(obj) -->
421 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
422 <xsl:value-of select="$parent/@name"/>
423 <xsl:text>_GETTER_</xsl:text>
424 <xsl:call-template name="capitalize">
425 <xsl:with-param name="str" select="@name"/>
426 </xsl:call-template>
427 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
428 <xsl:value-of select="$parent/@name"/>
429 <xsl:text>_GETTER_</xsl:text>
430 <xsl:call-template name="capitalize">
431 <xsl:with-param name="str" select="@name"/>
432 </xsl:call-template>
433 <xsl:text>_TO ((obj)->)")&#x0A;</xsl:text>
434 <!-- getter: COM_FORWARD_Interface_GETTER_Name_TO_BASE(base) -->
435 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
436 <xsl:value-of select="$parent/@name"/>
437 <xsl:text>_GETTER_</xsl:text>
438 <xsl:call-template name="capitalize">
439 <xsl:with-param name="str" select="@name"/>
440 </xsl:call-template>
441 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
442 <xsl:value-of select="$parent/@name"/>
443 <xsl:text>_GETTER_</xsl:text>
444 <xsl:call-template name="capitalize">
445 <xsl:with-param name="str" select="@name"/>
446 </xsl:call-template>
447 <xsl:text>_TO (base::)")&#x0A;</xsl:text>
448 <!-- -->
449 <xsl:if test="not(@readonly='yes')">
450 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO(smth) -->
451 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
452 <xsl:value-of select="$parent/@name"/>
453 <xsl:text>_SETTER_</xsl:text>
454 <xsl:call-template name="capitalize">
455 <xsl:with-param name="str" select="@name"/>
456 </xsl:call-template>
457 <xsl:text>_TO(smth) HRESULT STDMETHODCALLTYPE put_</xsl:text>
458 <xsl:call-template name="capitalize">
459 <xsl:with-param name="str" select="@name"/>
460 </xsl:call-template>
461 <xsl:text> (</xsl:text>
462 <xsl:choose>
463 <xsl:when test="@safearray='yes'">
464 <xsl:text>SAFEARRAY *</xsl:text>
465 </xsl:when>
466 <xsl:otherwise>
467 <xsl:apply-templates select="@type"/>
468 </xsl:otherwise>
469 </xsl:choose>
470 <xsl:text> a</xsl:text>
471 <xsl:call-template name="capitalize">
472 <xsl:with-param name="str" select="@name"/>
473 </xsl:call-template>
474 <xsl:text>) { return smth put_</xsl:text>
475 <xsl:call-template name="capitalize">
476 <xsl:with-param name="str" select="@name"/>
477 </xsl:call-template>
478 <xsl:text> (a</xsl:text>
479 <xsl:call-template name="capitalize">
480 <xsl:with-param name="str" select="@name"/>
481 </xsl:call-template>
482 <xsl:text>); }")&#x0A;</xsl:text>
483 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_OBJ(obj) -->
484 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
485 <xsl:value-of select="$parent/@name"/>
486 <xsl:text>_SETTER_</xsl:text>
487 <xsl:call-template name="capitalize">
488 <xsl:with-param name="str" select="@name"/>
489 </xsl:call-template>
490 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
491 <xsl:value-of select="$parent/@name"/>
492 <xsl:text>_SETTER_</xsl:text>
493 <xsl:call-template name="capitalize">
494 <xsl:with-param name="str" select="@name"/>
495 </xsl:call-template>
496 <xsl:text>_TO ((obj)->)")&#x0A;</xsl:text>
497 <!-- setter: COM_FORWARD_Interface_SETTER_Name_TO_BASE(base) -->
498 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
499 <xsl:value-of select="$parent/@name"/>
500 <xsl:text>_SETTER_</xsl:text>
501 <xsl:call-template name="capitalize">
502 <xsl:with-param name="str" select="@name"/>
503 </xsl:call-template>
504 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
505 <xsl:value-of select="$parent/@name"/>
506 <xsl:text>_SETTER_</xsl:text>
507 <xsl:call-template name="capitalize">
508 <xsl:with-param name="str" select="@name"/>
509 </xsl:call-template>
510 <xsl:text>_TO (base::)")&#x0A;</xsl:text>
511 </xsl:if>
512 </xsl:otherwise>
513 </xsl:choose>
514
515 <xsl:apply-templates select="@if" mode="end"/>
516
517</xsl:template>
518
519
520<!--
521 * methods
522-->
523<xsl:template match="interface//method">
524 <xsl:apply-templates select="@if" mode="begin"/>
525 <xsl:text> HRESULT </xsl:text>
526 <xsl:call-template name="capitalize">
527 <xsl:with-param name="str" select="@name"/>
528 </xsl:call-template>
529 <xsl:choose>
530 <xsl:when test="param">
531 <xsl:text> (&#x0A;</xsl:text>
532 <xsl:for-each select="param [position() != last()]">
533 <xsl:text> </xsl:text>
534 <xsl:apply-templates select="."/>
535 <xsl:text>,&#x0A;</xsl:text>
536 </xsl:for-each>
537 <xsl:text> </xsl:text>
538 <xsl:apply-templates select="param [last()]"/>
539 <xsl:text>&#x0A; );&#x0A;</xsl:text>
540 </xsl:when>
541 <xsl:otherwise test="not(param)">
542 <xsl:text>();&#x0A;</xsl:text>
543 </xsl:otherwise>
544 </xsl:choose>
545 <xsl:apply-templates select="@if" mode="end"/>
546 <xsl:text>&#x0A;</xsl:text>
547</xsl:template>
548
549<xsl:template match="interface//method" mode="forwarder">
550
551 <!-- if nameOnly='yes' then only the macro name is composed followed by \ -->
552 <xsl:param name="nameOnly"/>
553
554 <xsl:variable name="parent" select="ancestor::interface"/>
555
556 <xsl:apply-templates select="@if" mode="begin"/>
557
558 <xsl:choose>
559 <xsl:when test="$nameOnly='yes'">
560 <!-- COM_FORWARD_Interface_Method_TO(smth) -->
561 <xsl:text>COM_FORWARD_</xsl:text>
562 <xsl:value-of select="$parent/@name"/>
563 <xsl:text>_</xsl:text>
564 <xsl:call-template name="capitalize">
565 <xsl:with-param name="str" select="@name"/>
566 </xsl:call-template>
567 <xsl:text>_TO (smth) </xsl:text>
568 </xsl:when>
569 <xsl:otherwise>
570 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
571 <xsl:value-of select="$parent/@name"/>
572 <xsl:text>_</xsl:text>
573 <xsl:call-template name="capitalize">
574 <xsl:with-param name="str" select="@name"/>
575 </xsl:call-template>
576 <xsl:text>_TO(smth) HRESULT STDMETHODCALLTYPE </xsl:text>
577 <xsl:call-template name="capitalize">
578 <xsl:with-param name="str" select="@name"/>
579 </xsl:call-template>
580 <xsl:choose>
581 <xsl:when test="param">
582 <xsl:text> (</xsl:text>
583 <xsl:for-each select="param [position() != last()]">
584 <xsl:apply-templates select="." mode="forwarder"/>
585 <xsl:text>, </xsl:text>
586 </xsl:for-each>
587 <xsl:apply-templates select="param [last()]" mode="forwarder"/>
588 <xsl:text>) { return smth </xsl:text>
589 <xsl:call-template name="capitalize">
590 <xsl:with-param name="str" select="@name"/>
591 </xsl:call-template>
592 <xsl:text> (</xsl:text>
593 <xsl:for-each select="param [position() != last()]">
594 <xsl:text>a</xsl:text>
595 <xsl:call-template name="capitalize">
596 <xsl:with-param name="str" select="@name"/>
597 </xsl:call-template>
598 <xsl:text>, </xsl:text>
599 </xsl:for-each>
600 <xsl:text>a</xsl:text>
601 <xsl:call-template name="capitalize">
602 <xsl:with-param name="str" select="param [last()]/@name"/>
603 </xsl:call-template>
604 <xsl:text>); }</xsl:text>
605 </xsl:when>
606 <xsl:otherwise test="not(param)">
607 <xsl:text>() { return smth </xsl:text>
608 <xsl:call-template name="capitalize">
609 <xsl:with-param name="str" select="@name"/>
610 </xsl:call-template>
611 <xsl:text>(); }</xsl:text>
612 </xsl:otherwise>
613 </xsl:choose>
614 <xsl:text>")&#x0A;</xsl:text>
615 <!-- COM_FORWARD_Interface_Method_TO_OBJ(obj) -->
616 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
617 <xsl:value-of select="$parent/@name"/>
618 <xsl:text>_</xsl:text>
619 <xsl:call-template name="capitalize">
620 <xsl:with-param name="str" select="@name"/>
621 </xsl:call-template>
622 <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
623 <xsl:value-of select="$parent/@name"/>
624 <xsl:text>_</xsl:text>
625 <xsl:call-template name="capitalize">
626 <xsl:with-param name="str" select="@name"/>
627 </xsl:call-template>
628 <xsl:text>_TO ((obj)->)")&#x0A;</xsl:text>
629 <!-- COM_FORWARD_Interface_Method_TO_BASE(base) -->
630 <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
631 <xsl:value-of select="$parent/@name"/>
632 <xsl:text>_</xsl:text>
633 <xsl:call-template name="capitalize">
634 <xsl:with-param name="str" select="@name"/>
635 </xsl:call-template>
636 <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
637 <xsl:value-of select="$parent/@name"/>
638 <xsl:text>_</xsl:text>
639 <xsl:call-template name="capitalize">
640 <xsl:with-param name="str" select="@name"/>
641 </xsl:call-template>
642 <xsl:text>_TO (base::)")&#x0A;</xsl:text>
643 </xsl:otherwise>
644 </xsl:choose>
645
646 <xsl:apply-templates select="@if" mode="end"/>
647
648</xsl:template>
649
650
651<!--
652 * modules
653-->
654<xsl:template match="module">
655 <xsl:apply-templates select="class"/>
656</xsl:template>
657
658
659<!--
660 * co-classes
661-->
662<xsl:template match="module/class" name="template_class">[
663 uuid(<xsl:value-of select="@uuid"/>)
664]
665<xsl:text>coclass </xsl:text>
666 <xsl:value-of select="@name"/>
667 <xsl:text>&#x0A;{&#x0A;</xsl:text>
668 <xsl:for-each select="interface">
669 <xsl:text> </xsl:text>
670 <xsl:if test="@default='yes'">
671 <xsl:text>[default] </xsl:text>
672 </xsl:if>
673 <xsl:text>interface </xsl:text>
674 <xsl:value-of select="@name"/>
675 <xsl:text>;&#x0A;</xsl:text>
676 </xsl:for-each>
677 <xsl:for-each select="eventsink">
678 <xsl:text> </xsl:text>
679 <xsl:choose>
680 <xsl:when test="@default='yes'"><xsl:text>[default,source]</xsl:text></xsl:when>
681 <xsl:otherwise><xsl:text>[source]</xsl:text></xsl:otherwise>
682 </xsl:choose>
683 <xsl:text> interface </xsl:text>
684 <xsl:value-of select="@name"/>
685 <xsl:text>;&#x0A;</xsl:text>
686 </xsl:for-each>
687 <xsl:text>&#x0A;}; /* coclass </xsl:text>
688 <xsl:value-of select="@name"/>
689 <xsl:text> */&#x0A;&#x0A;</xsl:text>
690</xsl:template>
691
692
693<!--
694 * enums
695-->
696<xsl:template match="enum">[
697 uuid(<xsl:value-of select="@uuid"/>),
698 v1_enum
699]
700<xsl:text>typedef enum &#x0A;{&#x0A;</xsl:text>
701 <xsl:for-each select="const">
702 <xsl:text> </xsl:text>
703 <xsl:value-of select="concat(../@name,'_',@name)"/> = <xsl:value-of select="@value"/>
704 <xsl:choose>
705 <xsl:when test="position()!=last()"><xsl:text>,&#x0A;</xsl:text></xsl:when>
706 <xsl:otherwise><xsl:text>&#x0A;</xsl:text></xsl:otherwise>
707 </xsl:choose>
708 </xsl:for-each>
709 <xsl:text>} </xsl:text>
710 <xsl:value-of select="@name"/>
711 <xsl:text>;&#x0A;&#x0A;</xsl:text>
712 <!-- -->
713 <xsl:value-of select="concat('/* cross-platform type name for ', @name, ' */&#x0A;')"/>
714 <xsl:value-of select="concat('cpp_quote(&quot;#define ', @name, '_T', ' ',
715 @name, '&quot;)&#x0A;&#x0A;')"/>
716 <xsl:text>&#x0A;&#x0A;</xsl:text>
717</xsl:template>
718
719
720<!--
721 * method parameters
722-->
723<xsl:template match="method/param">
724 <xsl:text>[</xsl:text>
725 <xsl:choose>
726 <xsl:when test="@dir='in'">in</xsl:when>
727 <xsl:when test="@dir='out'">out</xsl:when>
728 <xsl:when test="@dir='return'">out, retval</xsl:when>
729 <xsl:otherwise>in</xsl:otherwise>
730 </xsl:choose>
731 <xsl:text>] </xsl:text>
732 <xsl:if test="@safearray='yes'">
733 <xsl:text>SAFEARRAY(</xsl:text>
734 </xsl:if>
735 <xsl:apply-templates select="@type"/>
736 <xsl:if test="@safearray='yes'">
737 <xsl:text>)</xsl:text>
738 </xsl:if>
739 <xsl:if test="@dir='out' or @dir='return'">
740 <xsl:text> *</xsl:text>
741 </xsl:if>
742 <xsl:text> a</xsl:text>
743 <xsl:call-template name="capitalize">
744 <xsl:with-param name="str" select="@name"/>
745 </xsl:call-template>
746</xsl:template>
747
748<xsl:template match="method/param" mode="forwarder">
749 <xsl:choose>
750 <xsl:when test="@safearray='yes'">
751 <xsl:text>SAFEARRAY *</xsl:text>
752 </xsl:when>
753 <xsl:otherwise>
754 <xsl:apply-templates select="@type"/>
755 </xsl:otherwise>
756 </xsl:choose>
757 <xsl:if test="@dir='out' or @dir='return' or @safearray='yes'">
758 <xsl:text> *</xsl:text>
759 </xsl:if>
760 <xsl:text> a</xsl:text>
761 <xsl:call-template name="capitalize">
762 <xsl:with-param name="str" select="@name"/>
763 </xsl:call-template>
764</xsl:template>
765
766
767<!--
768 * attribute/parameter type conversion
769-->
770<xsl:template match="attribute/@type | param/@type">
771 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
772
773 <xsl:choose>
774 <!-- modifiers -->
775 <xsl:when test="name(current())='type' and ../@mod">
776 <xsl:choose>
777 <xsl:when test="../@mod='ptr'">
778 <xsl:choose>
779 <!-- standard types -->
780 <!--xsl:when test=".='result'">??</xsl:when-->
781 <xsl:when test=".='boolean'">BOOL *</xsl:when>
782 <xsl:when test=".='octet'">BYTE *</xsl:when>
783 <xsl:when test=".='short'">SHORT *</xsl:when>
784 <xsl:when test=".='unsigned short'">USHORT *</xsl:when>
785 <xsl:when test=".='long'">LONG *</xsl:when>
786 <xsl:when test=".='long long'">LONG64 *</xsl:when>
787 <xsl:when test=".='unsigned long'">ULONG *</xsl:when>
788 <xsl:when test=".='unsigned long long'">
789 <xsl:message terminate="yes">
790 <xsl:value-of select="'&quot;unsigned long long&quot; no longer supported'" />
791 </xsl:message>
792 </xsl:when>
793 <xsl:otherwise>
794 <xsl:message terminate="yes">
795 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
796 <xsl:text>attribute 'mod=</xsl:text>
797 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
798 <xsl:text>' cannot be used with type </xsl:text>
799 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
800 </xsl:message>
801 </xsl:otherwise>
802 </xsl:choose>
803 </xsl:when>
804 <xsl:when test="../@mod='string'">
805 <xsl:choose>
806 <!-- standard types -->
807 <!--xsl:when test=".='result'">??</xsl:when-->
808 <xsl:when test=".='uuid'">BSTR</xsl:when>
809 <xsl:otherwise>
810 <xsl:message terminate="yes">
811 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
812 <xsl:text>attribute 'mod=</xsl:text>
813 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
814 <xsl:text>' cannot be used with type </xsl:text>
815 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
816 </xsl:message>
817 </xsl:otherwise>
818 </xsl:choose>
819 </xsl:when>
820 <xsl:otherwise>
821 <xsl:message terminate="yes">
822 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
823 <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
824 <xsl:text>of attribute 'mod' is invalid!</xsl:text>
825 </xsl:message>
826 </xsl:otherwise>
827 </xsl:choose>
828 </xsl:when>
829 <!-- no modifiers -->
830 <xsl:otherwise>
831 <xsl:choose>
832 <!-- standard types -->
833 <xsl:when test=".='result'">HRESULT</xsl:when>
834 <xsl:when test=".='boolean'">BOOL</xsl:when>
835 <xsl:when test=".='octet'">BYTE</xsl:when>
836 <xsl:when test=".='short'">SHORT</xsl:when>
837 <xsl:when test=".='unsigned short'">USHORT</xsl:when>
838 <xsl:when test=".='long'">LONG</xsl:when>
839 <xsl:when test=".='long long'">LONG64</xsl:when>
840 <xsl:when test=".='unsigned long'">ULONG</xsl:when>
841 <xsl:when test=".='char'">CHAR</xsl:when>
842 <xsl:when test=".='string'">CHAR *</xsl:when>
843 <xsl:when test=".='wchar'">OLECHAR</xsl:when>
844 <xsl:when test=".='wstring'">BSTR</xsl:when>
845 <!-- UUID type -->
846 <xsl:when test=".='uuid'">GUID</xsl:when>
847 <!-- system interface types -->
848 <xsl:when test=".='$unknown'">IUnknown *</xsl:when>
849 <xsl:when test=".='unsigned long long'">
850 <xsl:message terminate="yes">
851 <xsl:value-of select="'&quot;unsigned long long&quot; no longer supported'" />
852 </xsl:message>
853 </xsl:when>
854 <xsl:otherwise>
855 <xsl:choose>
856 <!-- enum types -->
857 <xsl:when test="
858 (ancestor::library/application/enum[@name=current()]) or
859 (ancestor::library/application/if[@target=$self_target]/enum[@name=current()])
860 ">
861 <xsl:value-of select="."/>
862 </xsl:when>
863 <!-- custom interface types -->
864 <xsl:when test="
865 ((ancestor::library/application/interface[@name=current()]) or
866 (ancestor::library/application/if[@target=$self_target]/interface[@name=current()])
867 )
868 ">
869 <xsl:value-of select="."/><xsl:text> *</xsl:text>
870 </xsl:when>
871 <!-- other types -->
872 <xsl:otherwise>
873 <xsl:message terminate="yes">
874 <xsl:text>Unknown parameter type: </xsl:text>
875 <xsl:value-of select="."/>
876 </xsl:message>
877 </xsl:otherwise>
878 </xsl:choose>
879 </xsl:otherwise>
880 </xsl:choose>
881 </xsl:otherwise>
882 </xsl:choose>
883</xsl:template>
884
885
886<!-- Filters for switch on/off VBoxSDS definitions -->
887
888<xsl:template match="application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']//module/class" >
889 <xsl:if test="$g_fVBoxWithSDS='yes'" >
890 <xsl:call-template name="template_class" />
891 </xsl:if>
892</xsl:template>
893
894<xsl:template match="application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']/if//interface
895 | application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']//interface" >
896 <xsl:if test="$g_fVBoxWithSDS='yes'" >
897 <xsl:call-template name="template_interface" />
898 </xsl:if>
899</xsl:template>
900
901<xsl:template match="application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']//interface" mode="forward" >
902 <xsl:if test="$g_fVBoxWithSDS='yes'" >
903 <xsl:call-template name="template_interface_forward" />
904 </xsl:if>
905</xsl:template>
906
907
908</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

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