VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/websrv-cpp.xsl@ 96399

Last change on this file since 96399 was 96308, checked in by vboxsync, 3 years ago

src/VBox/Main: XML/XSL comment fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 66.6 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 websrv-cpp.xsl:
5 XSLT stylesheet that generates methodmaps.cpp from
6 VirtualBox.xidl. This generated C++ code contains
7 all the service implementations that one would
8 normally have to implement manually to create a
9 web service; our generated code automatically maps
10 all SOAP calls into COM/XPCOM method calls.
11 See webservice/Makefile.kmk for an overview of all the things
12 generated for the webservice.
13-->
14<!--
15 Copyright (C) 2007-2020 Oracle Corporation
16
17 This file is part of VirtualBox Open Source Edition (OSE), as
18 available from http://www.virtualbox.org. This file is free software;
19 you can redistribute it and/or modify it under the terms of the GNU
20 General Public License (GPL) as published by the Free Software
21 Foundation, in version 2 as it comes in the "COPYING" file of the
22 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
23 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
24-->
25
26<xsl:stylesheet
27 version="1.0"
28 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
29 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
30 xmlns:exsl="http://exslt.org/common"
31 extension-element-prefixes="exsl">
32
33 <xsl:output method="text"/>
34
35 <xsl:strip-space elements="*"/>
36
37<!-- - - - - - - - - - - - - - - - - - - - - - -
38 global XSLT variables
39 - - - - - - - - - - - - - - - - - - - - - - -->
40
41<xsl:variable name="G_xsltFilename" select="'websrv-cpp.xsl'" />
42
43<xsl:include href="../idl/typemap-shared.inc.xsl" />
44
45<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
46 quick lookup -->
47<xsl:variable name="G_setSuppressedInterfaces"
48 select="//interface[@wsmap='suppress']" />
49
50<!-- - - - - - - - - - - - - - - - - - - - - - -
51 Keys for more efficiently looking up of types.
52 - - - - - - - - - - - - - - - - - - - - - - -->
53
54<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
55<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
56
57<!-- - - - - - - - - - - - - - - - - - - - - - -
58 root match
59 - - - - - - - - - - - - - - - - - - - - - - -->
60
61<xsl:template match="/idl">
62 <xsl:text><![CDATA[
63/* DO NOT EDIT! This is a generated file.
64 * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
65 * Generator: src/VBox/Main/webservice/websrv-cpp.xsl
66 */
67
68// shared webservice header
69#include "vboxweb.h"
70
71// vbox headers
72#include <VBox/com/com.h>
73#include <VBox/com/array.h>
74#include <VBox/com/ErrorInfo.h>
75#include <VBox/com/errorprint.h>
76#include <VBox/VBoxAuth.h>
77
78#include <iprt/assert.h>
79#include <iprt/initterm.h>
80#include <iprt/stream.h>
81#include <iprt/string.h>
82
83// gSOAP headers (must come after vbox includes because it checks for conflicting defs)
84#include "soapH.h"
85
86// standard headers
87#include <map>
88#include <iprt/sanitized/sstream>
89
90// shared strings for debug output
91const char *g_pcszCallingComMethod = " calling COM method %s\n";
92const char *g_pcszDoneCallingComMethod = " done calling COM method\n";
93const char *g_pcszConvertComOutputBack = " convert COM output \"%s\" back to caller format\n";
94const char *g_pcszDoneConvertingComOutputBack = " done converting COM output \"%s\" back to caller format\n";
95const char *g_pcszEntering = "-- entering %s\n";
96const char *g_pcszLeaving = "-- leaving %s, rc: %#lx (%d)\n";
97
98// generated string constants for all interface names
99const char *g_pcszIUnknown = "IUnknown";
100]]></xsl:text>
101
102 <xsl:for-each select="//interface">
103 <xsl:variable name="ifname" select="@name" />
104 <xsl:value-of select="concat('const char *g_pcsz', $ifname, ' = &quot;', $ifname, '&quot;;')" />
105 <xsl:call-template name="emitNewline" />
106 </xsl:for-each>
107 <xsl:apply-templates />
108</xsl:template>
109
110<!-- - - - - - - - - - - - - - - - - - - - - - -
111 if
112 - - - - - - - - - - - - - - - - - - - - - - -->
113
114<!--
115 * ignore all |if|s except those for WSDL target
116-->
117<xsl:template match="if">
118 <xsl:if test="@target='wsdl'">
119 <xsl:apply-templates/>
120 </xsl:if>
121</xsl:template>
122
123<!-- - - - - - - - - - - - - - - - - - - - - - -
124 cpp
125 - - - - - - - - - - - - - - - - - - - - - - -->
126
127<xsl:template match="cpp">
128<!-- ignore this -->
129</xsl:template>
130
131<!-- - - - - - - - - - - - - - - - - - - - - - -
132 library
133 - - - - - - - - - - - - - - - - - - - - - - -->
134
135<xsl:template match="library">
136 <xsl:text>
137/****************************************************************************
138 *
139 * types: enum converter helper functions
140 *
141 ****************************************************************************/
142 </xsl:text>
143 <!--
144 enum converter functions at top of file
145 -->
146 <xsl:for-each select="//enum">
147 <xsl:variable name="enumname" select="@name" />
148 <!-- generate enum converter for COM-to-SOAP -->
149 <xsl:call-template name="emitNewline" />
150 <xsl:value-of select="concat('vbox__', $enumname, ' ', $G_funcPrefixOutputEnumConverter, $enumname, '(', $enumname, '_T e)')" />
151 <xsl:call-template name="emitNewline" />
152 <xsl:text>{</xsl:text>
153 <xsl:call-template name="emitNewline" />
154 <xsl:value-of select="concat(' vbox__', $enumname, ' v;')" />
155 <xsl:call-template name="emitNewline" />
156 <xsl:call-template name="emitNewline" />
157 <xsl:text> switch(e)</xsl:text>
158 <xsl:call-template name="emitNewline" />
159 <xsl:text> {</xsl:text>
160 <xsl:call-template name="emitNewline" />
161 <xsl:for-each select="const[not(@wsmap='suppress')]">
162 <xsl:variable name="enumconst" select="@name" />
163 <xsl:value-of select="concat(' case ', $enumname, '_', $enumconst, ':')" />
164 <xsl:call-template name="emitNewlineIndent8" />
165 <xsl:value-of select="concat(' v = vbox__', $enumname, '__')" />
166 <!-- escape all "_" in $enumconst -->
167 <xsl:call-template name="escapeUnderscores">
168 <xsl:with-param name="string" select="$enumconst" />
169 </xsl:call-template>
170 <xsl:value-of select="';'" />
171 <xsl:call-template name="emitNewlineIndent8" />
172 <xsl:text>break;</xsl:text>
173 <xsl:call-template name="emitNewline" />
174 </xsl:for-each>
175 <!-- Add a default case so gcc gives us a rest, esp. on darwin. -->
176 <xsl:call-template name="emitNewlineIndent8" />
177 <xsl:text>default:</xsl:text>
178 <xsl:call-template name="emitNewlineIndent8" />
179 <xsl:text> AssertMsgFailed(("e=%d\n", (int)e));</xsl:text>
180 <xsl:call-template name="emitNewlineIndent8" />
181 <xsl:value-of select="concat(' v = (vbox__', $enumname, ')0x7fffdead;')" />
182 <xsl:call-template name="emitNewlineIndent8" />
183 <xsl:text>break; </xsl:text>
184 <xsl:call-template name="emitNewline" />
185 <xsl:text> }</xsl:text>
186 <xsl:call-template name="emitNewline" />
187 <xsl:call-template name="emitNewline" />
188 <xsl:text> return v;</xsl:text>
189 <xsl:call-template name="emitNewline" />
190 <xsl:text>}</xsl:text>
191 <xsl:call-template name="emitNewline" />
192 <!-- generate enum converter for SOAP-to-COM -->
193 <xsl:call-template name="emitNewline" />
194 <xsl:value-of select="concat($enumname, '_T ', $G_funcPrefixInputEnumConverter, $enumname, '(vbox__', $enumname, ' v)')" />
195 <xsl:call-template name="emitNewline" />
196 <xsl:text>{</xsl:text>
197 <xsl:call-template name="emitNewline" />
198 <xsl:value-of select="concat(' ', $enumname, '_T e;')" />
199 <xsl:call-template name="emitNewline" />
200 <xsl:call-template name="emitNewline" />
201 <xsl:text> switch(v)</xsl:text>
202 <xsl:call-template name="emitNewline" />
203 <xsl:text> {</xsl:text>
204 <xsl:call-template name="emitNewline" />
205 <xsl:for-each select="const[not(@wsmap='suppress')]">
206 <xsl:variable name="enumconst" select="@name" />
207 <xsl:value-of select="concat(' case vbox__', $enumname, '__')" />
208 <!-- escape all "_" in $enumconst -->
209 <xsl:call-template name="escapeUnderscores">
210 <xsl:with-param name="string" select="$enumconst" />
211 </xsl:call-template>
212 <xsl:value-of select="':'" />
213 <xsl:call-template name="emitNewlineIndent8" />
214 <xsl:value-of select="concat(' e = ', $enumname, '_', $enumconst, ';')" />
215 <xsl:call-template name="emitNewlineIndent8" />
216 <xsl:text>break;</xsl:text>
217 <xsl:call-template name="emitNewline" />
218 </xsl:for-each>
219 <!-- Insert a default case so gcc gives us a rest, esp. on darwin. -->
220 <xsl:call-template name="emitNewlineIndent8" />
221 <xsl:text>default:</xsl:text>
222 <xsl:call-template name="emitNewlineIndent8" />
223 <xsl:text> AssertMsgFailed(("v=%d\n", (int)v));</xsl:text>
224 <xsl:call-template name="emitNewlineIndent8" />
225 <xsl:value-of select="concat(' e = (', $enumname, '_T)0x7fffbeef;')" />
226 <xsl:call-template name="emitNewlineIndent8" />
227 <xsl:text>break; </xsl:text>
228 <xsl:call-template name="emitNewline" />
229 <xsl:text> }</xsl:text>
230 <xsl:call-template name="emitNewline" />
231 <xsl:call-template name="emitNewline" />
232 <xsl:text> return e;</xsl:text>
233 <xsl:call-template name="emitNewline" />
234 <xsl:text>}</xsl:text>
235 <xsl:call-template name="emitNewline" />
236 </xsl:for-each>
237
238 <xsl:text>
239/****************************************************************************
240 *
241 * types: struct converter helper functions
242 *
243 ****************************************************************************/
244 </xsl:text>
245
246 <xsl:for-each select="//interface[@wsmap='struct']">
247 <xsl:variable name="structname" select="@name" />
248
249 <xsl:call-template name="emitNewline" />
250 <xsl:value-of select="concat('// ', $structname, ' converter: called from method mappers to convert data from')" />
251 <xsl:call-template name="emitNewline" />
252 <xsl:value-of select="concat('// COM interface ', $structname, ', which has wsmap=&quot;struct&quot;, to SOAP structures')" />
253 <xsl:call-template name="emitNewline" />
254 <xsl:value-of select="concat('vbox__', $structname, '* ', $G_funcPrefixOutputStructConverter, $structname, '(')" />
255 <xsl:call-template name="emitNewline" />
256 <xsl:value-of select="' struct soap *soap,'" />
257 <xsl:call-template name="emitNewline" />
258 <xsl:value-of select="' const WSDLT_ID &amp;idThis,'" />
259 <xsl:call-template name="emitNewline" />
260 <xsl:value-of select="' HRESULT &amp;rc,'" />
261 <xsl:call-template name="emitNewline" />
262 <xsl:value-of select="concat(' ComPtr&lt;', $structname, '&gt; &amp;in)')" />
263 <xsl:call-template name="emitNewline" />
264 <xsl:text>{</xsl:text>
265 <xsl:call-template name="emitNewline" />
266
267 <xsl:value-of select="concat(' vbox__', $structname, ' *resp = NULL;')" />
268 <xsl:call-template name="emitNewline" />
269
270 <xsl:call-template name="emitPrologue"><xsl:with-param name="fSkipHRESULT" select="'1'"/></xsl:call-template>
271
272 <xsl:value-of select="concat(' resp = soap_new_vbox__', $structname, '(soap, -1);')" />
273 <xsl:call-template name="emitNewline" />
274 <xsl:text> if (!in)&#10;</xsl:text>
275 <xsl:text> {&#10;</xsl:text>
276 <xsl:text> // @todo ambiguous. Problem is the MOR for the object converted to struct&#10;</xsl:text>
277 <xsl:text> RaiseSoapInvalidObjectFault(soap, "");&#10;</xsl:text>
278 <xsl:text> break;&#10;</xsl:text>
279 <xsl:text> }&#10;</xsl:text>
280 <xsl:call-template name="emitNewline" />
281
282 <xsl:for-each select="key('G_keyInterfacesByName', $structname)/attribute">
283 <xsl:if test="not(@wsmap = 'suppress')">
284 <xsl:value-of select="concat(' // -- ', $structname, '.', @name)" />
285 <xsl:call-template name="emitNewline" />
286 <!-- recurse! -->
287 <xsl:call-template name="emitGetAttributeComCall">
288 <xsl:with-param name="ifname" select="$structname" />
289 <xsl:with-param name="object" select="'in'" />
290 <xsl:with-param name="attrname" select="@name" />
291 <xsl:with-param name="attrtype" select="@type" />
292 <xsl:with-param name="callerprefix" select="concat('out', '.')" />
293 </xsl:call-template>
294 <xsl:call-template name="emitNewline" />
295 </xsl:if>
296 </xsl:for-each>
297
298 <xsl:call-template name="emitEpilogue"><xsl:with-param name="fSkipHRESULT" select="'1'"/></xsl:call-template>
299
300 </xsl:for-each>
301
302 <xsl:apply-templates />
303</xsl:template>
304
305<!-- - - - - - - - - - - - - - - - - - - - - - -
306 class
307 - - - - - - - - - - - - - - - - - - - - - - -->
308
309<xsl:template match="module/class">
310<!-- TODO swallow for now -->
311</xsl:template>
312
313<!-- - - - - - - - - - - - - - - - - - - - - - -
314 enum
315 - - - - - - - - - - - - - - - - - - - - - - -->
316
317<xsl:template match="enum">
318</xsl:template>
319
320<!-- - - - - - - - - - - - - - - - - - - - - - -
321 const
322 - - - - - - - - - - - - - - - - - - - - - - -->
323
324<!--
325<xsl:template match="const">
326 <xsl:apply-templates />
327</xsl:template>
328-->
329
330<!-- - - - - - - - - - - - - - - - - - - - - - -
331 desc
332 - - - - - - - - - - - - - - - - - - - - - - -->
333
334<xsl:template match="desc">
335<!-- TODO swallow for now -->
336</xsl:template>
337
338<!-- - - - - - - - - - - - - - - - - - - - - - -
339 note
340 - - - - - - - - - - - - - - - - - - - - - - -->
341
342<xsl:template match="note">
343<!-- TODO -->
344 <xsl:apply-templates />
345</xsl:template>
346
347<!--
348 emitBeginOfFunctionHeader:
349-->
350
351<xsl:template name="emitBeginOfFunctionHeader">
352 <xsl:param name="ifname" />
353 <xsl:param name="method" />
354
355 <xsl:call-template name="emitNewline" />
356 <xsl:value-of select="concat('int __vbox__', $ifname, '_USCORE', $method, '(')" />
357 <xsl:call-template name="emitNewline" />
358 <xsl:text> struct soap *soap</xsl:text>
359</xsl:template>
360
361<!--
362 emitCppTypeForIDLType:
363 emits the C++ type that corresponds to the given WSDL type in $type.
364 -->
365<xsl:template name="emitCppTypeForIDLType">
366 <xsl:param name="method" />
367 <xsl:param name="type" />
368 <xsl:param name="safearray" />
369 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
370 <xsl:param name="inptr" /> <!-- whether to add INPTR to BSTR (Dmitry template magic) -->
371
372 <!-- look up C++ glue type from IDL type from table array in typemap-shared.inc.xsl -->
373 <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
374
375 <xsl:choose>
376 <xsl:when test="$type='wstring' or $type='uuid'">
377 <xsl:choose>
378 <xsl:when test="$safearray='yes'">
379 <xsl:choose>
380 <xsl:when test="$inptr='yes'">
381 <xsl:value-of select="'com::SafeArray&lt;IN_BSTR&gt;'" /> <!-- input string arrays must use IN_BSTR (see com/array.h) -->
382 </xsl:when>
383 <xsl:otherwise>
384 <xsl:value-of select="'com::SafeArray&lt;BSTR&gt;'" /> <!-- output string arrays use raw BSTR -->
385 </xsl:otherwise>
386 </xsl:choose>
387 </xsl:when>
388 <xsl:otherwise>
389 <xsl:value-of select="'com::Bstr'" />
390 </xsl:otherwise>
391 </xsl:choose>
392 </xsl:when>
393 <!-- if above lookup in table succeeded, use that type -->
394 <xsl:when test="string-length($gluetypefield)">
395 <xsl:call-template name="emitTypeOrArray">
396 <xsl:with-param name="type" select="$gluetypefield"/>
397 <xsl:with-param name="safearray" select="$safearray"/>
398 </xsl:call-template>
399 </xsl:when>
400 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
401 <xsl:call-template name="emitTypeOrArray">
402 <xsl:with-param name="type" select="concat($type, '_T ')"/>
403 <xsl:with-param name="safearray" select="$safearray"/>
404 </xsl:call-template>
405 </xsl:when>
406 <xsl:when test="$type='$unknown'">
407 <xsl:choose>
408 <xsl:when test="$safearray='yes'">
409 <xsl:value-of select="'com::SafeIfaceArray&lt;IUnknown&gt;'" />
410 </xsl:when>
411 <xsl:otherwise>
412 <xsl:value-of select="'ComPtr&lt;IUnknown&gt;'" />
413 </xsl:otherwise>
414 </xsl:choose>
415 </xsl:when>
416 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
417 <xsl:variable name="thatif" select="key('G_keyInterfacesByName', $type)" />
418 <xsl:variable name="thatifname" select="$thatif/@name" />
419 <xsl:choose>
420 <xsl:when test="$safearray='yes'">
421 <xsl:value-of select="concat('com::SafeIfaceArray&lt;', $thatifname, '&gt;')" />
422 </xsl:when>
423 <xsl:otherwise>
424 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt;')" />
425 </xsl:otherwise>
426 </xsl:choose>
427 </xsl:when>
428 <xsl:otherwise>
429 <xsl:call-template name="fatalError">
430 <xsl:with-param name="msg" select="concat('emitCppTypeForIDLType: Type &quot;', $type, '&quot; in method &quot;', $method, '&quot; is not supported.')" />
431 </xsl:call-template>
432 </xsl:otherwise>
433 </xsl:choose>
434</xsl:template>
435
436
437<!--
438 emitDocumentStyleArgStructs:
439 with WSDL "document" style only, emits those lengthy structs for
440 the input and output argument in the function header.
441-->
442<xsl:template name="emitDocumentStyleArgStructs">
443 <xsl:param name="ifname" />
444 <xsl:param name="methodname" />
445 <xsl:param name="fOutputs" /> <!-- if 1, emit output struct as well -->
446
447 <xsl:text>,</xsl:text>
448 <xsl:call-template name="emitNewline" />
449 <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix, ' *', $G_requestElementVarName)" />
450 <xsl:if test="$fOutputs">
451 <xsl:text>,</xsl:text>
452 <xsl:call-template name="emitNewline" />
453 <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix, ' *', $G_responseElementVarName)" />
454 <!-- <xsl:value-of select="concat(' struct ', $ifname, '__', $methodname, 'Response &amp;', $G_result)" /> -->
455 </xsl:if>
456
457</xsl:template>
458
459<!--
460 emitPrologue:
461 emits the closing ")" for the parameter list and the beginning
462 of the function body.
463 -->
464<xsl:template name="emitPrologue">
465 <xsl:text> WEBDEBUG((g_pcszEntering, __FUNCTION__));
466
467 do {</xsl:text>
468 <xsl:call-template name="emitNewline" />
469</xsl:template>
470
471<!--
472 emitEpilogue
473 -->
474<xsl:template name="emitEpilogue">
475 <xsl:param name="fSkipHRESULT" />
476
477 <xsl:text> } while (0);</xsl:text>
478 <xsl:call-template name="emitNewline" />
479 <xsl:call-template name="emitNewline" />
480 <xsl:text> WEBDEBUG((g_pcszLeaving, __FUNCTION__, rc, rc));</xsl:text>
481 <xsl:call-template name="emitNewline" />
482 <xsl:if test="not($fSkipHRESULT)">
483 <xsl:text>
484 if (FAILED(rc))
485 return SOAP_FAULT;
486 return SOAP_OK;</xsl:text>
487 </xsl:if>
488 <xsl:if test="$fSkipHRESULT">
489 <xsl:text> return resp;</xsl:text>
490 </xsl:if>
491 <xsl:call-template name="emitNewline" />
492 <xsl:text>}</xsl:text>
493 <xsl:call-template name="emitNewline" />
494</xsl:template>
495
496<!--
497 emitObjForMethod:
498 after the function prologue, emit a "pObj" object that
499 specifies the object upon which the method should be invoked.
500-->
501<xsl:template name="emitObjForMethod">
502 <xsl:param name="ifname" />
503 <xsl:param name="wsmap" />
504 <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
505
506 <xsl:choose>
507 <xsl:when test="$wsmap='global'">
508 <xsl:choose>
509 <xsl:when test="$ifname='IVirtualBox'">
510 <xsl:text> // invoke method on global IVirtualBox instance</xsl:text>
511 <xsl:call-template name="emitNewlineIndent8" />
512 <xsl:text>ComPtr&lt;IVirtualBox&gt; pObj = G_pVirtualBox;</xsl:text>
513 <xsl:call-template name="emitNewline" />
514 </xsl:when>
515 <xsl:otherwise>
516 <xsl:call-template name="fatalError">
517 <xsl:with-param name="msg" select="concat('emitObjForMethod: Unknown interface &quot;', $ifname, '&quot; with wsmap=global in XIDL.')" />
518 </xsl:call-template>
519 </xsl:otherwise>
520 </xsl:choose>
521 </xsl:when>
522 <xsl:when test="($wsmap='managed')">
523 <xsl:text> // look up managed object reference for method call&#10;</xsl:text>
524 <xsl:value-of select="concat(' ComPtr&lt;', $ifname, '&gt; pObj;&#10;')" />
525 <xsl:value-of select="concat(' if (!', $G_requestElementVarName, ')&#10;')" />
526 <xsl:text> {&#10;</xsl:text>
527 <xsl:text> RaiseSoapInvalidObjectFault(soap, "");&#10;</xsl:text>
528 <xsl:text> break;&#10;</xsl:text>
529 <xsl:text> }&#10;</xsl:text>
530 <xsl:value-of select="concat(' const WSDLT_ID &amp;idThis = ', $structprefix, $G_nameObjectRefEncoded, ';&#10;')" />
531 <xsl:value-of select="' if ((rc = findComPtrFromId(soap, idThis, pObj, false)) != S_OK)&#10;'" />
532 <xsl:text> break;&#10;</xsl:text>
533 </xsl:when>
534 </xsl:choose>
535</xsl:template>
536
537<!--
538 emitInputArgConverter:
539 another type converter (from wsdl type to COM types),
540 that generates temporary variables on the stack with
541 the WSDL input parameters converted to the COM types,
542 so we can then pass them to the actual COM method call.
543-->
544<xsl:template name="emitInputArgConverter">
545 <xsl:param name="ifname" />
546 <xsl:param name="object" /> <!-- normally "pObj" -->
547 <xsl:param name="method" />
548 <xsl:param name="methodname" />
549 <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
550 <xsl:param name="name" />
551 <xsl:param name="type" />
552 <xsl:param name="safearray" />
553
554 <xsl:value-of select="concat(' // convert input arg ', $name, '(safearray: ', $safearray, ')')" />
555 <xsl:call-template name="emitNewlineIndent8" />
556
557 <xsl:choose>
558 <xsl:when test="$safearray='yes' and $type='octet'">
559 <xsl:value-of select="concat('com::SafeArray&lt;BYTE&gt; comcall_',$name, ';')" />
560 <xsl:call-template name="emitNewlineIndent8" />
561 <xsl:value-of select="concat('Base64DecodeByteArray(soap, ',$structprefix,$name,', ComSafeArrayAsOutParam(comcall_',$name, '), idThis, &quot;', $ifname, '::', $methodname, '&quot;, ', $object, ', COM_IIDOF(', $ifname, '));')" />
562 </xsl:when>
563
564 <xsl:when test="$safearray='yes'">
565 <xsl:value-of select="concat('size_t c', $name, ' = ', $structprefix, $name, '.size();')" />
566 <xsl:call-template name="emitNewlineIndent8" />
567 <xsl:call-template name="emitCppTypeForIDLType">
568 <xsl:with-param name="method" select="$method"/>
569 <xsl:with-param name="type" select="$type"/>
570 <xsl:with-param name="safearray" select="$safearray"/>
571 <xsl:with-param name="inptr" select="'yes'"/>
572 </xsl:call-template>
573 <xsl:value-of select="concat(' comcall_', $name, '(c', $name, ');')" />
574 <xsl:call-template name="emitNewlineIndent8" />
575 <xsl:value-of select="concat('for (size_t i = 0; i &lt; c', $name, '; ++i)')" />
576 <xsl:call-template name="emitNewlineIndent8" />
577 <xsl:value-of select="'{'" />
578 <xsl:call-template name="emitNewlineIndent8" />
579 <xsl:choose>
580 <xsl:when test="$type='$unknown'">
581 <xsl:value-of select="' ComPtr&lt;IUnknown&gt; tmpObject;'" />
582 <xsl:call-template name="emitNewlineIndent8" />
583 <xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)) != S_OK)')" />
584 <xsl:call-template name="emitNewlineIndent8" />
585 <xsl:text> break;</xsl:text>
586 <xsl:call-template name="emitNewlineIndent8" />
587 <xsl:value-of select="concat(' IUnknown *tmpObject2(tmpObject); tmpObject2->AddRef(); comcall_', $name, '[i] = tmpObject;')" />
588 </xsl:when>
589 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
590 <xsl:value-of select="concat(' ComPtr&lt;', $type, '&gt; tmpObject;')" />
591 <xsl:call-template name="emitNewlineIndent8" />
592 <xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)) != S_OK)')" />
593 <xsl:call-template name="emitNewlineIndent8" />
594 <xsl:text> break;</xsl:text>
595 <xsl:call-template name="emitNewlineIndent8" />
596 <xsl:value-of select="concat(' ', $type, ' *tmpObject2(tmpObject); tmpObject2->AddRef(); comcall_', $name, '[i] = tmpObject;')" />
597 </xsl:when>
598 <xsl:when test="$type='wstring'">
599 <xsl:value-of select="concat(' com::Bstr tmpObject(', $structprefix, $name, '[i].c_str());')" />
600 <xsl:call-template name="emitNewlineIndent8" />
601 <xsl:value-of select="' BSTR tmpObjectB;'" />
602 <xsl:call-template name="emitNewlineIndent8" />
603 <xsl:value-of select="' tmpObject.detachTo(&amp;tmpObjectB);'" />
604 <xsl:call-template name="emitNewlineIndent8" />
605 <xsl:value-of select="concat(' comcall_', $name, '[i] = tmpObjectB;')" />
606 </xsl:when>
607 <xsl:when test="$type='long'">
608 <xsl:call-template name="emitNewlineIndent8" />
609 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
610 </xsl:when>
611 <xsl:when test="$type='long long'">
612 <xsl:call-template name="emitNewlineIndent8" />
613 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
614 </xsl:when>
615 <xsl:when test="$type='boolean'">
616 <xsl:call-template name="emitNewlineIndent8" />
617 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
618 </xsl:when>
619 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
620 <xsl:call-template name="emitNewlineIndent8" />
621 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, '[i]);')" />
622 </xsl:when>
623 <xsl:otherwise>
624 <xsl:call-template name="fatalError">
625 <xsl:with-param name="msg" select="concat('emitInputArgConverter Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not yet supported in safearrays.')" />
626 </xsl:call-template>
627 </xsl:otherwise>
628 </xsl:choose>
629 <xsl:call-template name="emitNewlineIndent8" />
630 <xsl:value-of select="'}'" />
631 <xsl:call-template name="emitNewline" />
632 </xsl:when>
633 <xsl:otherwise>
634 <xsl:call-template name="emitCppTypeForIDLType">
635 <xsl:with-param name="method" select="$method"/>
636 <xsl:with-param name="type" select="$type"/>
637 <xsl:with-param name="safearray" select="$safearray"/>
638 <xsl:with-param name="inptr" select="'yes'"/>
639 </xsl:call-template>
640 <xsl:choose>
641 <xsl:when test="$type='wstring' or $type='uuid'">
642 <xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
643 </xsl:when>
644 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
645 <xsl:value-of select="concat(' comcall_', $name, ' = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, ')')" />
646 </xsl:when>
647 <xsl:when test="$type='$unknown'">
648 <xsl:value-of select="concat(' comcall_', $name, ';')" />
649 <xsl:call-template name="emitNewlineIndent8" />
650 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)) != S_OK)')" />
651 <xsl:call-template name="emitNewlineIndent8" />
652 <xsl:text> break</xsl:text>
653 </xsl:when>
654 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
655 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
656 <xsl:variable name="thatif" select="key('G_keyInterfacesByName', $type)" />
657 <xsl:variable name="wsmap" select="$thatif/@wsmap" />
658 <xsl:variable name="thatifname" select="$thatif/@name" />
659 <xsl:choose>
660 <xsl:when test="not($wsmap)">
661 <xsl:call-template name="fatalError">
662 <xsl:with-param name="msg" select="concat('emitInputArgConverter: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; lacks wsmap attribute in XIDL.')" />
663 </xsl:call-template>
664 </xsl:when>
665 <xsl:when test="($wsmap='managed')">
666 <xsl:value-of select="concat(' comcall_', $name, ';')" />
667 <xsl:call-template name="emitNewlineIndent8" />
668 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)) != S_OK)')" />
669 <xsl:call-template name="emitNewlineIndent8" />
670 <xsl:text> break</xsl:text>
671 </xsl:when>
672 <xsl:otherwise>
673 <xsl:call-template name="fatalError">
674 <xsl:with-param name="msg" select="concat('emitInputArgConverter: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; has unsupported wsmap attribute value &quot;', $wsmap, '&quot; in XIDL.')" />
675 </xsl:call-template>
676 </xsl:otherwise>
677 </xsl:choose>
678 </xsl:when>
679 <xsl:otherwise>
680 <xsl:value-of select="concat(' comcall_', $name, ' = ', $structprefix, $name)" />
681 </xsl:otherwise>
682 </xsl:choose>
683 <xsl:text>;
684</xsl:text>
685 </xsl:otherwise>
686 </xsl:choose>
687
688</xsl:template>
689
690<!--
691 emitTypeOrArray
692-->
693
694<xsl:template name="emitTypeOrArray">
695 <xsl:param name="type" />
696 <xsl:param name="safearray" />
697
698 <xsl:choose>
699 <xsl:when test="$safearray='yes'">
700 <xsl:value-of select="concat('com::SafeArray&lt;', $type, '&gt;')" />
701 </xsl:when>
702 <xsl:otherwise>
703 <xsl:value-of select="$type" />
704 </xsl:otherwise>
705 </xsl:choose>
706</xsl:template>
707
708<!--
709 emitOutputArgBuffer:
710 another type converter (from wsdl type to COM types)
711 that generates a buffer variable which receives the
712 data from 'out' and 'return' parameters of the COM method call.
713-->
714<xsl:template name="emitOutputArgBuffer">
715 <xsl:param name="method" />
716 <xsl:param name="name" />
717 <xsl:param name="type" />
718 <xsl:param name="safearray" />
719 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
720
721 <xsl:text> // com output arg for </xsl:text><xsl:value-of select="concat($name, ' (safearray: ', $safearray, ')')" /><xsl:text>
722 </xsl:text>
723 <xsl:call-template name="emitCppTypeForIDLType">
724 <xsl:with-param name="method" select="$method" />
725 <xsl:with-param name="type" select="$type" />
726 <xsl:with-param name="safearray" select="$safearray" />
727 </xsl:call-template>
728 <xsl:value-of select="concat(' comcall_', $varprefix, $name, ';')" />
729 <xsl:call-template name="emitNewline" />
730</xsl:template>
731
732<!--
733 emitInParam:
734-->
735<xsl:template name="emitInParam">
736 <xsl:param name="name" />
737 <xsl:param name="type" />
738 <xsl:param name="safearray" />
739 <xsl:param name="varprefix" /> <!-- only with nested set-attribute calls -->
740
741 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
742
743 <xsl:choose>
744 <xsl:when test="@safearray='yes'">
745 <xsl:value-of select="concat('ComSafeArrayAsInParam(', $varname, ')')" />
746 </xsl:when>
747 <xsl:otherwise>
748 <xsl:value-of select="$varname" />
749 <xsl:if test="@type='wstring' or @type='uuid'">
750 <xsl:text>.raw()</xsl:text>
751 </xsl:if>
752 </xsl:otherwise>
753 </xsl:choose>
754</xsl:template>
755
756<!--
757 emitOutParam:
758-->
759<xsl:template name="emitOutParam">
760 <xsl:param name="name" />
761 <xsl:param name="type" />
762 <xsl:param name="safearray" />
763 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
764
765 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
766
767 <xsl:choose>
768 <xsl:when test="$safearray='yes'">
769 <xsl:value-of select="concat('ComSafeArrayAsOutParam(', $varname, ')')" />
770 </xsl:when>
771 <xsl:otherwise>
772 <xsl:choose>
773 <xsl:when test=" ($type='boolean')
774 or ($type='short')
775 or ($type='unsigned short')
776 or ($type='long')
777 or ($type='unsigned long')
778 or ($type='long long')
779 or ($type='unsigned long long')
780 or ($type='result')
781 or (count(key('G_keyEnumsByName', $type)) > 0)">
782 <xsl:text>&amp;</xsl:text><xsl:value-of select="$varname" />
783 </xsl:when>
784 <xsl:otherwise>
785 <xsl:value-of select="$varname" /><xsl:text>.asOutParam()</xsl:text>
786 </xsl:otherwise>
787 </xsl:choose>
788 </xsl:otherwise>
789 </xsl:choose>
790</xsl:template>
791
792<!--
793 emitComCall:
794 emits the actual method call with the arguments.
795-->
796<xsl:template name="emitComCall">
797 <xsl:param name="ifname" />
798 <xsl:param name="object" /> <!-- normally "pObj" -->
799 <xsl:param name="methodname" />
800 <xsl:param name="attrname" /> <!-- with attributes only -->
801 <xsl:param name="attrtype" /> <!-- with attributes only -->
802 <xsl:param name="attrsafearray" /> <!-- with attributes only -->
803 <xsl:param name="attrdir" /> <!-- with attributes only: "in" or "return" -->
804 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
805
806 <xsl:call-template name="emitNewlineIndent8" />
807 <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, &quot;', $methodname, '&quot;));')" />
808 <xsl:call-template name="emitNewlineIndent8" />
809 <xsl:value-of select="concat('rc = ', $object, '-&gt;', $methodname, '(')" />
810 <xsl:if test="$attrtype">
811 <xsl:choose>
812 <xsl:when test="$attrdir='in'">
813 <xsl:call-template name="emitInParam">
814 <xsl:with-param name="name" select="$attrname" />
815 <xsl:with-param name="type" select="$attrtype" />
816 <xsl:with-param name="safearray" select="$attrsafearray" />
817 <xsl:with-param name="varprefix" select="$varprefix" />
818 </xsl:call-template>
819 </xsl:when>
820 <xsl:when test="$attrdir='return'">
821 <xsl:call-template name="emitOutParam">
822 <xsl:with-param name="name" select="$attrname" />
823 <xsl:with-param name="type" select="$attrtype" />
824 <xsl:with-param name="safearray" select="$attrsafearray" />
825 <xsl:with-param name="varprefix" select="$varprefix" />
826 </xsl:call-template>
827 </xsl:when>
828 </xsl:choose>
829 </xsl:if>
830 <xsl:for-each select="param">
831 <xsl:if test="position()=1">
832 <xsl:call-template name="emitNewline" />
833 </xsl:if>
834 <xsl:if test="position() > 1">
835 <xsl:text>,</xsl:text>
836 <xsl:call-template name="emitNewline" />
837 </xsl:if>
838 <xsl:text> </xsl:text>
839 <xsl:choose>
840 <xsl:when test="@dir='in'">
841 <xsl:call-template name="emitInParam">
842 <xsl:with-param name="name" select="@name" />
843 <xsl:with-param name="type" select="@type" />
844 <xsl:with-param name="safearray" select="@safearray" />
845 <xsl:with-param name="varprefix" select="$varprefix" />
846 </xsl:call-template>
847 </xsl:when>
848 <xsl:when test="@dir='out'">
849 <xsl:call-template name="emitOutParam">
850 <xsl:with-param name="name" select="@name" />
851 <xsl:with-param name="type" select="@type" />
852 <xsl:with-param name="safearray" select="@safearray" />
853 <xsl:with-param name="varprefix" select="$varprefix" />
854 </xsl:call-template>
855 </xsl:when>
856 <xsl:when test="@dir='return'">
857 <xsl:call-template name="emitOutParam">
858 <xsl:with-param name="name" select="$G_result" />
859 <xsl:with-param name="type" select="@type" />
860 <xsl:with-param name="safearray" select="@safearray" />
861 <xsl:with-param name="varprefix" select="$varprefix" />
862 </xsl:call-template>
863 </xsl:when>
864 </xsl:choose>
865 </xsl:for-each>
866 <xsl:text>);</xsl:text>
867 <xsl:call-template name="emitNewlineIndent8" />
868 <xsl:text>if (FAILED(rc))</xsl:text>
869 <xsl:call-template name="emitNewlineIndent8" />
870 <xsl:text>{</xsl:text>
871 <xsl:call-template name="emitNewlineIndent8" />
872 <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, idThis, &quot;', $ifname, '::', $methodname,'&quot;, rc, ', $object, ', COM_IIDOF(', $ifname, '));')" />
873 <xsl:call-template name="emitNewlineIndent8" />
874 <xsl:text> break;</xsl:text>
875 <xsl:call-template name="emitNewlineIndent8" />
876 <xsl:text>}</xsl:text>
877 <xsl:call-template name="emitNewlineIndent8" />
878 <xsl:text>WEBDEBUG((g_pcszDoneCallingComMethod));</xsl:text>
879 <xsl:call-template name="emitNewline" />
880</xsl:template>
881
882<!--
883 emitOutputArgBackConverter2: implementation details of emitOutputArgBackConverter.
884 -->
885
886<xsl:template name="emitOutputArgBackConverter2">
887 <xsl:param name="name" />
888 <xsl:param name="varname" />
889 <xsl:param name="type" />
890 <xsl:param name="callerprefix" />
891
892 <xsl:choose>
893 <xsl:when test="$type='wstring' or $type='uuid'">
894 <xsl:value-of select="concat('ConvertComString(', $varname, ')')" />
895 </xsl:when>
896 <xsl:when test="$type='boolean'">
897 <!-- the "!!" avoids a microsoft compiler warning -->
898 <xsl:value-of select="concat('!!', $varname)" />
899 </xsl:when>
900 <xsl:when test=" ($type='octet')
901 or ($type='short')
902 or ($type='unsigned short')
903 or ($type='long')
904 or ($type='unsigned long')
905 or ($type='long long')
906 or ($type='unsigned long long')
907 or ($type='result')">
908 <xsl:value-of select="$varname" />
909 </xsl:when>
910 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
911 <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $type, '(', $varname, ')')" />
912 </xsl:when>
913 <xsl:when test="$type='$unknown'">
914 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcszIUnknown, ', $varname, ')')" />
915 </xsl:when>
916 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
917 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
918 <xsl:variable name="thatif" select="key('G_keyInterfacesByName', $type)" />
919 <xsl:variable name="wsmap" select="$thatif/@wsmap" />
920 <xsl:variable name="thatifname" select="$thatif/@name" />
921 <xsl:choose>
922 <xsl:when test=" ($wsmap='managed') or ($wsmap='global')">
923 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $thatifname, ', ', $varname, ')')" />
924 </xsl:when>
925 <xsl:when test="$wsmap='struct'">
926 <!-- prevent infinite recursion -->
927 <!-- <xsl:call-template name="fatalError"><xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: attempted infinite recursion for type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method)" /></xsl:call-template> -->
928 <xsl:if test="not($callerprefix)">
929 <xsl:value-of select="concat('/* convert COM interface to struct */ ', $G_funcPrefixOutputStructConverter, $type, '(soap, idThis, rc, ', $varname, ')')" />
930 </xsl:if>
931 </xsl:when>
932 <xsl:otherwise>
933 <xsl:call-template name="fatalError">
934 <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $thatifname, '::', $method, '&quot; has invalid wsmap attribute value &quot;', $wsmap, '&quot; in XIDL.')" />
935 </xsl:call-template>
936 </xsl:otherwise>
937 </xsl:choose>
938 </xsl:when>
939 <xsl:otherwise>
940 <xsl:call-template name="fatalError">
941 <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not supported.')" />
942 </xsl:call-template>
943 </xsl:otherwise>
944 </xsl:choose>
945
946</xsl:template>
947
948<!--
949 emitOutputArgBackConverter:
950 another type converter (from COM type back to WSDL)
951 which converts the output argument from the COM
952 method call back to the WSDL type passed in by the
953 caller.
954-->
955<xsl:template name="emitOutputArgBackConverter">
956 <xsl:param name="ifname" />
957 <xsl:param name="method" />
958 <xsl:param name="name" />
959 <xsl:param name="type" />
960 <xsl:param name="safearray" />
961 <xsl:param name="varprefix" /> <!-- only when called recursively from emitGetAttributeComCall -->
962 <xsl:param name="callerprefix" /> <!-- only for out params or when called recursively from emitGetAttributeComCall -->
963
964 <xsl:variable name="topname" select="$name" />
965 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
966
967 <xsl:call-template name="emitNewlineIndent8" />
968 <xsl:value-of select="concat('WEBDEBUG((g_pcszConvertComOutputBack, &quot;', $name, '&quot;));')" />
969 <xsl:call-template name="emitNewlineIndent8" />
970
971 <xsl:variable name="receiverVariable">
972 <xsl:choose>
973 <xsl:when test="(not($varprefix))">
974 <xsl:choose>
975 <xsl:when test="$callerprefix"> <!-- callerprefix set but varprefix not: then this is an out parameter :-) -->
976 <xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $name)" />
977 </xsl:when>
978 <xsl:otherwise>
979 <xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $G_result)" />
980 </xsl:otherwise>
981 </xsl:choose>
982 </xsl:when>
983 <xsl:otherwise>
984 <xsl:value-of select="concat($callerprefix, $G_result, '-&gt;', $name)" />
985 </xsl:otherwise>
986 </xsl:choose>
987 </xsl:variable>
988
989 <xsl:choose>
990 <xsl:when test="$safearray='yes' and $type='octet'">
991 <xsl:value-of select="concat($receiverVariable, ' = Base64EncodeByteArray(ComSafeArrayAsInParam(', $varname,'));')" />
992 <xsl:call-template name="emitNewlineIndent8" />
993 </xsl:when>
994
995 <xsl:when test="$safearray='yes'">
996 <xsl:value-of select="concat('for (size_t i = 0; i &lt; ', $varname, '.size(); ++i)')" />
997 <xsl:call-template name="emitNewlineIndent8" />
998 <xsl:value-of select="'{'" />
999 <xsl:call-template name="emitNewlineIndent8" />
1000 <!-- look up C++ glue type from IDL type from table array in typemap-shared.inc.xsl -->
1001 <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
1002 <xsl:choose>
1003 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
1004 <xsl:value-of select="concat(' ComPtr&lt;', $type, '&gt; tmpObject(', $varname, '[i]);')" />
1005 </xsl:when>
1006 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
1007 <xsl:value-of select="concat(' ', $type, '_T tmpObject(', $varname, '[i]);')" />
1008 </xsl:when>
1009 <xsl:when test="$type='$unknown'">
1010 <xsl:value-of select="concat(' ComPtr&lt;IUnknown&gt; tmpObject(', $varname, '[i]);')" />
1011 </xsl:when>
1012 <xsl:when test="$type='wstring' or $type='uuid'">
1013 <xsl:value-of select="concat(' com::Bstr tmpObject(', $varname, '[i]);')" />
1014 </xsl:when>
1015 <xsl:when test="$gluetypefield">
1016 <xsl:value-of select="concat(' ', $gluetypefield, ' tmpObject(', $varname, '[i]);')" />
1017 </xsl:when>
1018 <xsl:otherwise>
1019 <xsl:call-template name="fatalError">
1020 <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter (1): Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not yet supported in safearrays.')" />
1021 </xsl:call-template>
1022
1023 </xsl:otherwise>
1024 </xsl:choose>
1025 <xsl:call-template name="emitNewlineIndent8" />
1026 <xsl:value-of select="concat(' ', $receiverVariable, '.push_back(')" />
1027 <xsl:call-template name="emitOutputArgBackConverter2">
1028 <xsl:with-param name="name" select="$name"/>
1029 <xsl:with-param name="varname" select="'tmpObject'"/>
1030 <xsl:with-param name="type" select="$type"/>
1031 <xsl:with-param name="callerprefix" select="$callerprefix"/>
1032 </xsl:call-template>
1033 <xsl:value-of select="');'" />
1034 <xsl:call-template name="emitNewlineIndent8" />
1035 <xsl:value-of select="'}'" />
1036 <xsl:call-template name="emitNewline" />
1037 </xsl:when>
1038 <xsl:otherwise>
1039 <!-- emit variable name: "resp->retval = " -->
1040 <xsl:value-of select="$receiverVariable" />
1041
1042 <xsl:value-of select="' = '" />
1043 <xsl:call-template name="emitOutputArgBackConverter2">
1044 <xsl:with-param name="name" select="$name"/>
1045 <xsl:with-param name="varname" select="$varname"/>
1046 <xsl:with-param name="type" select="$type"/>
1047 <xsl:with-param name="callerprefix" select="$callerprefix"/>
1048 </xsl:call-template>
1049 <xsl:value-of select="';'" />
1050 <xsl:call-template name="emitNewline" />
1051
1052 </xsl:otherwise>
1053 </xsl:choose>
1054
1055 <xsl:value-of select="concat(' WEBDEBUG((g_pcszDoneConvertingComOutputBack, &quot;', $name, '&quot;));')" />
1056 <xsl:call-template name="emitNewline" />
1057</xsl:template>
1058
1059<!--
1060 emitGetAttributeComCall
1061 -->
1062<xsl:template name="emitGetAttributeComCall">
1063 <xsl:param name="ifname" />
1064 <xsl:param name="object" /> <!-- normally "pObj->" -->
1065 <xsl:param name="attrname" />
1066 <xsl:param name="attrtype" />
1067 <xsl:param name="attrsafearray" />
1068 <xsl:param name="varprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1069 <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1070
1071 <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1072 <xsl:call-template name="emitOutputArgBuffer">
1073 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1074 <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
1075 <xsl:with-param name="name" select="$attrname" />
1076 <xsl:with-param name="type" select="$attrtype" />
1077 <xsl:with-param name="safearray" select="$attrsafearray" />
1078 <xsl:with-param name="varprefix" select="$varprefix" />
1079 </xsl:call-template>
1080 <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
1081 <!-- actual COM method call -->
1082 <xsl:call-template name="emitComCall">
1083 <xsl:with-param name="ifname" select="$ifname" />
1084 <xsl:with-param name="methodname" select="concat('COMGETTER(', $upperattrname, ')')" />
1085 <xsl:with-param name="object" select="$object" />
1086 <xsl:with-param name="attrname" select="$attrname" />
1087 <xsl:with-param name="attrtype" select="$attrtype" />
1088 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1089 <xsl:with-param name="attrdir" select="'return'" />
1090 <xsl:with-param name="varprefix" select="$varprefix" />
1091 </xsl:call-template>
1092 <!-- convert back the output data -->
1093 <xsl:call-template name="emitOutputArgBackConverter">
1094 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1095 <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
1096 <xsl:with-param name="name" select="$attrname" />
1097 <xsl:with-param name="type" select="$attrtype" />
1098 <xsl:with-param name="safearray" select="$attrsafearray" />
1099 <xsl:with-param name="varprefix" select="$varprefix" />
1100 <xsl:with-param name="callerprefix" select="$callerprefix" />
1101 </xsl:call-template>
1102</xsl:template>
1103
1104<!--
1105 emitSetAttributeComCall
1106 -->
1107<xsl:template name="emitSetAttributeComCall">
1108 <xsl:param name="ifname" />
1109 <xsl:param name="object" /> <!-- normally "pObj->" -->
1110 <xsl:param name="attrname" />
1111 <xsl:param name="attrtype" />
1112 <xsl:param name="attrsafearray" />
1113 <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1114
1115 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1116 <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
1117
1118 <xsl:call-template name="emitInputArgConverter">
1119 <xsl:with-param name="ifname" select="$ifname" />
1120 <xsl:with-param name="method" select="concat($ifname, '::', $settername)" />
1121 <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" />
1122 <xsl:with-param name="object" select="$object" />
1123 <xsl:with-param name="name" select="$attrname" />
1124 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1125 <xsl:with-param name="type" select="$attrtype" />
1126 <xsl:with-param name="safearray" select="$attrsafearray" />
1127 </xsl:call-template>
1128 <xsl:call-template name="emitComCall">
1129 <xsl:with-param name="ifname" select="$ifname" />
1130 <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" />
1131 <xsl:with-param name="object" select="$object" />
1132 <xsl:with-param name="attrname" select="$attrname" />
1133 <xsl:with-param name="attrtype" select="$attrtype" />
1134 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1135 <xsl:with-param name="attrdir" select="'in'" />
1136 </xsl:call-template>
1137</xsl:template>
1138
1139<!--
1140 emitGetAttributeMapper
1141 -->
1142<xsl:template name="emitGetAttributeMapper">
1143 <xsl:param name="ifname" />
1144 <xsl:param name="wsmap" />
1145 <xsl:param name="attrname" />
1146 <xsl:param name="attrtype" />
1147 <xsl:param name="attrreadonly" />
1148 <xsl:param name="attrsafearray" />
1149
1150 <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1151
1152 <xsl:call-template name="emitBeginOfFunctionHeader">
1153 <xsl:with-param name="ifname" select="$ifname" />
1154 <xsl:with-param name="method" select="$gettername" />
1155 </xsl:call-template>
1156
1157 <xsl:call-template name="emitDocumentStyleArgStructs">
1158 <xsl:with-param name="ifname" select="$ifname" />
1159 <xsl:with-param name="methodname" select="$gettername" />
1160 <xsl:with-param name="fOutputs" select="$attrtype" />
1161 </xsl:call-template>
1162
1163 <xsl:text>)</xsl:text>
1164 <xsl:call-template name="emitNewline" />
1165 <xsl:text>{</xsl:text>
1166 <xsl:call-template name="emitNewline" />
1167
1168 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1169 <xsl:call-template name="emitNewline" />
1170
1171 <xsl:call-template name="emitPrologue" />
1172
1173 <!-- actual COM method call -->
1174 <!-- <xsl:choose>
1175 array attributes/parameters are not supported yet...
1176 <xsl:when test="@array or @safearray='yes'">
1177 <xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING ATTRIBUTE IMPLEMENTATION for &quot;', $attrname, '&quot; because it has array type. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
1178 </xsl:when>
1179 <xsl:otherwise> -->
1180 <xsl:call-template name="emitObjForMethod">
1181 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1182 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1183 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1184 </xsl:call-template>
1185
1186 <xsl:call-template name="emitGetAttributeComCall">
1187 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1188 <xsl:with-param name="object" select='"pObj"' />
1189 <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
1190 <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
1191 <xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param>
1192 </xsl:call-template>
1193 <!-- </xsl:otherwise>
1194 </xsl:choose> -->
1195
1196 <xsl:call-template name="emitEpilogue" />
1197</xsl:template>
1198
1199<!--
1200 emitSetAttributeMapper:
1201 -->
1202<xsl:template name="emitSetAttributeMapper">
1203 <xsl:param name="ifname" select="$ifname" />
1204 <xsl:param name="wsmap" select="$wsmap" />
1205 <xsl:param name="attrname" select="$attrname" />
1206 <xsl:param name="attrtype" select="$attrtype" />
1207 <xsl:param name="attrreadonly" select="$attrreadonly" />
1208 <xsl:param name="attrsafearray" select="$attrsafearray" />
1209
1210 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1211
1212 <xsl:call-template name="emitBeginOfFunctionHeader">
1213 <xsl:with-param name="ifname" select="$ifname" />
1214 <xsl:with-param name="method" select="$settername" />
1215 </xsl:call-template>
1216
1217 <xsl:call-template name="emitDocumentStyleArgStructs">
1218 <xsl:with-param name="ifname" select="$ifname" />
1219 <xsl:with-param name="methodname" select="$settername" />
1220 <xsl:with-param name="fOutputs" select="1" />
1221 </xsl:call-template>
1222
1223 <xsl:text>)</xsl:text>
1224 <xsl:call-template name="emitNewline" />
1225 <xsl:text>{</xsl:text>
1226 <xsl:call-template name="emitNewline" />
1227 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1228 <xsl:value-of select="concat(concat(' NOREF(', $G_responseElementVarName),');')" />
1229 <xsl:call-template name="emitNewline" />
1230 <xsl:call-template name="emitPrologue" />
1231
1232 <!-- actual COM method call -->
1233 <!-- <xsl:choose>
1234 array attributes/parameters are not supported yet...
1235 <xsl:when test="@array or @safearray='yes'">
1236 <xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING ATTRIBUTE IMPLEMENTATION for &quot;', $attrname, '&quot; because it has array type. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
1237 </xsl:when>
1238 <xsl:otherwise> -->
1239 <xsl:call-template name="emitObjForMethod">
1240 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1241 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1242 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1243 </xsl:call-template>
1244 <xsl:call-template name="emitSetAttributeComCall">
1245 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1246 <xsl:with-param name="object" select='"pObj"' />
1247 <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
1248 <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
1249 <xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param>
1250 </xsl:call-template>
1251 <!-- </xsl:otherwise>
1252 </xsl:choose> -->
1253
1254 <xsl:call-template name="emitEpilogue" />
1255</xsl:template>
1256
1257<!-- - - - - - - - - - - - - - - - - - - - - - -
1258 interface
1259 - - - - - - - - - - - - - - - - - - - - - - -->
1260
1261<xsl:template match="interface">
1262 <!-- remember the interface name in local variables -->
1263 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
1264 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
1265 <xsl:variable name="wscpp"><xsl:value-of select="@wscpp" /></xsl:variable>
1266
1267 <!-- we can save ourselves verifying the interface here as it's already
1268 done in the WSDL converter -->
1269
1270 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") or ($wscpp="hardcoded") )'>
1271 <xsl:text>
1272/****************************************************************************
1273 *
1274 * interface </xsl:text>
1275<xsl:copy-of select="$ifname" />
1276<xsl:text>
1277 *
1278 ****************************************************************************/</xsl:text>
1279 <xsl:call-template name="xsltprocNewlineOutputHack"/>
1280
1281 <!--
1282 here come the attributes
1283 -->
1284 <xsl:for-each select="attribute">
1285 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
1286 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
1287 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
1288 <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
1289 <xsl:call-template name="emitNewline" />
1290 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
1291 <xsl:choose>
1292 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
1293 <xsl:value-of select="concat('// Skipping attribute ', $attrname, ' for it is of suppressed type ', $attrtype)" />
1294 </xsl:when>
1295 <xsl:when test="@wsmap = 'suppress'">
1296 <xsl:value-of select="concat('// Skipping attribute ', $attrname, ' for it is suppressed')" />
1297 </xsl:when>
1298 <xsl:otherwise>
1299 <xsl:choose>
1300 <xsl:when test="@readonly='yes'">
1301 <xsl:value-of select="concat('// read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
1302 </xsl:when>
1303 <xsl:otherwise>
1304 <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
1305 </xsl:otherwise>
1306 </xsl:choose>
1307 <xsl:value-of select="concat(' (safearray: ', $attrsafearray, ')')" />
1308 <!-- emit getter method -->
1309 <xsl:call-template name="emitGetAttributeMapper">
1310 <xsl:with-param name="ifname" select="$ifname" />
1311 <xsl:with-param name="wsmap" select="$wsmap" />
1312 <xsl:with-param name="attrname" select="$attrname" />
1313 <xsl:with-param name="attrtype" select="$attrtype" />
1314 <xsl:with-param name="attrreadonly" select="$attrreadonly" />
1315 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1316 </xsl:call-template>
1317 <!-- for read-write attributes, emit setter method -->
1318 <xsl:if test="not(@readonly='yes')">
1319 <xsl:call-template name="emitSetAttributeMapper">
1320 <xsl:with-param name="ifname" select="$ifname" />
1321 <xsl:with-param name="wsmap" select="$wsmap" />
1322 <xsl:with-param name="attrname" select="$attrname" />
1323 <xsl:with-param name="attrtype" select="$attrtype" />
1324 <xsl:with-param name="attrreadonly" select="$attrreadonly" />
1325 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1326 </xsl:call-template>
1327 </xsl:if>
1328 </xsl:otherwise> <!-- not wsmap=suppress -->
1329 </xsl:choose>
1330 </xsl:for-each>
1331
1332 <!--
1333 here come the real methods
1334 -->
1335
1336 <xsl:for-each select="method">
1337 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
1338 <!-- method header: return value "int", method name, soap arguments -->
1339 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
1340 <xsl:choose>
1341 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
1342 or (param[@mod='ptr'])" >
1343 <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
1344 </xsl:when>
1345 <xsl:when test="@wsmap = 'suppress'">
1346 <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment>
1347 </xsl:when>
1348 <xsl:otherwise>
1349 <xsl:variable name="fHasReturnParms" select="param[@dir='return']" />
1350 <xsl:variable name="fHasOutParms" select="param[@dir='out']" />
1351
1352 <xsl:call-template name="emitNewline" />
1353 <xsl:value-of select="concat('/* method ', $ifname, '::', $methodname, '(')" />
1354 <xsl:for-each select="param">
1355 <xsl:call-template name="emitNewline" />
1356 <xsl:value-of select="concat(' [', @dir, '] ', @type, ' ', @name)" />
1357 <xsl:if test="@safearray='yes'">
1358 <xsl:text>[]</xsl:text>
1359 </xsl:if>
1360 <xsl:if test="not(position()=last())">
1361 <xsl:text>,</xsl:text>
1362 </xsl:if>
1363 </xsl:for-each>
1364 <xsl:text>)</xsl:text>
1365 <xsl:call-template name="emitNewline" />
1366 <xsl:text> */</xsl:text>
1367
1368 <xsl:call-template name="emitBeginOfFunctionHeader">
1369 <xsl:with-param name="ifname" select="$ifname" />
1370 <xsl:with-param name="method" select="$methodname" />
1371 </xsl:call-template>
1372
1373 <xsl:call-template name="emitDocumentStyleArgStructs">
1374 <xsl:with-param name="ifname" select="$ifname" />
1375 <xsl:with-param name="methodname" select="$methodname" />
1376 <xsl:with-param name="fOutputs" select="1" />
1377 </xsl:call-template>
1378 <xsl:text>)</xsl:text>
1379 <xsl:call-template name="emitNewline" />
1380 <xsl:text>{</xsl:text>
1381 <xsl:call-template name="emitNewline" />
1382 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1383 <xsl:value-of select="concat(concat(' NOREF(', $G_responseElementVarName),');')" />
1384 <xsl:call-template name="emitNewline" />
1385 <xsl:call-template name="emitPrologue" />
1386
1387 <xsl:choose>
1388 <xsl:when test="param[@array]">
1389 <xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING METHOD IMPLEMENTATION for &quot;', $methodname, '&quot; because it has arguments with &quot;array&quot; types. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
1390 </xsl:when>
1391 <xsl:otherwise>
1392 <!-- emit the object upon which to invoke the method -->
1393 <xsl:call-template name="emitObjForMethod">
1394 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1395 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1396 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1397 </xsl:call-template>
1398 <!-- next, emit storage variables to convert the SOAP/C++ arguments to COM types -->
1399 <xsl:for-each select="param">
1400 <xsl:variable name="dir" select="@dir" />
1401 <xsl:choose>
1402 <xsl:when test="$dir='in'">
1403 <xsl:call-template name="emitInputArgConverter">
1404 <xsl:with-param name="ifname" select="$ifname" />
1405 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1406 <xsl:with-param name="methodname">
1407 <xsl:call-template name="capitalize">
1408 <xsl:with-param name="str" select="$methodname" />
1409 </xsl:call-template>
1410 </xsl:with-param>
1411 <xsl:with-param name="object" select='"pObj"' />
1412 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1413 <xsl:with-param name="name" select="@name" />
1414 <xsl:with-param name="type" select="@type" />
1415 <xsl:with-param name="safearray" select="@safearray" />
1416 </xsl:call-template>
1417 </xsl:when>
1418 <xsl:when test="$dir='out'">
1419 <xsl:call-template name="emitOutputArgBuffer">
1420 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1421 <xsl:with-param name="name" select="@name" />
1422 <xsl:with-param name="type" select="@type" />
1423 <xsl:with-param name="safearray" select="@safearray" />
1424 </xsl:call-template>
1425 </xsl:when>
1426 <xsl:when test="$dir='return'">
1427 <xsl:call-template name="emitOutputArgBuffer">
1428 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1429 <xsl:with-param name="name" select="$G_result" />
1430 <xsl:with-param name="type" select="@type" />
1431 <xsl:with-param name="safearray" select="@safearray" />
1432 </xsl:call-template>
1433 </xsl:when>
1434 </xsl:choose>
1435 </xsl:for-each>
1436 <!-- actual COM method call -->
1437 <xsl:call-template name="emitComCall">
1438 <xsl:with-param name="ifname" select="$ifname" />
1439 <xsl:with-param name="object" select='"pObj"' />
1440 <xsl:with-param name="methodname">
1441 <xsl:call-template name="capitalize">
1442 <xsl:with-param name="str" select="$methodname" />
1443 </xsl:call-template>
1444 </xsl:with-param>
1445 </xsl:call-template>
1446 <!-- convert back the output data -->
1447 <xsl:for-each select="param">
1448 <xsl:variable name="dir" select="@dir" />
1449 <xsl:if test="$dir='out'">
1450 <xsl:call-template name="emitOutputArgBackConverter">
1451 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1452 <xsl:with-param name="method" select="$methodname" />
1453 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
1454 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1455 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1456 <xsl:with-param name="callerprefix" select="'outparms.'"/>
1457 </xsl:call-template>
1458 </xsl:if>
1459 <xsl:if test="$dir='return'">
1460 <!-- return values _normally_ should convert to the input arg from the function prototype,
1461 except when there are both return and out params; in that case gsoap squeezes them all
1462 into the output args structure and the return thing is called "retval" -->
1463 <xsl:choose>
1464 <xsl:when test="$fHasOutParms">
1465 <xsl:call-template name="emitOutputArgBackConverter">
1466 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1467 <xsl:with-param name="method" select="$methodname" />
1468 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
1469 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1470 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1471 <xsl:with-param name="callerprefix" select="'outparms.'"/>
1472 </xsl:call-template>
1473 </xsl:when>
1474 <xsl:otherwise>
1475 <xsl:call-template name="emitOutputArgBackConverter">
1476 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1477 <xsl:with-param name="method" select="$methodname" />
1478 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
1479 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1480 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1481 </xsl:call-template>
1482 </xsl:otherwise>
1483 </xsl:choose>
1484 </xsl:if>
1485 </xsl:for-each>
1486 </xsl:otherwise>
1487 </xsl:choose>
1488 <xsl:call-template name="emitEpilogue" />
1489 </xsl:otherwise>
1490 </xsl:choose>
1491 </xsl:for-each>
1492 </xsl:if>
1493
1494</xsl:template>
1495
1496
1497</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

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