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