VirtualBox

source: vbox/trunk/src/VBox/Main/idl/apiwrap-server.xsl@ 53877

Last change on this file since 53877 was 53875, checked in by vboxsync, 10 years ago

Use the native line ending because kmk_append does and we don't like mixing EOL for a single file (VBoxAPIWrap.kmk).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 87.9 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 apiwrap-server.xsl:
5 XSLT stylesheet that generates C++ API wrappers (server side) from
6 VirtualBox.xidl.
7
8 Copyright (C) 2010-2015 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
20 version="1.0"
21 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22 xmlns:exsl="http://exslt.org/common"
23 extension-element-prefixes="exsl">
24
25<xsl:output method="text"/>
26
27<xsl:strip-space elements="*"/>
28
29<!-- - - - - - - - - - - - - - - - - - - - - - -
30 global XSLT variables
31 - - - - - - - - - - - - - - - - - - - - - - -->
32
33<xsl:variable name="G_xsltFilename" select="'apiwrap-server.xsl'"/>
34
35<xsl:variable name="G_root" select="/"/>
36
37<xsl:variable name="G_sNewLine">
38 <xsl:choose>
39 <xsl:when test="$KBUILD_HOST = 'win'">
40 <xsl:value-of select="'&#13;&#10;'"/>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:value-of select="'&#10;'"/>
44 </xsl:otherwise>
45 </xsl:choose>
46</xsl:variable>
47
48<xsl:include href="typemap-shared.inc.xsl"/>
49
50<!-- - - - - - - - - - - - - - - - - - - - - - -
51templates for file separation
52 - - - - - - - - - - - - - - - - - - - - - - -->
53
54<xsl:template match="interface" mode="listfile">
55 <xsl:param name="file"/>
56
57 <xsl:value-of select="concat('&#9;', $file, ' \', $G_sNewLine)"/>
58</xsl:template>
59
60<xsl:template match="interface" mode="startfile">
61 <xsl:param name="file"/>
62
63 <xsl:value-of select="concat($G_sNewLine, '// ##### BEGINFILE &quot;', $file, '&quot;', $G_sNewLine)"/>
64</xsl:template>
65
66<xsl:template match="interface" mode="endfile">
67 <xsl:param name="file"/>
68
69 <xsl:value-of select="concat($G_sNewLine, '// ##### ENDFILE &quot;', $file, '&quot;', $G_sNewLine)"/>
70</xsl:template>
71
72<!-- - - - - - - - - - - - - - - - - - - - - - -
73templates for file headers/footers
74 - - - - - - - - - - - - - - - - - - - - - - -->
75
76<xsl:template name="fileheader">
77 <xsl:param name="class"/>
78 <xsl:param name="name"/>
79 <xsl:param name="type"/>
80
81 <xsl:text>/** @file
82</xsl:text>
83 <xsl:value-of select="concat(' * VirtualBox API class wrapper ', $type, ' for I', $class, '.')"/>
84 <xsl:text>
85 *
86 * DO NOT EDIT! This is a generated file.
87 * Generated from: src/VBox/Main/idl/VirtualBox.xidl
88 * Generator: src/VBox/Main/idl/apiwrap-server.xsl
89 */
90
91/**
92 * Copyright (C) 2010-2015 Oracle Corporation
93 *
94 * This file is part of VirtualBox Open Source Edition (OSE), as
95 * available from http://www.virtualbox.org. This file is free software;
96 * you can redistribute it and/or modify it under the terms of the GNU
97 * General Public License (GPL) as published by the Free Software
98 * Foundation, in version 2 as it comes in the "COPYING" file of the
99 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
100 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
101 */
102
103</xsl:text>
104</xsl:template>
105
106<xsl:template name="emitCOMInterfaces">
107 <xsl:param name="iface"/>
108
109 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $iface/@name, ')' , $G_sNewLine)"/>
110 <!-- now recurse to emit all base interfaces -->
111 <xsl:variable name="extends" select="$iface/@extends"/>
112 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
113 <xsl:call-template name="emitCOMInterfaces">
114 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
115 </xsl:call-template>
116 </xsl:if>
117</xsl:template>
118
119<xsl:template match="interface" mode="classheader">
120 <xsl:param name="addinterfaces"/>
121 <xsl:value-of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_', $G_sNewLine)"/>
122 <xsl:value-of select="concat('#define ', substring(@name, 2), 'Wrap_H_')"/>
123 <xsl:text>
124
125#include "VirtualBoxBase.h"
126#include "Wrapper.h"
127
128</xsl:text>
129 <xsl:value-of select="concat('class ATL_NO_VTABLE ', substring(@name, 2), 'Wrap:')"/>
130 <xsl:text>
131 public VirtualBoxBase,
132</xsl:text>
133 <xsl:value-of select="concat(' VBOX_SCRIPTABLE_IMPL(', @name, ')')"/>
134 <xsl:if test="count(exsl:node-set($addinterfaces)/token) > 0">
135 <xsl:text>,</xsl:text>
136 </xsl:if>
137 <xsl:value-of select="$G_sNewLine"/>
138 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
139 <xsl:value-of select="concat(' VBOX_SCRIPTABLE_IMPL(', text(), ')')"/>
140 <xsl:if test="not(position()=last())">
141 <xsl:text>,</xsl:text>
142 </xsl:if>
143 <xsl:value-of select="$G_sNewLine"/>
144 </xsl:for-each>
145 <xsl:text>{
146 Q_OBJECT
147
148public:
149</xsl:text>
150 <xsl:value-of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ')', $G_sNewLine)"/>
151 <xsl:value-of select="concat(' DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
152 <xsl:text> DECLARE_PROTECT_FINAL_CONSTRUCT()
153
154</xsl:text>
155 <xsl:value-of select="concat(' BEGIN_COM_MAP(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
156 <xsl:text> COM_INTERFACE_ENTRY(ISupportErrorInfo)
157</xsl:text>
158 <xsl:call-template name="emitCOMInterfaces">
159 <xsl:with-param name="iface" select="."/>
160 </xsl:call-template>
161 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')', $G_sNewLine)"/>
162 <xsl:variable name="manualAddInterfaces">
163 <xsl:call-template name="checkoption">
164 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
165 <xsl:with-param name="option" select="'manualaddinterfaces'"/>
166 </xsl:call-template>
167 </xsl:variable>
168 <xsl:if test="not($manualAddInterfaces = 'true')">
169 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
170 <!-- This is super tricky, as the for-each switches to the node
171 set, which means the normal document isn't available any more.
172 So need to use the global root node to get back into the
173 documemt to find corresponding interface data. -->
174 <xsl:variable name="addifname">
175 <xsl:value-of select="string(.)"/>
176 </xsl:variable>
177 <xsl:call-template name="emitCOMInterfaces">
178 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
179 </xsl:call-template>
180 </xsl:for-each>
181 </xsl:if>
182 <xsl:text> COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
183 END_COM_MAP()
184
185</xsl:text>
186 <xsl:value-of select="concat(' DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
187</xsl:template>
188
189<xsl:template match="interface" mode="classfooter">
190 <xsl:param name="addinterfaces"/>
191 <xsl:text>};
192
193</xsl:text>
194 <xsl:value-of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_', $G_sNewLine)"/>
195</xsl:template>
196
197<xsl:template match="interface" mode="codeheader">
198 <xsl:param name="addinterfaces"/>
199 <xsl:value-of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), $G_sNewLine, $G_sNewLine)"/>
200 <xsl:value-of select="concat('#include &quot;', substring(@name, 2), 'Wrap.h&quot;', $G_sNewLine)"/>
201 <xsl:text>#include "Logging.h"
202#ifdef VBOX_WITH_DTRACE_R3_MAIN
203# include "dtrace/VBoxAPI.h"
204#endif
205
206</xsl:text>
207</xsl:template>
208
209<xsl:template name="emitISupports">
210 <xsl:param name="classname"/>
211 <xsl:param name="extends"/>
212 <xsl:param name="addinterfaces"/>
213 <xsl:param name="depth"/>
214 <xsl:param name="interfacelist"/>
215
216 <xsl:choose>
217 <xsl:when test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
218 <xsl:variable name="newextends" select="//interface[@name=$extends]/@extends"/>
219 <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $extends)"/>
220 <xsl:call-template name="emitISupports">
221 <xsl:with-param name="classname" select="$classname"/>
222 <xsl:with-param name="extends" select="$newextends"/>
223 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
224 <xsl:with-param name="depth" select="$depth + 1"/>
225 <xsl:with-param name="interfacelist" select="$newiflist"/>
226 </xsl:call-template>
227 </xsl:when>
228 <xsl:otherwise>
229 <xsl:variable name="addinterfaces_ns" select="exsl:node-set($addinterfaces)"/>
230 <xsl:choose>
231 <xsl:when test="count($addinterfaces_ns/token) > 0">
232 <xsl:variable name="addifname" select="$addinterfaces_ns/token[1]"/>
233 <xsl:variable name="addif" select="//interface[@name=$addifname]/@extends"/>
234 <xsl:variable name="newextends" select="$addif/@extends"/>
235 <xsl:variable name="newaddinterfaces" select="$addinterfaces_ns/token[position() > 1]"/>
236 <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $addifname)"/>
237 <xsl:call-template name="emitISupports">
238 <xsl:with-param name="classname" select="$classname"/>
239 <xsl:with-param name="extends" select="$newextends"/>
240 <xsl:with-param name="addinterfaces" select="$newaddinterfaces"/>
241 <xsl:with-param name="depth" select="$depth + 1"/>
242 <xsl:with-param name="interfacelist" select="$newiflist"/>
243 </xsl:call-template>
244 </xsl:when>
245 <xsl:otherwise>
246 <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS', $depth, '_CI(', $classname, ', ', $interfacelist, ')', $G_sNewLine)"/>
247 </xsl:otherwise>
248 </xsl:choose>
249 </xsl:otherwise>
250 </xsl:choose>
251</xsl:template>
252
253<xsl:template match="interface" mode="codefooter">
254 <xsl:param name="addinterfaces"/>
255 <xsl:text>#ifdef VBOX_WITH_XPCOM
256</xsl:text>
257 <xsl:value-of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
258
259 <xsl:variable name="manualAddInterfaces">
260 <xsl:call-template name="checkoption">
261 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
262 <xsl:with-param name="option" select="'manualaddinterfaces'"/>
263 </xsl:call-template>
264 </xsl:variable>
265 <xsl:choose>
266 <xsl:when test="$manualAddInterfaces = 'true'">
267 <xsl:variable name="nulladdinterfaces"></xsl:variable>
268 <xsl:call-template name="emitISupports">
269 <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
270 <xsl:with-param name="extends" select="@extends"/>
271 <xsl:with-param name="addinterfaces" select="$nulladdinterfaces"/>
272 <xsl:with-param name="depth" select="1"/>
273 <xsl:with-param name="interfacelist" select="@name"/>
274 </xsl:call-template>
275 </xsl:when>
276 <xsl:otherwise>
277 <xsl:call-template name="emitISupports">
278 <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
279 <xsl:with-param name="extends" select="@extends"/>
280 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
281 <xsl:with-param name="depth" select="1"/>
282 <xsl:with-param name="interfacelist" select="@name"/>
283 </xsl:call-template>
284 </xsl:otherwise>
285 </xsl:choose>
286 <xsl:text>#endif // VBOX_WITH_XPCOM
287</xsl:text>
288</xsl:template>
289
290
291<!-- - - - - - - - - - - - - - - - - - - - - - -
292 templates for dealing with names and parameters
293 - - - - - - - - - - - - - - - - - - - - - - -->
294
295<xsl:template name="tospace">
296 <xsl:param name="str"/>
297 <xsl:value-of select="translate($str, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_', ' ')"/>
298</xsl:template>
299
300<xsl:template name="checkoption">
301 <xsl:param name="optionlist"/>
302 <xsl:param name="option"/>
303 <xsl:value-of select="string-length($option) > 0 and contains(concat(',', translate($optionlist, ' ', ''), ','), concat(',', $option, ','))"/>
304</xsl:template>
305
306<xsl:template name="getattrlist">
307 <xsl:param name="val"/>
308 <xsl:param name="separator" select="','"/>
309
310 <xsl:if test="$val and $val != ''">
311 <xsl:choose>
312 <xsl:when test="contains($val,$separator)">
313 <token>
314 <xsl:value-of select="substring-before($val,$separator)"/>
315 </token>
316 <xsl:call-template name="getattrlist">
317 <xsl:with-param name="val" select="substring-after($val,$separator)"/>
318 <xsl:with-param name="separator" select="$separator"/>
319 </xsl:call-template>
320 </xsl:when>
321 <xsl:otherwise>
322 <token><xsl:value-of select="$val"/></token>
323 </xsl:otherwise>
324 </xsl:choose>
325 </xsl:if>
326</xsl:template>
327
328<xsl:template name="translatepublictype">
329 <xsl:param name="type"/>
330 <xsl:param name="dir"/>
331 <xsl:param name="mod"/>
332
333 <!-- get C++ glue type from IDL type from table in typemap-shared.inc.xsl -->
334 <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
335 <xsl:choose>
336 <xsl:when test="$type='wstring' or $type='uuid'">
337 <xsl:choose>
338 <xsl:when test="$dir='in'">
339 <xsl:text>IN_BSTR</xsl:text>
340 </xsl:when>
341 <xsl:otherwise>
342 <xsl:text>BSTR</xsl:text>
343 </xsl:otherwise>
344 </xsl:choose>
345 </xsl:when>
346 <xsl:when test="string-length($gluetypefield)">
347 <xsl:value-of select="$gluetypefield"/>
348 </xsl:when>
349 <xsl:when test="//enum[@name=$type]">
350 <xsl:value-of select="concat($type, '_T')"/>
351 </xsl:when>
352 <xsl:when test="$type='$unknown'">
353 <xsl:text>IUnknown *</xsl:text>
354 </xsl:when>
355 <xsl:when test="//interface[@name=$type]">
356 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
357 <xsl:variable name="thatifname" select="$thatif/@name"/>
358 <xsl:value-of select="concat($thatifname, ' *')"/>
359 </xsl:when>
360 <xsl:otherwise>
361 <xsl:call-template name="fatalError">
362 <xsl:with-param name="msg" select="concat('translatepublictype: Type &quot;', $type, '&quot; is not supported.')"/>
363 </xsl:call-template>
364 </xsl:otherwise>
365 </xsl:choose>
366 <xsl:if test="$mod='ptr'">
367 <xsl:text> *</xsl:text>
368 </xsl:if>
369</xsl:template>
370
371<xsl:template name="translatewrappedtype">
372 <xsl:param name="type"/>
373 <xsl:param name="dir"/>
374 <xsl:param name="mod"/>
375 <xsl:param name="safearray"/>
376
377 <!-- get C++ wrap type from IDL type from table in typemap-shared.inc.xsl -->
378 <xsl:variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
379 <xsl:choose>
380 <xsl:when test="$type='wstring'">
381 <xsl:if test="$dir='in' and not($safearray='yes')">
382 <xsl:text>const </xsl:text>
383 </xsl:if>
384 <xsl:text>com::Utf8Str &amp;</xsl:text>
385 </xsl:when>
386 <xsl:when test="$type='uuid'">
387 <xsl:if test="$dir='in'">
388 <xsl:text>const </xsl:text>
389 </xsl:if>
390 <xsl:text>com::Guid &amp;</xsl:text>
391 </xsl:when>
392 <xsl:when test="string-length($wraptypefield)">
393 <xsl:value-of select="$wraptypefield"/>
394 </xsl:when>
395 <xsl:when test="//enum[@name=$type]">
396 <xsl:value-of select="concat($type, '_T')"/>
397 </xsl:when>
398 <xsl:when test="$type='$unknown'">
399 <xsl:if test="$dir='in' and not($safearray='yes')">
400 <xsl:text>const </xsl:text>
401 </xsl:if>
402 <xsl:text>ComPtr&lt;IUnknown&gt; &amp;</xsl:text>
403 </xsl:when>
404 <xsl:when test="//interface[@name=$type]">
405 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
406 <xsl:variable name="thatifname" select="$thatif/@name"/>
407 <xsl:if test="$dir='in' and not($safearray='yes')">
408 <xsl:text>const </xsl:text>
409 </xsl:if>
410 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt; &amp;')"/>
411 </xsl:when>
412 <xsl:otherwise>
413 <xsl:call-template name="fatalError">
414 <xsl:with-param name="msg" select="concat('translatewrappedtype: Type &quot;', $type, '&quot; is not supported.')"/>
415 </xsl:call-template>
416 </xsl:otherwise>
417 </xsl:choose>
418 <xsl:if test="$mod='ptr'">
419 <xsl:text> *</xsl:text>
420 </xsl:if>
421</xsl:template>
422
423<xsl:template name="translatefmtspectype">
424 <xsl:param name="type"/>
425 <xsl:param name="dir"/>
426 <xsl:param name="mod"/>
427 <xsl:param name="safearray"/>
428 <xsl:param name="isref"/>
429
430 <!-- get C format string for IDL type from table in typemap-shared.inc.xsl -->
431 <xsl:variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
432 <xsl:choose>
433 <xsl:when test="$mod='ptr' or ($isref='yes' and $dir!='in')">
434 <xsl:text>%p</xsl:text>
435 </xsl:when>
436 <xsl:when test="$safearray='yes'">
437 <xsl:text>%zu</xsl:text>
438 </xsl:when>
439 <xsl:when test="string-length($wrapfmt)">
440 <xsl:value-of select="$wrapfmt"/>
441 </xsl:when>
442 <xsl:when test="//enum[@name=$type]">
443 <xsl:text>%RU32</xsl:text>
444 </xsl:when>
445 <xsl:when test="$type='$unknown'">
446 <xsl:text>%p</xsl:text>
447 </xsl:when>
448 <xsl:when test="//interface[@name=$type]">
449 <xsl:text>%p</xsl:text>
450 </xsl:when>
451 <xsl:otherwise>
452 <xsl:call-template name="fatalError">
453 <xsl:with-param name="msg" select="concat('translatefmtcpectype: Type &quot;', $type, '&quot; is not supported.')"/>
454 </xsl:call-template>
455 </xsl:otherwise>
456 </xsl:choose>
457</xsl:template>
458
459<xsl:template name="translatedtracetype">
460 <xsl:param name="type"/>
461 <xsl:param name="dir"/>
462 <xsl:param name="mod"/>
463
464 <!-- get dtrace probe type from IDL type from table in typemap-shared.inc.xsl -->
465 <xsl:variable name="dtracetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@dtracename"/>
466 <xsl:choose>
467 <xsl:when test="string-length($dtracetypefield)">
468 <xsl:value-of select="$dtracetypefield"/>
469 </xsl:when>
470 <xsl:when test="//enum[@name=$type]">
471 <!-- <xsl:value-of select="concat($type, '_T')"/> - later we can emit enums into dtrace the library -->
472 <xsl:text>int</xsl:text>
473 </xsl:when>
474 <xsl:when test="$type='$unknown'">
475 <!-- <xsl:text>struct IUnknown *</xsl:text> -->
476 <xsl:text>void *</xsl:text>
477 </xsl:when>
478 <xsl:when test="//interface[@name=$type]">
479 <!--
480 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
481 <xsl:variable name="thatifname" select="$thatif/@name"/>
482 <xsl:value-of select="concat('struct ', $thatifname, ' *')"/>
483 -->
484 <xsl:text>void *</xsl:text>
485 </xsl:when>
486 <xsl:otherwise>
487 <xsl:call-template name="fatalError">
488 <xsl:with-param name="msg" select="concat('translatedtracetype Type &quot;', $type, '&quot; is not supported.')"/>
489 </xsl:call-template>
490 </xsl:otherwise>
491 </xsl:choose>
492 <xsl:if test="$mod='ptr'">
493 <xsl:text> *</xsl:text>
494 </xsl:if>
495</xsl:template>
496
497
498<!-- - - - - - - - - - - - - - - - - - - - - - -
499 templates for handling entire interfaces and their contents
500 - - - - - - - - - - - - - - - - - - - - - - -->
501
502<xsl:template name="emitInterface">
503 <xsl:param name="iface"/>
504
505 <xsl:variable name="addinterfaces">
506 <xsl:call-template name="getattrlist">
507 <xsl:with-param name="val" select="$iface/@wrap-hint-server-addinterfaces"/>
508 </xsl:call-template>
509 </xsl:variable>
510
511 <xsl:call-template name="emitHeader">
512 <xsl:with-param name="iface" select="$iface"/>
513 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
514 </xsl:call-template>
515
516 <xsl:call-template name="emitCode">
517 <xsl:with-param name="iface" select="$iface"/>
518 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
519 </xsl:call-template>
520</xsl:template>
521
522<xsl:template match="attribute/@type | param/@type" mode="public">
523 <xsl:param name="dir"/>
524
525 <xsl:variable name="gluetype">
526 <xsl:call-template name="translatepublictype">
527 <xsl:with-param name="type" select="."/>
528 <xsl:with-param name="dir" select="$dir"/>
529 <xsl:with-param name="mod" select="../@mod"/>
530 </xsl:call-template>
531 </xsl:variable>
532
533 <xsl:if test="../@safearray='yes'">
534 <xsl:choose>
535 <xsl:when test="$dir='in'">
536 <xsl:text>ComSafeArrayIn(</xsl:text>
537 </xsl:when>
538 <xsl:otherwise>
539 <xsl:text>ComSafeArrayOut(</xsl:text>
540 </xsl:otherwise>
541 </xsl:choose>
542 </xsl:if>
543 <xsl:value-of select="$gluetype"/>
544 <xsl:choose>
545 <xsl:when test="../@safearray='yes'">
546 <xsl:text>, </xsl:text>
547 </xsl:when>
548 <xsl:otherwise>
549 <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
550 <xsl:text> </xsl:text>
551 </xsl:if>
552 <xsl:choose>
553 <xsl:when test="$dir='in'">
554 </xsl:when>
555 <xsl:otherwise>
556 <xsl:value-of select="'*'"/>
557 </xsl:otherwise>
558 </xsl:choose>
559 </xsl:otherwise>
560 </xsl:choose>
561 <xsl:text>a</xsl:text>
562 <xsl:call-template name="capitalize">
563 <xsl:with-param name="str" select="../@name"/>
564 </xsl:call-template>
565 <xsl:if test="../@safearray='yes'">
566 <xsl:value-of select="')'"/>
567 </xsl:if>
568</xsl:template>
569
570<xsl:template match="attribute/@type | param/@type" mode="wrapped">
571 <xsl:param name="dir"/>
572
573 <xsl:variable name="wraptype">
574 <xsl:call-template name="translatewrappedtype">
575 <xsl:with-param name="type" select="."/>
576 <xsl:with-param name="dir" select="$dir"/>
577 <xsl:with-param name="mod" select="../@mod"/>
578 <xsl:with-param name="safearray" select="../@safearray"/>
579 </xsl:call-template>
580 </xsl:variable>
581
582 <xsl:choose>
583 <xsl:when test="../@safearray='yes'">
584 <xsl:if test="$dir='in'">
585 <xsl:text>const </xsl:text>
586 </xsl:if>
587 <xsl:text>std::vector&lt;</xsl:text>
588 <xsl:choose>
589 <xsl:when test="substring($wraptype,string-length($wraptype))='&amp;'">
590 <xsl:variable name="wraptype2">
591 <xsl:value-of select="substring($wraptype,1,string-length($wraptype)-2)"/>
592 </xsl:variable>
593
594 <xsl:choose>
595 <xsl:when test="substring($wraptype2,string-length($wraptype2))='&gt;'">
596 <xsl:value-of select="concat($wraptype2, ' ')"/>
597 </xsl:when>
598 <xsl:otherwise>
599 <xsl:value-of select="$wraptype2"/>
600 </xsl:otherwise>
601 </xsl:choose>
602 </xsl:when>
603 <xsl:when test="substring($wraptype,string-length($wraptype))='&gt;'">
604 <xsl:value-of select="concat($wraptype, ' ')"/>
605 </xsl:when>
606 <xsl:otherwise>
607 <xsl:value-of select="$wraptype"/>
608 </xsl:otherwise>
609 </xsl:choose>
610 <xsl:text>&gt; &amp;</xsl:text>
611 </xsl:when>
612 <xsl:otherwise>
613 <xsl:value-of select="$wraptype"/>
614 <xsl:if test="substring($wraptype,string-length($wraptype))!='&amp;'">
615 <xsl:if test="substring($wraptype,string-length($wraptype))!='*'">
616 <xsl:text> </xsl:text>
617 </xsl:if>
618 <xsl:choose>
619 <xsl:when test="$dir='in'">
620 </xsl:when>
621 <xsl:otherwise>
622 <xsl:value-of select="'*'"/>
623 </xsl:otherwise>
624 </xsl:choose>
625 </xsl:if>
626 </xsl:otherwise>
627 </xsl:choose>
628 <xsl:text>a</xsl:text>
629 <xsl:call-template name="capitalize">
630 <xsl:with-param name="str" select="../@name"/>
631 </xsl:call-template>
632</xsl:template>
633
634<xsl:template match="attribute/@type | param/@type" mode="logparamtext">
635 <xsl:param name="dir"/>
636 <xsl:param name="isref"/>
637
638 <xsl:if test="$isref!='yes' and ($dir='out' or $dir='ret')">
639 <xsl:text>*</xsl:text>
640 </xsl:if>
641 <xsl:text>a</xsl:text>
642 <xsl:call-template name="capitalize">
643 <xsl:with-param name="str" select="../@name"/>
644 </xsl:call-template>
645 <xsl:text>=</xsl:text>
646 <xsl:call-template name="translatefmtspectype">
647 <xsl:with-param name="type" select="."/>
648 <xsl:with-param name="dir" select="$dir"/>
649 <xsl:with-param name="mod" select="../@mod"/>
650 <xsl:with-param name="safearray" select="../@safearray"/>
651 <xsl:with-param name="isref" select="$isref"/>
652 </xsl:call-template>
653</xsl:template>
654
655<xsl:template match="attribute/@type | param/@type" mode="logparamval">
656 <xsl:param name="dir"/>
657 <xsl:param name="isref"/>
658
659 <xsl:choose>
660 <xsl:when test="../@safearray='yes' and $isref!='yes'">
661 <xsl:text>ComSafeArraySize(</xsl:text>
662 <xsl:if test="$isref!='yes' and $dir!='in'">
663 <xsl:text>*</xsl:text>
664 </xsl:if>
665 </xsl:when>
666 <xsl:when test="$isref!='yes' and $dir!='in'">
667 <xsl:text>*</xsl:text>
668 </xsl:when>
669 </xsl:choose>
670 <xsl:text>a</xsl:text>
671 <xsl:call-template name="capitalize">
672 <xsl:with-param name="str" select="../@name"/>
673 </xsl:call-template>
674 <xsl:choose>
675 <xsl:when test="../@safearray='yes' and $isref!='yes'">
676 <xsl:text>)</xsl:text>
677 </xsl:when>
678 </xsl:choose>
679</xsl:template>
680
681<xsl:template match="attribute/@type | param/@type" mode="dtraceparamval">
682 <xsl:param name="dir"/>
683
684 <xsl:variable name="viatmpvar">
685 <xsl:call-template name="paramconversionviatmp">
686 <xsl:with-param name="dir" select="$dir"/>
687 </xsl:call-template>
688 </xsl:variable>
689
690 <xsl:variable name="type" select="."/>
691 <xsl:choose>
692 <xsl:when test="$viatmpvar = 'yes'">
693 <xsl:variable name="tmpname">
694 <xsl:text>Tmp</xsl:text>
695 <xsl:call-template name="capitalize">
696 <xsl:with-param name="str" select="../@name"/>
697 </xsl:call-template>
698 </xsl:variable>
699
700 <xsl:choose>
701 <xsl:when test="../@safearray = 'yes'">
702 <xsl:text>(uint32_t)</xsl:text>
703 <xsl:value-of select="$tmpname"/>
704 <xsl:text>.array().size(), </xsl:text>
705 <!-- Later:
706 <xsl:value-of select="concat($tmpname, '.array().data(), ')"/>
707 -->
708 <xsl:text>NULL /*for now*/</xsl:text>
709 </xsl:when>
710 <xsl:when test="$type = 'wstring'">
711 <xsl:value-of select="$tmpname"/>
712 <xsl:text>.str().c_str()</xsl:text>
713 </xsl:when>
714 <xsl:when test="$type = 'uuid'">
715 <xsl:value-of select="$tmpname"/>
716 <xsl:text>.uuid().toStringCurly().c_str()</xsl:text>
717 </xsl:when>
718 <xsl:when test="$type = '$unknown'">
719 <xsl:text>(void *)</xsl:text>
720 <xsl:value-of select="$tmpname"/>
721 <xsl:text>.ptr()</xsl:text>
722 </xsl:when>
723 <xsl:otherwise>
724 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
725 <xsl:choose>
726 <xsl:when test="$thatif">
727 <xsl:text>(void *)</xsl:text>
728 <xsl:value-of select="$tmpname"/>
729 <xsl:text>.ptr()</xsl:text>
730 </xsl:when>
731 <xsl:otherwise>
732 <xsl:value-of select="$tmpname"/>
733 </xsl:otherwise>
734 </xsl:choose>
735 </xsl:otherwise>
736 </xsl:choose>
737 </xsl:when>
738
739 <xsl:otherwise>
740 <xsl:if test="$dir != 'in'">
741 <xsl:text>*</xsl:text>
742 </xsl:if>
743 <xsl:text>a</xsl:text>
744 <xsl:call-template name="capitalize">
745 <xsl:with-param name="str" select="../@name"/>
746 </xsl:call-template>
747
748 <xsl:if test="$type = 'boolean'">
749 <xsl:text> != FALSE</xsl:text>
750 </xsl:if>
751 </xsl:otherwise>
752 </xsl:choose>
753</xsl:template>
754
755<!-- Same as dtraceparamval except no temporary variables are used (they are out of scope). -->
756<xsl:template match="attribute/@type | param/@type" mode="dtraceparamvalnotmp">
757 <xsl:param name="dir"/>
758
759 <xsl:variable name="viatmpvar">
760 <xsl:call-template name="paramconversionviatmp">
761 <xsl:with-param name="dir" select="$dir"/>
762 </xsl:call-template>
763 </xsl:variable>
764
765 <xsl:variable name="type" select="."/>
766 <xsl:choose>
767 <xsl:when test="$viatmpvar = 'yes'">
768 <xsl:if test="../@safearray = 'yes'">
769 <xsl:text>0, </xsl:text>
770 </xsl:if>
771 <xsl:text>0</xsl:text>
772 </xsl:when>
773
774 <xsl:otherwise>
775 <xsl:if test="$dir != 'in'">
776 <xsl:text>*</xsl:text>
777 </xsl:if>
778 <xsl:text>a</xsl:text>
779 <xsl:call-template name="capitalize">
780 <xsl:with-param name="str" select="../@name"/>
781 </xsl:call-template>
782
783 <xsl:if test="$type = 'boolean'">
784 <xsl:text> != FALSE</xsl:text>
785 </xsl:if>
786 </xsl:otherwise>
787 </xsl:choose>
788</xsl:template>
789
790<xsl:template match="attribute/@type | param/@type" mode="dtraceparamdecl">
791 <xsl:param name="dir"/>
792
793 <xsl:variable name="gluetype">
794 <xsl:call-template name="translatedtracetype">
795 <xsl:with-param name="type" select="."/>
796 <xsl:with-param name="dir" select="$dir"/>
797 <xsl:with-param name="mod" select="../@mod"/>
798 </xsl:call-template>
799 </xsl:variable>
800
801 <!-- Safe arrays get an extra size parameter. -->
802 <xsl:if test="../@safearray='yes'">
803 <xsl:text>uint32_t a_c</xsl:text>
804 <xsl:call-template name="capitalize">
805 <xsl:with-param name="str" select="../@name"/>
806 </xsl:call-template>
807 <xsl:text>, </xsl:text>
808 </xsl:if>
809
810 <xsl:value-of select="$gluetype"/>
811 <xsl:choose>
812 <xsl:when test="../@safearray='yes'">
813 <xsl:text> *a_pa</xsl:text>
814 </xsl:when>
815 <xsl:otherwise>
816 <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
817 <xsl:text> </xsl:text>
818 </xsl:if>
819 <xsl:text>a_</xsl:text>
820 </xsl:otherwise>
821 </xsl:choose>
822
823 <xsl:call-template name="capitalize">
824 <xsl:with-param name="str" select="../@name"/>
825 </xsl:call-template>
826</xsl:template>
827
828<!-- Call this to determine whether a temporary conversion variable is used for the current parameter.
829Returns empty if not needed, non-empty ('yes') if needed. -->
830<xsl:template name="paramconversionviatmp">
831 <xsl:param name="dir"/>
832 <xsl:variable name="type" select="."/>
833 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
834 <xsl:if test="$thatif or $type = 'wstring' or $type = '$unknown' or $type = 'uuid' or ../@safearray = 'yes'">
835 <xsl:text>yes</xsl:text>
836 </xsl:if>
837</xsl:template>
838
839<!-- Call this to get the argument conversion class, if any is needed. -->
840<xsl:template name="paramconversionclass">
841 <xsl:param name="dir"/>
842
843 <xsl:variable name="gluetype">
844 <xsl:call-template name="translatepublictype">
845 <xsl:with-param name="type" select="."/>
846 <xsl:with-param name="dir" select="$dir"/>
847 <xsl:with-param name="mod" select="../@mod"/>
848 </xsl:call-template>
849 </xsl:variable>
850 <xsl:variable name="type" select="."/>
851 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
852
853 <xsl:choose>
854 <xsl:when test="$type='$unknown'">
855 <xsl:if test="../@safearray='yes'">
856 <xsl:text>Array</xsl:text>
857 </xsl:if>
858 <xsl:choose>
859 <xsl:when test="$dir='in'">
860 <xsl:text>ComTypeInConverter&lt;IUnknown&gt;</xsl:text>
861 </xsl:when>
862 <xsl:otherwise>
863 <xsl:text>ComTypeOutConverter&lt;IUnknown&gt;</xsl:text>
864 </xsl:otherwise>
865 </xsl:choose>
866 </xsl:when>
867
868 <xsl:when test="$thatif">
869 <xsl:if test="../@safearray='yes'">
870 <xsl:text>Array</xsl:text>
871 </xsl:if>
872 <xsl:choose>
873 <xsl:when test="$dir='in'">
874 <xsl:text>ComTypeInConverter</xsl:text>
875 </xsl:when>
876 <xsl:otherwise>
877 <xsl:text>ComTypeOutConverter</xsl:text>
878 </xsl:otherwise>
879 </xsl:choose>
880 <xsl:variable name="thatifname" select="$thatif/@name"/>
881 <xsl:value-of select="concat('&lt;', $thatifname, '&gt;')"/>
882 </xsl:when>
883
884 <xsl:when test="$type='wstring'">
885 <xsl:if test="../@safearray='yes'">
886 <xsl:text>Array</xsl:text>
887 </xsl:if>
888 <xsl:choose>
889 <xsl:when test="$dir='in'">
890 <xsl:text>BSTRInConverter</xsl:text>
891 </xsl:when>
892 <xsl:otherwise>
893 <xsl:text>BSTROutConverter</xsl:text>
894 </xsl:otherwise>
895 </xsl:choose>
896 </xsl:when>
897
898 <xsl:when test="$type='uuid'">
899 <xsl:if test="../@safearray='yes'">
900 <xsl:text>Array</xsl:text>
901 </xsl:if>
902 <xsl:choose>
903 <xsl:when test="$dir='in'">
904 <xsl:text>UuidInConverter</xsl:text>
905 </xsl:when>
906 <xsl:otherwise>
907 <xsl:text>UuidOutConverter</xsl:text>
908 </xsl:otherwise>
909 </xsl:choose>
910 </xsl:when>
911
912 <xsl:when test="../@safearray='yes'">
913 <xsl:text>Array</xsl:text>
914 <xsl:choose>
915 <xsl:when test="$dir='in'">
916 <xsl:text>InConverter</xsl:text>
917 </xsl:when>
918 <xsl:otherwise>
919 <xsl:text>OutConverter</xsl:text>
920 </xsl:otherwise>
921 </xsl:choose>
922 <xsl:value-of select="concat('&lt;', $gluetype, '&gt;')"/>
923 </xsl:when>
924 </xsl:choose>
925</xsl:template>
926
927<!-- Emits code for converting the parameter to a temporary variable. -->
928<xsl:template match="attribute/@type | param/@type" mode="paramvalconversion2tmpvar">
929 <xsl:param name="dir"/>
930
931 <xsl:variable name="conversionclass">
932 <xsl:call-template name="paramconversionclass">
933 <xsl:with-param name="dir" select="$dir"/>
934 </xsl:call-template>
935 </xsl:variable>
936
937 <xsl:if test="$conversionclass != ''">
938 <xsl:value-of select="$conversionclass"/>
939 <xsl:text> Tmp</xsl:text>
940 <xsl:call-template name="capitalize">
941 <xsl:with-param name="str" select="../@name"/>
942 </xsl:call-template>
943 <xsl:text>(</xsl:text>
944 <xsl:if test="../@safearray = 'yes'">
945 <xsl:choose>
946 <xsl:when test="$dir = 'in'">
947 <xsl:text>ComSafeArrayInArg(</xsl:text>
948 </xsl:when>
949 <xsl:otherwise>
950 <xsl:text>ComSafeArrayOutArg(</xsl:text>
951 </xsl:otherwise>
952 </xsl:choose>
953 </xsl:if>
954 <xsl:text>a</xsl:text>
955 <xsl:call-template name="capitalize">
956 <xsl:with-param name="str" select="../@name"/>
957 </xsl:call-template>
958 <xsl:if test="../@safearray = 'yes'">
959 <xsl:text>)</xsl:text>
960 </xsl:if>
961 <xsl:text>);</xsl:text>
962 </xsl:if>
963
964</xsl:template>
965
966<!-- Partner to paramvalconversion2tmpvar that emits the parameter when calling call the internal worker method. -->
967<xsl:template match="attribute/@type | param/@type" mode="paramvalconversionusingtmp">
968 <xsl:param name="dir"/>
969
970 <xsl:variable name="viatmpvar">
971 <xsl:call-template name="paramconversionviatmp">
972 <xsl:with-param name="dir" select="$dir"/>
973 </xsl:call-template>
974 </xsl:variable>
975 <xsl:variable name="type" select="."/>
976
977 <xsl:choose>
978 <xsl:when test="$viatmpvar = 'yes'">
979 <xsl:text>Tmp</xsl:text>
980 <xsl:call-template name="capitalize">
981 <xsl:with-param name="str" select="../@name"/>
982 </xsl:call-template>
983
984 <xsl:choose>
985 <xsl:when test="../@safearray='yes'">
986 <xsl:text>.array()</xsl:text>
987 </xsl:when>
988 <xsl:when test="$type = 'wstring'">
989 <xsl:text>.str()</xsl:text>
990 </xsl:when>
991 <xsl:when test="$type = 'uuid'">
992 <xsl:text>.uuid()</xsl:text>
993 </xsl:when>
994 <xsl:when test="$type = '$unknown'">
995 <xsl:text>.ptr()</xsl:text>
996 </xsl:when>
997 <xsl:otherwise>
998 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
999 <xsl:if test="$thatif">
1000 <xsl:text>.ptr()</xsl:text>
1001 </xsl:if>
1002 </xsl:otherwise>
1003 </xsl:choose>
1004 </xsl:when>
1005
1006 <xsl:otherwise>
1007 <xsl:text>a</xsl:text>
1008 <xsl:call-template name="capitalize">
1009 <xsl:with-param name="str" select="../@name"/>
1010 </xsl:call-template>
1011
1012 <!-- Make sure BOOL values we pass down are either TRUE or FALSE. -->
1013 <xsl:if test="$type = 'boolean' and $dir = 'in'">
1014 <xsl:text> != FALSE</xsl:text>
1015 </xsl:if>
1016 </xsl:otherwise>
1017 </xsl:choose>
1018
1019</xsl:template>
1020
1021<!-- - - - - - - - - - - - - - - - - - - - - - -
1022 emit attribute
1023 - - - - - - - - - - - - - - - - - - - - - - -->
1024
1025<xsl:template match="attribute" mode="public">
1026 <xsl:param name="target"/>
1027
1028 <xsl:call-template name="emitTargetBegin">
1029 <xsl:with-param name="target" select="$target"/>
1030 </xsl:call-template>
1031
1032 <xsl:variable name="attrbasename">
1033 <xsl:call-template name="capitalize">
1034 <xsl:with-param name="str" select="@name"/>
1035 </xsl:call-template>
1036 </xsl:variable>
1037
1038 <xsl:value-of select="concat(' STDMETHOD(COMGETTER(', $attrbasename, '))(')"/>
1039 <xsl:apply-templates select="@type" mode="public">
1040 <xsl:with-param name="dir" select="'out'"/>
1041 </xsl:apply-templates>
1042 <xsl:text>);
1043</xsl:text>
1044
1045 <xsl:if test="not(@readonly) or @readonly!='yes'">
1046 <xsl:value-of select="concat(' STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
1047 <xsl:apply-templates select="@type" mode="public">
1048 <xsl:with-param name="dir" select="'in'"/>
1049 </xsl:apply-templates>
1050 <xsl:text>);
1051</xsl:text>
1052 </xsl:if>
1053
1054 <xsl:call-template name="emitTargetEnd">
1055 <xsl:with-param name="target" select="$target"/>
1056 </xsl:call-template>
1057</xsl:template>
1058
1059<xsl:template match="attribute" mode="wrapped">
1060 <xsl:param name="target"/>
1061
1062 <xsl:call-template name="emitTargetBegin">
1063 <xsl:with-param name="target" select="$target"/>
1064 </xsl:call-template>
1065
1066 <xsl:variable name="attrbasename">
1067 <xsl:call-template name="capitalize">
1068 <xsl:with-param name="str" select="@name"/>
1069 </xsl:call-template>
1070 </xsl:variable>
1071
1072 <xsl:value-of select="concat(' virtual HRESULT get', $attrbasename, '(')"/>
1073 <xsl:variable name="passAutoCaller">
1074 <xsl:call-template name="checkoption">
1075 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1076 <xsl:with-param name="option" select="'passcaller'"/>
1077 </xsl:call-template>
1078 </xsl:variable>
1079 <xsl:if test="$passAutoCaller = 'true'">
1080 <xsl:text>AutoCaller &amp;aAutoCaller, </xsl:text>
1081 </xsl:if>
1082 <xsl:apply-templates select="@type" mode="wrapped">
1083 <xsl:with-param name="dir" select="'out'"/>
1084 </xsl:apply-templates>
1085 <xsl:text>) = 0;
1086</xsl:text>
1087
1088 <xsl:if test="not(@readonly) or @readonly!='yes'">
1089 <xsl:value-of select="concat(' virtual HRESULT set', $attrbasename, '(')"/>
1090 <xsl:if test="$passAutoCaller = 'true'">
1091 <xsl:text>AutoCaller &amp;aAutoCaller, </xsl:text>
1092 </xsl:if>
1093 <xsl:apply-templates select="@type" mode="wrapped">
1094 <xsl:with-param name="dir" select="'in'"/>
1095 </xsl:apply-templates>
1096 <xsl:text>) = 0;
1097</xsl:text>
1098 </xsl:if>
1099
1100 <xsl:call-template name="emitTargetEnd">
1101 <xsl:with-param name="target" select="$target"/>
1102 </xsl:call-template>
1103</xsl:template>
1104
1105<xsl:template match="attribute" mode="code">
1106 <xsl:param name="topclass"/>
1107 <xsl:param name="dtracetopclass"/>
1108 <xsl:param name="target"/>
1109
1110 <xsl:call-template name="emitTargetBegin">
1111 <xsl:with-param name="target" select="$target"/>
1112 </xsl:call-template>
1113
1114 <xsl:variable name="attrbasename">
1115 <xsl:call-template name="capitalize">
1116 <xsl:with-param name="str" select="@name"/>
1117 </xsl:call-template>
1118 </xsl:variable>
1119 <xsl:variable name="limitedAutoCaller">
1120 <xsl:call-template name="checkoption">
1121 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1122 <xsl:with-param name="option" select="'limitedcaller'"/>
1123 </xsl:call-template>
1124 </xsl:variable>
1125
1126 <xsl:variable name="dtraceattrname">
1127 <xsl:choose>
1128 <xsl:when test="@dtracename">
1129 <xsl:value-of select="@dtracename"/>
1130 </xsl:when>
1131 <xsl:otherwise>
1132 <xsl:value-of select="$attrbasename"/>
1133 </xsl:otherwise>
1134 </xsl:choose>
1135 </xsl:variable>
1136
1137 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(', $attrbasename, ')(')"/>
1138 <xsl:apply-templates select="@type" mode="public">
1139 <xsl:with-param name="dir" select="'out'"/>
1140 </xsl:apply-templates>
1141 <xsl:text>)
1142{
1143 LogRelFlow(("{%p} %s: enter </xsl:text>
1144 <xsl:apply-templates select="@type" mode="logparamtext">
1145 <xsl:with-param name="dir" select="'out'"/>
1146 <xsl:with-param name="isref" select="'yes'"/>
1147 </xsl:apply-templates>
1148 <xsl:text>\n", this, </xsl:text>
1149 <xsl:value-of select="concat('&quot;', $topclass, '::get', $attrbasename, '&quot;, ')"/>
1150 <xsl:apply-templates select="@type" mode="logparamval">
1151 <xsl:with-param name="dir" select="'out'"/>
1152 <xsl:with-param name="isref" select="'yes'"/>
1153 </xsl:apply-templates>
1154 <xsl:text>));
1155
1156 VirtualBoxBase::clearError();
1157
1158 HRESULT hrc;
1159
1160 try
1161 {
1162 CheckComArgOutPointerValidThrow(a</xsl:text>
1163 <xsl:value-of select="$attrbasename"/>
1164 <xsl:text>);
1165 </xsl:text>
1166 <xsl:apply-templates select="@type" mode="paramvalconversion2tmpvar">
1167 <xsl:with-param name="dir" select="'out'"/>
1168 </xsl:apply-templates>
1169 <xsl:if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
1170 <xsl:text>
1171#ifdef VBOX_WITH_DTRACE_R3_MAIN
1172 /* dtrace probe </xsl:text>
1173 <!-- <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__enter(struct ', $topclass)"/> -->
1174 <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__enter(void')"/>
1175 <xsl:text> *a_pThis); */
1176 </xsl:text>
1177 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_ENTER('), $G_lowerCase, $G_upperCase)"/>
1178 <xsl:text>this);
1179#endif</xsl:text>
1180 </xsl:if>
1181 <xsl:text>
1182
1183 </xsl:text>
1184 <xsl:choose>
1185 <xsl:when test="$limitedAutoCaller = 'true'">
1186 <xsl:text>AutoLimitedCaller</xsl:text>
1187 </xsl:when>
1188 <xsl:otherwise>
1189 <xsl:text>AutoCaller</xsl:text>
1190 </xsl:otherwise>
1191 </xsl:choose>
1192 <xsl:text> autoCaller(this);
1193 if (FAILED(autoCaller.rc()))
1194 throw autoCaller.rc();
1195
1196</xsl:text>
1197 <xsl:value-of select="concat(' hrc = get', $attrbasename, '(')"/>
1198 <xsl:variable name="passAutoCaller">
1199 <xsl:call-template name="checkoption">
1200 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1201 <xsl:with-param name="option" select="'passcaller'"/>
1202 </xsl:call-template>
1203 </xsl:variable>
1204 <xsl:if test="$passAutoCaller = 'true'">
1205 <xsl:text>autoCaller, </xsl:text>
1206 </xsl:if>
1207 <xsl:apply-templates select="@type" mode="paramvalconversionusingtmp">
1208 <xsl:with-param name="dir" select="'out'"/>
1209 </xsl:apply-templates>
1210 <xsl:text>);
1211</xsl:text>
1212 <xsl:if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
1213 <xsl:text>
1214#ifdef VBOX_WITH_DTRACE_R3_MAIN
1215 /* dtrace probe </xsl:text>
1216 <!-- <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__return(struct ', $topclass, ' *a_pThis')"/> -->
1217 <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__return(void *a_pThis')"/>
1218 <xsl:text>, uint32_t a_hrc, int32_t enmWhy, </xsl:text>
1219 <xsl:apply-templates select="@type" mode="dtraceparamdecl">
1220 <xsl:with-param name="dir">out</xsl:with-param>
1221 </xsl:apply-templates>
1222 <xsl:text>); */
1223 </xsl:text>
1224 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1225 <xsl:text>this, hrc, 0 /*normal*/,</xsl:text>
1226 <xsl:apply-templates select="@type" mode="dtraceparamval">
1227 <xsl:with-param name="dir">out</xsl:with-param>
1228 </xsl:apply-templates>
1229 <xsl:text>);
1230#endif
1231</xsl:text>
1232 </xsl:if>
1233 <xsl:text>
1234 }
1235 catch (HRESULT hrc2)
1236 {
1237 hrc = hrc2;</xsl:text>
1238 <xsl:if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
1239 <xsl:text>
1240#ifdef VBOX_WITH_DTRACE_R3_MAIN
1241 </xsl:text>
1242 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1243 <xsl:text>this, hrc, 1 /*hrc exception*/,</xsl:text>
1244 <xsl:apply-templates select="@type" mode="dtraceparamvalnotmp">
1245 <xsl:with-param name="dir">out</xsl:with-param>
1246 </xsl:apply-templates>
1247 <xsl:text>);
1248#endif
1249</xsl:text>
1250 </xsl:if>
1251 <xsl:text>
1252 }
1253 catch (...)
1254 {
1255 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);</xsl:text>
1256 <xsl:if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
1257 <xsl:text>
1258#ifdef VBOX_WITH_DTRACE_R3_MAIN
1259 </xsl:text>
1260 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1261 <xsl:text>this, hrc, 9 /*unhandled exception*/,</xsl:text>
1262 <xsl:apply-templates select="@type" mode="dtraceparamvalnotmp">
1263 <xsl:with-param name="dir">out</xsl:with-param>
1264 </xsl:apply-templates>
1265 <xsl:text>);
1266#endif
1267</xsl:text>
1268 </xsl:if>
1269 <xsl:text>
1270 }
1271
1272 LogRelFlow(("{%p} %s: leave </xsl:text>
1273 <xsl:apply-templates select="@type" mode="logparamtext">
1274 <xsl:with-param name="dir" select="'out'"/>
1275 <xsl:with-param name="isref" select="''"/>
1276 </xsl:apply-templates>
1277 <xsl:text> hrc=%Rhrc\n", this, </xsl:text>
1278 <xsl:value-of select="concat('&quot;', $topclass, '::get', $dtraceattrname, '&quot;, ')"/>
1279 <xsl:apply-templates select="@type" mode="logparamval">
1280 <xsl:with-param name="dir" select="'out'"/>
1281 <xsl:with-param name="isref" select="''"/>
1282 </xsl:apply-templates>
1283 <xsl:text>, hrc));
1284 return hrc;
1285}
1286</xsl:text>
1287 <xsl:if test="not(@readonly) or @readonly!='yes'">
1288 <xsl:text>
1289</xsl:text>
1290 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
1291 <xsl:apply-templates select="@type" mode="public">
1292 <xsl:with-param name="dir" select="'in'"/>
1293 </xsl:apply-templates>
1294 <!-- @todo check in parameters if possible -->
1295 <xsl:text>)
1296{
1297 LogRelFlow(("{%p} %s: enter </xsl:text>
1298 <xsl:apply-templates select="@type" mode="logparamtext">
1299 <xsl:with-param name="dir" select="'in'"/>
1300 <xsl:with-param name="isref" select="''"/>
1301 </xsl:apply-templates>
1302 <xsl:text>\n", this, </xsl:text>
1303 <xsl:value-of select="concat('&quot;', $topclass, '::set', $attrbasename, '&quot;, ')"/>
1304 <xsl:apply-templates select="@type" mode="logparamval">
1305 <xsl:with-param name="dir" select="'in'"/>
1306 <xsl:with-param name="isref" select="''"/>
1307 </xsl:apply-templates>
1308 <xsl:text>));
1309
1310 VirtualBoxBase::clearError();
1311
1312 HRESULT hrc;
1313
1314 try
1315 {
1316 </xsl:text>
1317 <xsl:apply-templates select="@type" mode="paramvalconversion2tmpvar">
1318 <xsl:with-param name="dir" select="'in'"/>
1319 </xsl:apply-templates>
1320 <xsl:text>
1321
1322#ifdef VBOX_WITH_DTRACE_R3_MAIN
1323 /* dtrace probe </xsl:text>
1324 <!-- <xsl:value-of select="concat($topclass, '__set__', $dtraceattrname, '__enter(struct ', $topclass, ' *a_pThis, ')"/>-->
1325 <xsl:value-of select="concat($topclass, '__set__', $dtraceattrname, '__enter(void *a_pThis, ')"/>
1326 <xsl:apply-templates select="@type" mode="dtraceparamdecl">
1327 <xsl:with-param name="dir" select="'in'"/>
1328 </xsl:apply-templates>
1329 <xsl:text>); */
1330 </xsl:text>
1331 <xsl:value-of select="translate(concat('VBOXAPI_', $topclass, '_SET_', $dtraceattrname, '_ENTER('), $G_lowerCase, $G_upperCase)"/>
1332 <xsl:text>this, </xsl:text>
1333 <xsl:apply-templates select="@type" mode="dtraceparamval">
1334 <xsl:with-param name="dir">in</xsl:with-param>
1335 </xsl:apply-templates>
1336 <xsl:text>);
1337#endif
1338
1339 </xsl:text>
1340 <xsl:choose>
1341 <xsl:when test="$limitedAutoCaller = 'true'">
1342 <xsl:text>AutoLimitedCaller</xsl:text>
1343 </xsl:when>
1344 <xsl:otherwise>
1345 <xsl:text>AutoCaller</xsl:text>
1346 </xsl:otherwise>
1347 </xsl:choose>
1348 <xsl:text> autoCaller(this);
1349 if (FAILED(autoCaller.rc()))
1350 throw autoCaller.rc();
1351
1352</xsl:text>
1353 <xsl:value-of select="concat(' hrc = set', $attrbasename, '(')"/>
1354 <xsl:if test="$passAutoCaller = 'true'">
1355 <xsl:text>autoCaller, </xsl:text>
1356 </xsl:if>
1357 <xsl:apply-templates select="@type" mode="paramvalconversionusingtmp">
1358 <xsl:with-param name="dir" select="'in'"/>
1359 </xsl:apply-templates>
1360 <xsl:text>);
1361
1362#ifdef VBOX_WITH_DTRACE_R3_MAIN
1363 /* dtrace probe </xsl:text>
1364 <!-- <xsl:value-of select="concat($dtracetopclass, '__set__', $dtraceattrname, '__return(struct ', $topclass, ' *a_pThis')"/> -->
1365 <xsl:value-of select="concat($dtracetopclass, '__set__', $dtraceattrname, '__return(void *a_pThis')"/>
1366 <xsl:text>, uint32_t a_hrc, int32_t enmWhy, </xsl:text>
1367 <xsl:apply-templates select="@type" mode="dtraceparamdecl">
1368 <xsl:with-param name="dir">in</xsl:with-param>
1369 </xsl:apply-templates>
1370 <xsl:text>); */
1371 </xsl:text>
1372 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1373 <xsl:text>this, hrc, 0 /*normal*/,</xsl:text>
1374 <xsl:apply-templates select="@type" mode="dtraceparamval">
1375 <xsl:with-param name="dir">in</xsl:with-param>
1376 </xsl:apply-templates>
1377 <xsl:text>);
1378#endif
1379 }
1380 catch (HRESULT hrc2)
1381 {
1382 hrc = hrc2;
1383#ifdef VBOX_WITH_DTRACE_R3_MAIN
1384 </xsl:text>
1385 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1386 <xsl:text>this, hrc, 1 /*hrc exception*/,</xsl:text>
1387 <xsl:apply-templates select="@type" mode="dtraceparamvalnotmp">
1388 <xsl:with-param name="dir">in</xsl:with-param>
1389 </xsl:apply-templates>
1390 <xsl:text>);
1391#endif
1392 }
1393 catch (...)
1394 {
1395 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
1396#ifdef VBOX_WITH_DTRACE_R3_MAIN
1397 </xsl:text>
1398 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1399 <xsl:text>this, hrc, 9 /*unhandled exception*/,</xsl:text>
1400 <xsl:apply-templates select="@type" mode="dtraceparamvalnotmp">
1401 <xsl:with-param name="dir">in</xsl:with-param>
1402 </xsl:apply-templates>
1403 <xsl:text>);
1404#endif
1405 }
1406
1407 LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, </xsl:text>
1408 <xsl:value-of select="concat('&quot;', $topclass, '::set', $attrbasename, '&quot;, ')"/>
1409 <xsl:text>hrc));
1410 return hrc;
1411}
1412</xsl:text>
1413 </xsl:if>
1414
1415 <xsl:call-template name="emitTargetEnd">
1416 <xsl:with-param name="target" select="$target"/>
1417 </xsl:call-template>
1418
1419 <xsl:text>
1420</xsl:text>
1421</xsl:template>
1422
1423<!-- - - - - - - - - - - - - - - - - - - - - - -
1424 emit all attributes of an interface
1425 - - - - - - - - - - - - - - - - - - - - - - -->
1426<xsl:template name="emitAttributes">
1427 <xsl:param name="iface"/>
1428 <xsl:param name="topclass"/>
1429 <xsl:param name="dtracetopclass"/>
1430 <xsl:param name="pmode"/>
1431
1432 <!-- first recurse to emit all base interfaces -->
1433 <xsl:variable name="extends" select="$iface/@extends"/>
1434 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
1435 <xsl:call-template name="emitAttributes">
1436 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
1437 <xsl:with-param name="topclass" select="$topclass"/>
1438 <xsl:with-param name="pmode" select="$pmode"/>
1439 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
1440 </xsl:call-template>
1441 </xsl:if>
1442
1443 <xsl:choose>
1444 <xsl:when test="$pmode='code'">
1445 <xsl:text>//
1446</xsl:text>
1447 <xsl:value-of select="concat('// ', $iface/@name, ' properties')"/>
1448 <xsl:text>
1449//
1450
1451</xsl:text>
1452 </xsl:when>
1453 <xsl:otherwise>
1454 <xsl:value-of select="concat($G_sNewLine, ' // ', $pmode, ' ', $iface/@name, ' properties', $G_sNewLine)"/>
1455 </xsl:otherwise>
1456 </xsl:choose>
1457 <xsl:choose>
1458 <xsl:when test="$pmode='public'">
1459 <xsl:apply-templates select="$iface/attribute | $iface/if" mode="public">
1460 <xsl:with-param name="emitmode" select="'attribute'"/>
1461 </xsl:apply-templates>
1462 </xsl:when>
1463 <xsl:when test="$pmode='wrapped'">
1464 <xsl:apply-templates select="$iface/attribute | $iface/if" mode="wrapped">
1465 <xsl:with-param name="emitmode" select="'attribute'"/>
1466 </xsl:apply-templates>
1467 </xsl:when>
1468 <xsl:when test="$pmode='code'">
1469 <xsl:apply-templates select="$iface/attribute | $iface/if" mode="code">
1470 <xsl:with-param name="topclass" select="$topclass"/>
1471 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
1472 <xsl:with-param name="emitmode" select="'attribute'"/>
1473 </xsl:apply-templates>
1474 </xsl:when>
1475 <xsl:otherwise/>
1476 </xsl:choose>
1477</xsl:template>
1478
1479<xsl:template name="emitTargetBegin">
1480 <xsl:param name="target"/>
1481
1482 <xsl:choose>
1483 <xsl:when test="$target = 'xpidl'">
1484 <xsl:text>#ifdef VBOX_WITH_XPCOM
1485</xsl:text>
1486 </xsl:when>
1487 <xsl:when test="$target = 'midl'">
1488 <xsl:text>#ifndef VBOX_WITH_XPCOM
1489</xsl:text>
1490 </xsl:when>
1491 <xsl:otherwise/>
1492 </xsl:choose>
1493</xsl:template>
1494
1495<xsl:template name="emitTargetEnd">
1496 <xsl:param name="target"/>
1497
1498 <xsl:choose>
1499 <xsl:when test="$target = 'xpidl'">
1500 <xsl:text>#endif /* VBOX_WITH_XPCOM */
1501</xsl:text>
1502 </xsl:when>
1503 <xsl:when test="$target = 'midl'">
1504 <xsl:text>#endif /* !VBOX_WITH_XPCOM */
1505</xsl:text>
1506 </xsl:when>
1507 <xsl:otherwise/>
1508 </xsl:choose>
1509</xsl:template>
1510
1511
1512<!-- - - - - - - - - - - - - - - - - - - - - - -
1513 emit method
1514 - - - - - - - - - - - - - - - - - - - - - - -->
1515
1516<xsl:template match="method" mode="public">
1517 <xsl:param name="target"/>
1518
1519 <xsl:call-template name="emitTargetBegin">
1520 <xsl:with-param name="target" select="$target"/>
1521 </xsl:call-template>
1522
1523 <xsl:variable name="methodindent">
1524 <xsl:call-template name="tospace">
1525 <xsl:with-param name="str" select="@name"/>
1526 </xsl:call-template>
1527 </xsl:variable>
1528
1529 <xsl:text> STDMETHOD(</xsl:text>
1530 <xsl:call-template name="capitalize">
1531 <xsl:with-param name="str" select="@name"/>
1532 </xsl:call-template>
1533 <xsl:text>)(</xsl:text>
1534 <xsl:for-each select="param">
1535 <xsl:apply-templates select="@type" mode="public">
1536 <xsl:with-param name="dir" select="@dir"/>
1537 </xsl:apply-templates>
1538 <xsl:if test="not(position()=last())">
1539 <xsl:text>,
1540 </xsl:text>
1541 <xsl:value-of select="$methodindent"/>
1542 </xsl:if>
1543 </xsl:for-each>
1544 <xsl:text>);
1545</xsl:text>
1546
1547 <xsl:call-template name="emitTargetEnd">
1548 <xsl:with-param name="target" select="$target"/>
1549 </xsl:call-template>
1550</xsl:template>
1551
1552<xsl:template match="method" mode="wrapped">
1553 <xsl:param name="target"/>
1554
1555 <xsl:call-template name="emitTargetBegin">
1556 <xsl:with-param name="target" select="$target"/>
1557 </xsl:call-template>
1558
1559 <xsl:variable name="methodindent">
1560 <xsl:call-template name="tospace">
1561 <xsl:with-param name="str" select="@name"/>
1562 </xsl:call-template>
1563 </xsl:variable>
1564
1565 <xsl:text> virtual HRESULT </xsl:text>
1566 <xsl:call-template name="uncapitalize">
1567 <xsl:with-param name="str" select="@name"/>
1568 </xsl:call-template>
1569 <xsl:text>(</xsl:text>
1570 <xsl:variable name="passAutoCaller">
1571 <xsl:call-template name="checkoption">
1572 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1573 <xsl:with-param name="option" select="'passcaller'"/>
1574 </xsl:call-template>
1575 </xsl:variable>
1576 <xsl:if test="$passAutoCaller = 'true'">
1577 <xsl:text>AutoCaller &amp;aAutoCaller</xsl:text>
1578 <xsl:if test="count(param) > 0">
1579 <xsl:text>,
1580 </xsl:text>
1581 <xsl:value-of select="$methodindent"/>
1582 </xsl:if>
1583 </xsl:if>
1584 <xsl:for-each select="param">
1585 <xsl:apply-templates select="@type" mode="wrapped">
1586 <xsl:with-param name="dir" select="@dir"/>
1587 </xsl:apply-templates>
1588 <xsl:if test="not(position()=last())">
1589 <xsl:text>,
1590 </xsl:text>
1591 <xsl:value-of select="$methodindent"/>
1592 </xsl:if>
1593 </xsl:for-each>
1594 <xsl:text>) = 0;
1595</xsl:text>
1596
1597 <xsl:call-template name="emitTargetEnd">
1598 <xsl:with-param name="target" select="$target"/>
1599 </xsl:call-template>
1600</xsl:template>
1601
1602<xsl:template match="method" mode="code">
1603 <xsl:param name="topclass"/>
1604 <xsl:param name="dtracetopclass"/>
1605 <xsl:param name="target"/>
1606
1607 <xsl:call-template name="emitTargetBegin">
1608 <xsl:with-param name="target" select="$target"/>
1609 </xsl:call-template>
1610
1611 <xsl:variable name="methodindent">
1612 <xsl:call-template name="tospace">
1613 <xsl:with-param name="str" select="@name"/>
1614 </xsl:call-template>
1615 </xsl:variable>
1616 <xsl:variable name="methodclassindent">
1617 <xsl:call-template name="tospace">
1618 <xsl:with-param name="str" select="concat($topclass, @name)"/>
1619 </xsl:call-template>
1620 </xsl:variable>
1621 <xsl:variable name="methodbasename">
1622 <xsl:call-template name="capitalize">
1623 <xsl:with-param name="str" select="@name"/>
1624 </xsl:call-template>
1625 </xsl:variable>
1626 <xsl:variable name="limitedAutoCaller">
1627 <xsl:call-template name="checkoption">
1628 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1629 <xsl:with-param name="option" select="'limitedcaller'"/>
1630 </xsl:call-template>
1631 </xsl:variable>
1632 <xsl:variable name="dtracemethodname">
1633 <xsl:choose>
1634 <xsl:when test="@dtracename">
1635 <xsl:value-of select="@dtracename"/>
1636 </xsl:when>
1637 <xsl:otherwise>
1638 <xsl:value-of select="@name"/>
1639 </xsl:otherwise>
1640 </xsl:choose>
1641 </xsl:variable>
1642
1643 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::', $methodbasename, '(')"/>
1644 <xsl:for-each select="param">
1645 <xsl:apply-templates select="@type" mode="public">
1646 <xsl:with-param name="dir" select="@dir"/>
1647 </xsl:apply-templates>
1648 <xsl:if test="not(position()=last())">
1649 <xsl:text>,
1650 </xsl:text>
1651 <xsl:value-of select="$methodclassindent"/>
1652 </xsl:if>
1653 </xsl:for-each>
1654 <xsl:text>)
1655{
1656 LogRelFlow(("{%p} %s:enter</xsl:text>
1657 <xsl:for-each select="param">
1658 <xsl:text> </xsl:text>
1659 <xsl:apply-templates select="@type" mode="logparamtext">
1660 <xsl:with-param name="dir" select="@dir"/>
1661 <xsl:with-param name="isref" select="'yes'"/>
1662 </xsl:apply-templates>
1663 </xsl:for-each>
1664 <xsl:text>\n", this</xsl:text>
1665 <xsl:value-of select="concat(', &quot;', $topclass, '::', @name, '&quot;')"/>
1666 <xsl:for-each select="param">
1667 <xsl:text>, </xsl:text>
1668 <xsl:apply-templates select="@type" mode="logparamval">
1669 <xsl:with-param name="dir" select="@dir"/>
1670 <xsl:with-param name="isref" select="'yes'"/>
1671 </xsl:apply-templates>
1672 </xsl:for-each>
1673 <xsl:text>));
1674
1675 VirtualBoxBase::clearError();
1676
1677 HRESULT hrc;
1678
1679 try
1680 {
1681</xsl:text>
1682 <!-- @todo check in parameters if possible -->
1683 <xsl:for-each select="param">
1684 <xsl:if test="@dir!='in'">
1685 <xsl:text> CheckComArgOutPointerValidThrow(a</xsl:text>
1686 <xsl:call-template name="capitalize">
1687 <xsl:with-param name="str" select="@name"/>
1688 </xsl:call-template>
1689 <xsl:text>);
1690</xsl:text>
1691 </xsl:if>
1692 </xsl:for-each>
1693<xsl:text>
1694</xsl:text>
1695 <xsl:for-each select="param">
1696 <xsl:text>
1697 </xsl:text>
1698 <xsl:apply-templates select="@type" mode="paramvalconversion2tmpvar">
1699 <xsl:with-param name="dir" select="@dir"/>
1700 </xsl:apply-templates>
1701 </xsl:for-each>
1702 <xsl:text>
1703#ifdef VBOX_WITH_DTRACE_R3_MAIN
1704 /* dtrace probe </xsl:text>
1705 <xsl:variable name="dtracenamehack"> <!-- Ugly hack to deal with Session::assignMachine and similar. -->
1706 <xsl:if test="name(..) = 'if'">
1707 <xsl:value-of select="concat('__', ../@target)"/>
1708 </xsl:if>
1709 </xsl:variable>
1710 <!-- <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__enter(struct ', $dtracetopclass, ' *a_pThis')"/> -->
1711 <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__enter(void *a_pThis')"/>
1712 <xsl:for-each select="param[@dir='in']">
1713 <xsl:text>, </xsl:text>
1714 <xsl:apply-templates select="@type" mode="dtraceparamdecl">
1715 <xsl:with-param name="dir" select="'@dir'"/>
1716 </xsl:apply-templates>
1717 </xsl:for-each>
1718 <xsl:text>); */
1719 </xsl:text>
1720 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_ENTER('), $G_lowerCase, $G_upperCase)"/>
1721 <xsl:text>this</xsl:text>
1722 <xsl:for-each select="param[@dir='in']">
1723 <xsl:text>, </xsl:text>
1724 <xsl:apply-templates select="@type" mode="dtraceparamval">
1725 <xsl:with-param name="dir" select="@dir"/>
1726 </xsl:apply-templates>
1727 </xsl:for-each>
1728 <xsl:text>);
1729#endif
1730
1731 </xsl:text>
1732 <xsl:choose>
1733 <xsl:when test="$limitedAutoCaller = 'true'">
1734 <xsl:text>AutoLimitedCaller</xsl:text>
1735 </xsl:when>
1736 <xsl:otherwise>
1737 <xsl:text>AutoCaller</xsl:text>
1738 </xsl:otherwise>
1739 </xsl:choose>
1740 <xsl:text> autoCaller(this);
1741 if (FAILED(autoCaller.rc()))
1742 throw autoCaller.rc();
1743
1744</xsl:text>
1745 <xsl:value-of select="concat(' hrc = ', @name, '(')"/>
1746 <xsl:variable name="passAutoCaller">
1747 <xsl:call-template name="checkoption">
1748 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1749 <xsl:with-param name="option" select="'passcaller'"/>
1750 </xsl:call-template>
1751 </xsl:variable>
1752 <xsl:if test="$passAutoCaller = 'true'">
1753 <xsl:text>autoCaller</xsl:text>
1754 <xsl:if test="count(param) > 0">
1755 <xsl:text>,
1756 </xsl:text>
1757 <xsl:value-of select="$methodindent"/>
1758 </xsl:if>
1759 </xsl:if>
1760 <xsl:for-each select="param">
1761 <xsl:apply-templates select="@type" mode="paramvalconversionusingtmp">
1762 <xsl:with-param name="dir" select="@dir"/>
1763 </xsl:apply-templates>
1764 <xsl:if test="not(position()=last())">
1765 <xsl:text>,
1766 </xsl:text>
1767 <xsl:value-of select="$methodindent"/>
1768 </xsl:if>
1769 </xsl:for-each>
1770 <xsl:text>);
1771
1772#ifdef VBOX_WITH_DTRACE_R3_MAIN
1773 /* dtrace probe </xsl:text>
1774 <!-- <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, '__return(struct ', $dtracetopclass, ' *a_pThis')"/> -->
1775 <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__return(void *a_pThis')"/>
1776 <xsl:text>, uint32_t a_hrc, int32_t enmWhy</xsl:text>
1777 <xsl:for-each select="param">
1778 <xsl:text>, </xsl:text>
1779 <xsl:apply-templates select="@type" mode="dtraceparamdecl">
1780 <xsl:with-param name="dir" select="'@dir'"/>
1781 </xsl:apply-templates>
1782 </xsl:for-each>
1783 <xsl:text>); */
1784 </xsl:text>
1785 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1786 <xsl:text>this, hrc, 0 /*normal*/</xsl:text>
1787 <xsl:for-each select="param">
1788 <xsl:text>, </xsl:text>
1789 <xsl:apply-templates select="@type" mode="dtraceparamval">
1790 <xsl:with-param name="dir" select="@dir"/>
1791 </xsl:apply-templates>
1792 </xsl:for-each>
1793 <xsl:text>);
1794#endif
1795 }
1796 catch (HRESULT hrc2)
1797 {
1798 hrc = hrc2;
1799#ifdef VBOX_WITH_DTRACE_R3_MAIN
1800 </xsl:text>
1801 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1802 <xsl:text>this, hrc, 1 /*hrc exception*/</xsl:text>
1803 <xsl:for-each select="param">
1804 <xsl:text>, </xsl:text>
1805 <xsl:apply-templates select="@type" mode="dtraceparamvalnotmp">
1806 <xsl:with-param name="dir" select="@dir"/>
1807 </xsl:apply-templates>
1808 </xsl:for-each>
1809 <xsl:text>);
1810#endif
1811 }
1812 catch (...)
1813 {
1814 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
1815#ifdef VBOX_WITH_DTRACE_R3_MAIN
1816 </xsl:text>
1817 <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
1818 <xsl:text>this, hrc, 9 /*unhandled exception*/</xsl:text>
1819 <xsl:for-each select="param">
1820 <xsl:text>, </xsl:text>
1821 <xsl:apply-templates select="@type" mode="dtraceparamvalnotmp">
1822 <xsl:with-param name="dir" select="@dir"/>
1823 </xsl:apply-templates>
1824 </xsl:for-each>
1825 <xsl:text>);
1826#endif
1827 }
1828
1829 LogRelFlow(("{%p} %s: leave</xsl:text>
1830 <xsl:for-each select="param">
1831 <xsl:if test="@dir!='in'">
1832 <xsl:text> </xsl:text>
1833 <xsl:apply-templates select="@type" mode="logparamtext">
1834 <xsl:with-param name="dir" select="@dir"/>
1835 <xsl:with-param name="isref" select="''"/>
1836 </xsl:apply-templates>
1837 </xsl:if>
1838 </xsl:for-each>
1839 <xsl:text> hrc=%Rhrc\n", this</xsl:text>
1840 <xsl:value-of select="concat(', &quot;', $topclass, '::', @name, '&quot;')"/>
1841 <xsl:for-each select="param">
1842 <xsl:if test="@dir!='in'">
1843 <xsl:text>, </xsl:text>
1844 <xsl:apply-templates select="@type" mode="logparamval">
1845 <xsl:with-param name="dir" select="@dir"/>
1846 <xsl:with-param name="isref" select="''"/>
1847 </xsl:apply-templates>
1848 </xsl:if>
1849 </xsl:for-each>
1850 <xsl:text>, hrc));
1851 return hrc;
1852}
1853</xsl:text>
1854
1855 <xsl:call-template name="emitTargetEnd">
1856 <xsl:with-param name="target" select="$target"/>
1857 </xsl:call-template>
1858
1859 <xsl:text>
1860</xsl:text>
1861</xsl:template>
1862
1863<xsl:template name="emitIf">
1864 <xsl:param name="passmode"/>
1865 <xsl:param name="target"/>
1866 <xsl:param name="topclass"/>
1867 <xsl:param name="emitmode"/>
1868 <xsl:param name="dtracetopclass"/>
1869
1870 <xsl:if test="($target = 'xpidl') or ($target = 'midl')">
1871 <xsl:choose>
1872 <xsl:when test="$filelistonly=''">
1873 <xsl:choose>
1874 <xsl:when test="$passmode='public'">
1875 <xsl:choose>
1876 <xsl:when test="$emitmode='method'">
1877 <xsl:apply-templates select="method" mode="public">
1878 <xsl:with-param name="target" select="$target"/>
1879 </xsl:apply-templates>
1880 </xsl:when>
1881 <xsl:when test="$emitmode='attribute'">
1882 <xsl:apply-templates select="attribute" mode="public">
1883 <xsl:with-param name="target" select="$target"/>
1884 </xsl:apply-templates>
1885 </xsl:when>
1886 <xsl:otherwise/>
1887 </xsl:choose>
1888 </xsl:when>
1889 <xsl:when test="$passmode='wrapped'">
1890 <xsl:choose>
1891 <xsl:when test="$emitmode='method'">
1892 <xsl:apply-templates select="method" mode="wrapped">
1893 <xsl:with-param name="target" select="$target"/>
1894 </xsl:apply-templates>
1895 </xsl:when>
1896 <xsl:when test="$emitmode='attribute'">
1897 <xsl:apply-templates select="attribute" mode="wrapped">
1898 <xsl:with-param name="target" select="$target"/>
1899 </xsl:apply-templates>
1900 </xsl:when>
1901 <xsl:otherwise/>
1902 </xsl:choose>
1903 </xsl:when>
1904 <xsl:when test="$passmode='code'">
1905 <xsl:choose>
1906 <xsl:when test="$emitmode='method'">
1907 <xsl:apply-templates select="method" mode="code">
1908 <xsl:with-param name="target" select="$target"/>
1909 <xsl:with-param name="topclass" select="$topclass"/>
1910 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
1911 </xsl:apply-templates>
1912 </xsl:when>
1913 <xsl:when test="$emitmode='attribute'">
1914 <xsl:apply-templates select="attribute" mode="code">
1915 <xsl:with-param name="target" select="$target"/>
1916 <xsl:with-param name="topclass" select="$topclass"/>
1917 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
1918 </xsl:apply-templates>
1919 </xsl:when>
1920 <xsl:otherwise/>
1921 </xsl:choose>
1922 </xsl:when>
1923 <xsl:otherwise/>
1924 </xsl:choose>
1925 </xsl:when>
1926 <xsl:otherwise>
1927 <xsl:apply-templates/>
1928 </xsl:otherwise>
1929 </xsl:choose>
1930 </xsl:if>
1931</xsl:template>
1932
1933<xsl:template match="if" mode="public">
1934 <xsl:param name="emitmode"/>
1935
1936 <xsl:call-template name="emitIf">
1937 <xsl:with-param name="passmode" select="'public'"/>
1938 <xsl:with-param name="target" select="@target"/>
1939 <xsl:with-param name="emitmode" select="$emitmode"/>
1940 </xsl:call-template>
1941</xsl:template>
1942
1943<xsl:template match="if" mode="wrapped">
1944 <xsl:param name="emitmode"/>
1945
1946 <xsl:call-template name="emitIf">
1947 <xsl:with-param name="passmode" select="'wrapped'"/>
1948 <xsl:with-param name="target" select="@target"/>
1949 <xsl:with-param name="emitmode" select="$emitmode"/>
1950 </xsl:call-template>
1951</xsl:template>
1952
1953<xsl:template match="if" mode="code">
1954 <xsl:param name="topclass"/>
1955 <xsl:param name="emitmode"/>
1956 <xsl:param name="dtracetopclass"/>
1957
1958 <xsl:call-template name="emitIf">
1959 <xsl:with-param name="passmode" select="'code'"/>
1960 <xsl:with-param name="target" select="@target"/>
1961 <xsl:with-param name="emitmode" select="$emitmode"/>
1962 <xsl:with-param name="topclass" select="$topclass"/>
1963 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
1964 </xsl:call-template>
1965</xsl:template>
1966
1967<!-- - - - - - - - - - - - - - - - - - - - - - -
1968 emit all methods of an interface
1969 - - - - - - - - - - - - - - - - - - - - - - -->
1970<xsl:template name="emitMethods">
1971 <xsl:param name="iface"/>
1972 <xsl:param name="topclass"/>
1973 <xsl:param name="pmode"/>
1974 <xsl:param name="dtracetopclass"/>
1975
1976 <!-- first recurse to emit all base interfaces -->
1977 <xsl:variable name="extends" select="$iface/@extends"/>
1978 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
1979 <xsl:call-template name="emitMethods">
1980 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
1981 <xsl:with-param name="topclass" select="$topclass"/>
1982 <xsl:with-param name="pmode" select="$pmode"/>
1983 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
1984 </xsl:call-template>
1985 </xsl:if>
1986
1987 <xsl:choose>
1988 <xsl:when test="$pmode='code'">
1989 <xsl:text>//
1990</xsl:text>
1991 <xsl:value-of select="concat('// ', $iface/@name, ' methods')"/>
1992 <xsl:text>
1993//
1994
1995</xsl:text>
1996 </xsl:when>
1997 <xsl:otherwise>
1998 <xsl:value-of select="concat($G_sNewLine, ' // ', $pmode, ' ', $iface/@name, ' methods', $G_sNewLine)"/>
1999 </xsl:otherwise>
2000 </xsl:choose>
2001 <xsl:choose>
2002 <xsl:when test="$pmode='public'">
2003 <xsl:apply-templates select="$iface/method | $iface/if" mode="public">
2004 <xsl:with-param name="emitmode" select="'method'"/>
2005 </xsl:apply-templates>
2006 </xsl:when>
2007 <xsl:when test="$pmode='wrapped'">
2008 <xsl:apply-templates select="$iface/method | $iface/if" mode="wrapped">
2009 <xsl:with-param name="emitmode" select="'method'"/>
2010 </xsl:apply-templates>
2011 </xsl:when>
2012 <xsl:when test="$pmode='code'">
2013 <xsl:apply-templates select="$iface/method | $iface/if" mode="code">
2014 <xsl:with-param name="topclass" select="$topclass"/>
2015 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
2016 <xsl:with-param name="emitmode" select="'method'"/>
2017 </xsl:apply-templates>
2018 </xsl:when>
2019 <xsl:otherwise/>
2020 </xsl:choose>
2021</xsl:template>
2022
2023<!-- - - - - - - - - - - - - - - - - - - - - - -
2024 emit all attributes and methods declarations of an interface
2025 - - - - - - - - - - - - - - - - - - - - - - -->
2026<xsl:template name="emitInterfaceDecls">
2027 <xsl:param name="iface"/>
2028 <xsl:param name="pmode"/>
2029
2030 <!-- attributes -->
2031 <xsl:call-template name="emitAttributes">
2032 <xsl:with-param name="iface" select="$iface"/>
2033 <xsl:with-param name="pmode" select="$pmode"/>
2034 </xsl:call-template>
2035
2036 <!-- methods -->
2037 <xsl:call-template name="emitMethods">
2038 <xsl:with-param name="iface" select="$iface"/>
2039 <xsl:with-param name="pmode" select="$pmode"/>
2040 </xsl:call-template>
2041</xsl:template>
2042
2043<!-- - - - - - - - - - - - - - - - - - - - - - -
2044 emit auxiliary method declarations of an interface
2045 - - - - - - - - - - - - - - - - - - - - - - -->
2046<xsl:template name="emitAuxMethodDecls">
2047 <xsl:param name="iface"/>
2048 <!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr -->
2049</xsl:template>
2050
2051<!-- - - - - - - - - - - - - - - - - - - - - - -
2052 emit the header file of an interface
2053 - - - - - - - - - - - - - - - - - - - - - - -->
2054<xsl:template name="emitHeader">
2055 <xsl:param name="iface"/>
2056 <xsl:param name="addinterfaces"/>
2057
2058 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
2059
2060 <xsl:choose>
2061 <xsl:when test="$filelistonly=''">
2062 <xsl:apply-templates select="$iface" mode="startfile">
2063 <xsl:with-param name="file" select="$filename"/>
2064 </xsl:apply-templates>
2065 <xsl:call-template name="fileheader">
2066 <xsl:with-param name="name" select="$filename"/>
2067 <xsl:with-param name="class" select="substring(@name, 2)"/>
2068 <xsl:with-param name="type" select="'header'"/>
2069 </xsl:call-template>
2070 <xsl:apply-templates select="$iface" mode="classheader">
2071 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
2072 </xsl:apply-templates>
2073
2074 <!-- interface attributes/methods (public) -->
2075 <xsl:call-template name="emitInterfaceDecls">
2076 <xsl:with-param name="iface" select="$iface"/>
2077 <xsl:with-param name="pmode" select="'public'"/>
2078 </xsl:call-template>
2079
2080 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
2081 <!-- This is super tricky, as the for-each switches to the node
2082 set, which means the normal document isn't available any
2083 more. So need to use the global root node to get back into
2084 the documemt to find corresponding interface data. -->
2085 <xsl:variable name="addifname">
2086 <xsl:value-of select="string(.)"/>
2087 </xsl:variable>
2088 <xsl:call-template name="emitInterfaceDecls">
2089 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
2090 <xsl:with-param name="pmode" select="'public'"/>
2091 </xsl:call-template>
2092 </xsl:for-each>
2093
2094 <!-- auxiliary methods (public) -->
2095 <xsl:call-template name="emitAuxMethodDecls">
2096 <xsl:with-param name="iface" select="$iface"/>
2097 </xsl:call-template>
2098
2099 <!-- switch to private -->
2100 <xsl:text>
2101private:</xsl:text>
2102
2103 <!-- wrapped interface attributes/methods (private) -->
2104 <xsl:call-template name="emitInterfaceDecls">
2105 <xsl:with-param name="iface" select="$iface"/>
2106 <xsl:with-param name="pmode" select="'wrapped'"/>
2107 </xsl:call-template>
2108
2109 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
2110 <!-- This is super tricky, as the for-each switches to the node
2111 set, which means the normal document isn't available any
2112 more. So need to use the global root node to get back into
2113 the documemt to find corresponding interface data. -->
2114 <xsl:variable name="addifname">
2115 <xsl:value-of select="string(.)"/>
2116 </xsl:variable>
2117 <xsl:call-template name="emitInterfaceDecls">
2118 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
2119 <xsl:with-param name="pmode" select="'wrapped'"/>
2120 </xsl:call-template>
2121 </xsl:for-each>
2122
2123 <xsl:apply-templates select="$iface" mode="classfooter"/>
2124 <xsl:apply-templates select="$iface" mode="endfile">
2125 <xsl:with-param name="file" select="$filename"/>
2126 </xsl:apply-templates>
2127 </xsl:when>
2128 <xsl:otherwise>
2129 <xsl:apply-templates select="$iface" mode="listfile">
2130 <xsl:with-param name="file" select="$filename"/>
2131 </xsl:apply-templates>
2132 </xsl:otherwise>
2133 </xsl:choose>
2134</xsl:template>
2135
2136<!-- - - - - - - - - - - - - - - - - - - - - - -
2137 emit all attributes and methods definitions of an interface
2138 - - - - - - - - - - - - - - - - - - - - - - -->
2139<xsl:template name="emitInterfaceDefs">
2140 <xsl:param name="iface"/>
2141 <xsl:param name="addinterfaces"/>
2142
2143 <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap)', $G_sNewLine, $G_sNewLine)"/>
2144
2145 <xsl:variable name="dtracetopclass">
2146 <xsl:choose>
2147 <xsl:when test="$iface/@dtracename"><xsl:value-of select="$iface/@dtracename"/></xsl:when>
2148 <xsl:otherwise><xsl:value-of select="substring($iface/@name, 2)"/></xsl:otherwise>
2149 </xsl:choose>
2150 </xsl:variable>
2151
2152 <!-- attributes -->
2153 <xsl:call-template name="emitAttributes">
2154 <xsl:with-param name="iface" select="$iface"/>
2155 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
2156 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
2157 <xsl:with-param name="pmode" select="'code'"/>
2158 </xsl:call-template>
2159
2160 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
2161 <!-- This is super tricky, as the for-each switches to the node set,
2162 which means the normal document isn't available any more. So need
2163 to use the global root node to get back into the documemt to find
2164 corresponding interface data. -->
2165 <xsl:variable name="addifname">
2166 <xsl:value-of select="string(.)"/>
2167 </xsl:variable>
2168 <xsl:call-template name="emitAttributes">
2169 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
2170 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
2171 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
2172 <xsl:with-param name="pmode" select="'code'"/>
2173 </xsl:call-template>
2174 </xsl:for-each>
2175
2176 <!-- methods -->
2177 <xsl:call-template name="emitMethods">
2178 <xsl:with-param name="iface" select="$iface"/>
2179 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
2180 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
2181 <xsl:with-param name="pmode" select="'code'"/>
2182 </xsl:call-template>
2183
2184 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
2185 <!-- This is super tricky, as the for-each switches to the node set,
2186 which means the normal document isn't available any more. So need
2187 to use the global root node to get back into the documemt to find
2188 corresponding interface data. -->
2189 <xsl:variable name="addifname">
2190 <xsl:value-of select="string(.)"/>
2191 </xsl:variable>
2192 <xsl:call-template name="emitMethods">
2193 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
2194 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
2195 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
2196 <xsl:with-param name="pmode" select="'code'"/>
2197 </xsl:call-template>
2198 </xsl:for-each>
2199</xsl:template>
2200
2201<!-- - - - - - - - - - - - - - - - - - - - - - -
2202 emit auxiliary method declarations of an interface
2203 - - - - - - - - - - - - - - - - - - - - - - -->
2204<xsl:template name="emitAuxMethodDefs">
2205 <xsl:param name="iface"/>
2206 <!-- currently nothing, maybe later some generic FinalConstruct/... implementation -->
2207</xsl:template>
2208
2209
2210<!-- - - - - - - - - - - - - - - - - - - - - - -
2211 emit the code file of an interface
2212 - - - - - - - - - - - - - - - - - - - - - - -->
2213<xsl:template name="emitCode">
2214 <xsl:param name="iface"/>
2215 <xsl:param name="addinterfaces"/>
2216
2217 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
2218
2219 <xsl:choose>
2220 <xsl:when test="$filelistonly=''">
2221 <xsl:apply-templates select="$iface" mode="startfile">
2222 <xsl:with-param name="file" select="$filename"/>
2223 </xsl:apply-templates>
2224 <xsl:call-template name="fileheader">
2225 <xsl:with-param name="name" select="$filename"/>
2226 <xsl:with-param name="class" select="substring(@name, 2)"/>
2227 <xsl:with-param name="type" select="'code'"/>
2228 </xsl:call-template>
2229 <xsl:apply-templates select="$iface" mode="codeheader">
2230 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
2231 </xsl:apply-templates>
2232
2233 <!-- interface attributes/methods (public) -->
2234 <xsl:call-template name="emitInterfaceDefs">
2235 <xsl:with-param name="iface" select="$iface"/>
2236 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
2237 </xsl:call-template>
2238
2239 <!-- auxiliary methods (public) -->
2240 <xsl:call-template name="emitAuxMethodDefs">
2241 <xsl:with-param name="iface" select="$iface"/>
2242 </xsl:call-template>
2243
2244 <xsl:apply-templates select="$iface" mode="codefooter">
2245 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
2246 </xsl:apply-templates>
2247 <xsl:apply-templates select="$iface" mode="endfile">
2248 <xsl:with-param name="file" select="$filename"/>
2249 </xsl:apply-templates>
2250 </xsl:when>
2251 <xsl:otherwise>
2252 <xsl:apply-templates select="$iface" mode="listfile">
2253 <xsl:with-param name="file" select="$filename"/>
2254 </xsl:apply-templates>
2255 </xsl:otherwise>
2256 </xsl:choose>
2257</xsl:template>
2258
2259
2260<!-- - - - - - - - - - - - - - - - - - - - - - -
2261 wildcard match, ignore everything which has no explicit match
2262 - - - - - - - - - - - - - - - - - - - - - - -->
2263
2264<xsl:template match="*"/>
2265
2266<!-- - - - - - - - - - - - - - - - - - - - - - -
2267 ignore all if tags except those for XPIDL or MIDL target
2268 - - - - - - - - - - - - - - - - - - - - - - -->
2269
2270<xsl:template match="if">
2271 <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
2272 <xsl:apply-templates/>
2273 </xsl:if>
2274</xsl:template>
2275
2276<!-- - - - - - - - - - - - - - - - - - - - - - -
2277 interface match
2278 - - - - - - - - - - - - - - - - - - - - - - -->
2279
2280<xsl:template match="interface">
2281 <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no')">
2282 <xsl:call-template name="emitInterface">
2283 <xsl:with-param name="iface" select="."/>
2284 </xsl:call-template>
2285 </xsl:if>
2286</xsl:template>
2287
2288<!-- - - - - - - - - - - - - - - - - - - - - - -
2289 library match
2290 - - - - - - - - - - - - - - - - - - - - - - -->
2291
2292<xsl:template match="library">
2293 <xsl:apply-templates/>
2294</xsl:template>
2295
2296<!-- - - - - - - - - - - - - - - - - - - - - - -
2297 root match
2298 - - - - - - - - - - - - - - - - - - - - - - -->
2299
2300<xsl:template match="/idl">
2301 <xsl:choose>
2302 <xsl:when test="$filelistonly=''">
2303 </xsl:when>
2304 <xsl:otherwise>
2305 <xsl:value-of select="concat($filelistonly, ' := \', $G_sNewLine)"/>
2306 </xsl:otherwise>
2307 </xsl:choose>
2308 <xsl:apply-templates/>
2309 <xsl:choose>
2310 <xsl:when test="$filelistonly=''">
2311 </xsl:when>
2312 <xsl:otherwise>
2313 <xsl:text>
2314</xsl:text>
2315 </xsl:otherwise>
2316 </xsl:choose>
2317</xsl:template>
2318
2319</xsl:stylesheet>
2320<!-- vi: set tabstop=4 shiftwidth=4 expandtab: -->
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