- - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="interface" mode="startfile">
<
xsl:
call-
template name="xsltprocNewlineOutputHack"/>
<
xsl:
value-
of select="concat($G_sNewLine, '// ##### BEGINFILE "', $file, '"', $G_sNewLine)"/>
<
xsl:
template match="interface" mode="endfile">
<
xsl:
value-
of select="concat($G_sNewLine, '// ##### ENDFILE "', $file, '"', $G_sNewLine)"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="fileheader">
<
xsl:
param name="class"/>
<
xsl:
value-
of select="concat(' * VirtualBox API class wrapper ', $type, ' for I', $class, '.')"/>
* DO NOT EDIT! This is a generated file.
* Copyright (C) 2010-2015 Oracle Corporation
* This file is part of VirtualBox Open Source Edition (OSE), as
* you can redistribute it
and/
or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
<!-- Emits COM_INTERFACE_ENTRY statements for the current interface node and whatever it inherits from. --> <
xsl:
template name="emitCOMInterfaces">
<
xsl:
value-
of select="concat(' COM_INTERFACE_ENTRY(', @name, ')' , $G_sNewLine)"/>
<!-- now recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $extends)">
<
xsl:
call-
template name="emitCOMInterfaces"/>
<
xsl:
template match="interface" mode="classheader">
<
xsl:
param name="addinterfaces"/>
<
xsl:
value-
of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_', $G_sNewLine)"/>
<
xsl:
value-
of select="concat('#define ', substring(@name, 2), 'Wrap_H_')"/>
<
xsl:
value-
of select="concat('class ATL_NO_VTABLE ', substring(@name, 2), 'Wrap:')"/>
<
xsl:
value-
of select="concat(' VBOX_SCRIPTABLE_IMPL(', @name, ')')"/>
<
xsl:
if test="count(exsl:node-set($addinterfaces)/token) > 0">
<
xsl:
value-
of select="$G_sNewLine"/>
<
xsl:
for-
each select="exsl:node-set($addinterfaces)/token">
<
xsl:
value-
of select="concat(' VBOX_SCRIPTABLE_IMPL(', text(), ')')"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$G_sNewLine"/>
<
xsl:
value-
of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ')', $G_sNewLine)"/>
<
xsl:
value-
of select="concat(' DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
<
xsl:
text> DECLARE_PROTECT_FINAL_CONSTRUCT()
<
xsl:
value-
of select="concat(' BEGIN_COM_MAP(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
<
xsl:
text> COM_INTERFACE_ENTRY(ISupportErrorInfo)
<
xsl:
call-
template name="emitCOMInterfaces"/>
<
xsl:
value-
of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')', $G_sNewLine)"/>
<
xsl:
variable name="manualAddInterfaces">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'manualaddinterfaces'"/>
<
xsl:
if test="not($manualAddInterfaces = 'true')">
<
xsl:
for-
each select="exsl:node-set($addinterfaces)/token">
<!-- This is super tricky, as the for-each switches to the node set, which means the normal document isn't available any more. We get the data we need, uses a for-each to switch document and then a key() to look up the interface by name. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
for-
each select="$G_root">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $addifname)">
<
xsl:
call-
template name="emitCOMInterfaces"/>
<
xsl:
value-
of select="concat(' DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
<
xsl:
template match="interface" mode="classfooter">
<
xsl:
param name="addinterfaces"/>
<
xsl:
value-
of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_', $G_sNewLine)"/>
<
xsl:
template match="interface" mode="codeheader">
<
xsl:
param name="addinterfaces"/>
<
xsl:
value-
of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), $G_sNewLine, $G_sNewLine)"/>
<
xsl:
value-
of select="concat('#include "', substring(@name, 2), 'Wrap.h"', $G_sNewLine)"/>
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
template name="emitISupports">
<
xsl:
param name="classname"/>
<
xsl:
param name="extends"/>
<
xsl:
param name="addinterfaces"/>
<
xsl:
param name="depth"/>
<
xsl:
param name="interfacelist"/>
<
xsl:
when test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
<
xsl:
variable name="newextends" select="key('G_keyInterfacesByName', $extends)/@extends"/>
<
xsl:
variable name="newiflist" select="concat($interfacelist, ', ', $extends)"/>
<
xsl:
call-
template name="emitISupports">
<
xsl:
with-
param name="classname" select="$classname"/>
<
xsl:
with-
param name="extends" select="$newextends"/>
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
with-
param name="depth" select="$depth + 1"/>
<
xsl:
with-
param name="interfacelist" select="$newiflist"/>
<
xsl:
variable name="addinterfaces_ns" select="exsl:node-set($addinterfaces)"/>
<
xsl:
variable name="addif" select="key('G_keyInterfacesByName', $addifname)/@extends"/>
<
xsl:
variable name="newextends" select="$addif/@extends"/>
<
xsl:
variable name="newiflist" select="concat($interfacelist, ', ', $addifname)"/>
<
xsl:
call-
template name="emitISupports">
<
xsl:
with-
param name="classname" select="$classname"/>
<
xsl:
with-
param name="extends" select="$newextends"/>
<
xsl:
with-
param name="addinterfaces" select="$newaddinterfaces"/>
<
xsl:
with-
param name="depth" select="$depth + 1"/>
<
xsl:
with-
param name="interfacelist" select="$newiflist"/>
<
xsl:
value-
of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS', $depth, '_CI(', $classname, ', ', $interfacelist, ')', $G_sNewLine)"/>
<
xsl:
template match="interface" mode="codefooter">
<
xsl:
param name="addinterfaces"/>
<
xsl:
text>#ifdef VBOX_WITH_XPCOM
<
xsl:
value-
of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
<
xsl:
variable name="manualAddInterfaces">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'manualaddinterfaces'"/>
<
xsl:
when test="$manualAddInterfaces = 'true'">
<
xsl:
variable name="nulladdinterfaces"></
xsl:
variable>
<
xsl:
call-
template name="emitISupports">
<
xsl:
with-
param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
<
xsl:
with-
param name="extends" select="@extends"/>
<
xsl:
with-
param name="addinterfaces" select="$nulladdinterfaces"/>
<
xsl:
with-
param name="depth" select="1"/>
<
xsl:
with-
param name="interfacelist" select="@name"/>
<
xsl:
call-
template name="emitISupports">
<
xsl:
with-
param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
<
xsl:
with-
param name="extends" select="@extends"/>
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
with-
param name="depth" select="1"/>
<
xsl:
with-
param name="interfacelist" select="@name"/>
<
xsl:
text>#endif // VBOX_WITH_XPCOM
<!-- - - - - - - - - - - - - - - - - - - - - - - templates for dealing with names and parameters - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="tospace">
<
xsl:
value-
of select="translate($str, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_', ' ')"/>
<
xsl:
template name="checkoption">
<
xsl:
param name="optionlist"/>
<
xsl:
param name="option"/>
<
xsl:
value-
of select="string-length($option) > 0 and contains(concat(',', translate($optionlist, ' ', ''), ','), concat(',', $option, ','))"/>
<
xsl:
template name="getattrlist">
<
xsl:
param name="separator" select="','"/>
<
xsl:
if test="$val and $val != ''">
<
xsl:
when test="contains($val,$separator)">
<
xsl:
value-
of select="substring-before($val,$separator)"/>
<
xsl:
call-
template name="getattrlist">
<
xsl:
with-
param name="val" select="substring-after($val,$separator)"/>
<
xsl:
with-
param name="separator" select="$separator"/>
<
token><
xsl:
value-
of select="$val"/></
token>
<
xsl:
template name="translatepublictype">
<
xsl:
when test="$type='wstring' or $type='uuid'">
<
xsl:
if test="$dir='in'">
<
xsl:
text>BSTR</
xsl:
text>
<
xsl:
when test="$type='$unknown'">
<
xsl:
text>IUnknown *</
xsl:
text>
<
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
value-
of select="concat($type, ' *')"/>
<
xsl:
when test="count(key('G_keyEnumsByName', $type)) > 0">
<
xsl:
value-
of select="concat($type, '_T')"/>
<!-- Micro optimizations: Put off wraptypefield calculation as long as possible; Check interfaces before enums. --> <
xsl:
variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
<
xsl:
when test="string-length($gluetypefield)">
<
xsl:
value-
of select="$gluetypefield"/>
<
xsl:
call-
template name="fatalError">
<
xsl:
with-
param name="msg" select="concat('translatepublictype: Type "', $type, '" is not supported.')"/>
<
xsl:
if test="$mod='ptr'">
<
xsl:
template name="translatewrappedtype">
<
xsl:
param name="safearray"/>
<
xsl:
when test="$type='wstring'">
<
xsl:
if test="$dir='in' and not($safearray='yes')">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>com::Utf8Str &</
xsl:
text>
<
xsl:
when test="$type='uuid'">
<
xsl:
if test="$dir='in'">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>com::Guid &</
xsl:
text>
<
xsl:
when test="$type='$unknown'">
<
xsl:
if test="$dir='in' and not($safearray='yes')">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>ComPtr<IUnknown> &</
xsl:
text>
<
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
if test="$dir='in' and not($safearray='yes')">
<
xsl:
text>const </
xsl:
text>
<
xsl:
value-
of select="concat('ComPtr<', $type, '> &')"/>
<
xsl:
when test="count(key('G_keyEnumsByName', $type)) > 0">
<
xsl:
value-
of select="concat($type, '_T')"/>
<!-- Micro optimizations: Put off wraptypefield calculation as long as possible; Check interfaces before enums. --> <
xsl:
variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
<
xsl:
when test="string-length($wraptypefield)">
<
xsl:
value-
of select="$wraptypefield"/>
<
xsl:
call-
template name="fatalError">
<
xsl:
with-
param name="msg" select="concat('translatewrappedtype: Type "', $type, '" is not supported.')"/>
<
xsl:
if test="$mod='ptr'">
<
xsl:
template name="translatefmtspectype">
<
xsl:
param name="safearray"/>
<
xsl:
param name="isref"/>
<
xsl:
variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
<
xsl:
when test="$mod='ptr' or ($isref='yes' and $dir!='in')">
<
xsl:
when test="$safearray='yes'">
<
xsl:
when test="string-length($wrapfmt)">
<
xsl:
value-
of select="$wrapfmt"/>
<
xsl:
when test="$type='$unknown'">
<
xsl:
when test="count(key('G_keyEnumsByName', $type)) > 0">
<
xsl:
text>%RU32</
xsl:
text>
<
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
call-
template name="fatalError">
<
xsl:
with-
param name="msg" select="concat('translatefmtcpectype: Type "', $type, '" is not supported.')"/>
<
xsl:
template name="translatedtracetype">
<
xsl:
variable name="dtracetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@dtracename"/>
<
xsl:
when test="string-length($dtracetypefield)">
<
xsl:
value-
of select="$dtracetypefield"/>
<
xsl:
when test="$type='$unknown'">
<!-- <xsl:text>struct IUnknown *</xsl:text> --> <
xsl:
text>void *</
xsl:
text>
<
xsl:
when test="count(key('G_keyEnumsByName', $type)) > 0">
<!-- <xsl:value-of select="concat($type, '_T')"/> - later we can emit enums into dtrace the library --> <
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<xsl:value-of select="concat('struct ', $type, ' *')"/> <
xsl:
text>void *</
xsl:
text>
<
xsl:
call-
template name="fatalError">
<
xsl:
with-
param name="msg" select="concat('translatedtracetype Type "', $type, '" is not supported.')"/>
<
xsl:
if test="$mod='ptr'">
<!-- - - - - - - - - - - - - - - - - - - - - - - templates for handling entire interfaces and their contents - - - - - - - - - - - - - - - - - - - - - - --> <!-- Called on interface node. --> <
xsl:
template name="emitInterface">
<!-- sources, headers and dtrace-probes all needs attribute lists --> <
xsl:
variable name="addinterfaces">
<
xsl:
call-
template name="getattrlist">
<
xsl:
with-
param name="val" select="@wrap-hint-server-addinterfaces"/>
<
xsl:
when test="$generating = 'sources'">
<
xsl:
if test="(position() mod 2) = $reminder">
<
xsl:
call-
template name="emitCode">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
when test="$generating = 'headers'">
<
xsl:
call-
template name="emitHeader">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
when test="$generating = 'dtrace-probes'">
<
xsl:
call-
template name="emitDTraceProbes">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
otherwise><
xsl:
message terminate="yes">Otherwise oops in emitInterface</
xsl:
message></
xsl:
otherwise>
<!-- Called on a method param or attribute node. --> <
xsl:
template name="emitPublicParameter">
<
xsl:
variable name="gluetype">
<
xsl:
call-
template name="translatepublictype">
<
xsl:
with-
param name="type" select="@type"/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
with-
param name="mod" select="@mod"/>
<
xsl:
when test="@safearray='yes'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayIn(</
xsl:
text>
<
xsl:
text>ComSafeArrayOut(</
xsl:
text>
<
xsl:
value-
of select="$gluetype"/>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
value-
of select="$gluetype"/>
<
xsl:
if test="substring($gluetype,string-length($gluetype))!='*'">
<
xsl:
if test="$dir != 'in'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
template match="attribute/@type | param/@type" mode="wrapped">
<
xsl:
variable name="wraptype">
<
xsl:
call-
template name="translatewrappedtype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
with-
param name="mod" select="../@mod"/>
<
xsl:
with-
param name="safearray" select="../@safearray"/>
<
xsl:
variable name="lastchar">
<
xsl:
value-
of select="substring($wraptype, string-length($wraptype))"/>
<
xsl:
when test="../@safearray='yes'">
<
xsl:
if test="$dir='in'">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>std::vector<</
xsl:
text>
<
xsl:
when test="$lastchar = '&'">
<
xsl:
variable name="wraptype2">
<
xsl:
value-
of select="substring($wraptype, 1, string-length($wraptype)-2)"/>
<
xsl:
value-
of select="$wraptype2"/>
<
xsl:
if test="substring($wraptype2,string-length($wraptype2)) = '>'">
<
xsl:
when test="lastchar = '>'">
<
xsl:
value-
of select="concat($wraptype, ' ')"/>
<
xsl:
value-
of select="$wraptype"/>
<
xsl:
text>> &</
xsl:
text>
<
xsl:
value-
of select="$wraptype"/>
<
xsl:
if test="$lastchar != '&'">
<
xsl:
if test="$lastchar != '*'">
<
xsl:
if test="$dir != 'in'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
template match="attribute/@type | param/@type" mode="logparamtext">
<
xsl:
param name="isref"/>
<
xsl:
if test="$isref!='yes' and ($dir='out' or $dir='ret')">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
call-
template name="translatefmtspectype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
with-
param name="mod" select="../@mod"/>
<
xsl:
with-
param name="safearray" select="../@safearray"/>
<
xsl:
with-
param name="isref" select="$isref"/>
<
xsl:
template match="attribute/@type | param/@type" mode="logparamval">
<
xsl:
param name="isref"/>
<
xsl:
when test="../@safearray='yes' and $isref!='yes'">
<
xsl:
text>ComSafeArraySize(</
xsl:
text>
<
xsl:
if test="$isref!='yes' and $dir!='in'">
<
xsl:
when test="$isref!='yes' and $dir!='in'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
when test="../@safearray='yes' and $isref!='yes'">
<!-- Emits the DTrace probe parameter value (using tmps), invoked on param or attribute node. --> <
xsl:
template name="emitDTraceParamValue">
<
xsl:
variable name="viatmpvar">
<
xsl:
for-
each select="@type">
<
xsl:
call-
template name="paramconversionviatmp">
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
variable name="type" select="@type"/>
<!-- Doesn't help to inline paramconversionviatmp: <xsl:when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or @safearray = 'yes' or count(key('G_keyInterfacesByName', $type)) > 0"> --> <
xsl:
when test="$viatmpvar = 'yes'">
<
xsl:
variable name="tmpname">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
when test="@safearray = 'yes'">
<
xsl:
text>(uint32_t)</
xsl:
text>
<
xsl:
value-
of select="$tmpname"/>
<
xsl:
text>.array().size(), </
xsl:
text>
<xsl:value-of select="concat($tmpname, '.array().data(), ')"/> <
xsl:
text>NULL /*for now*/</
xsl:
text>
<
xsl:
when test="$type = 'wstring'">
<
xsl:
value-
of select="$tmpname"/>
<
xsl:
text>.str().c_str()</
xsl:
text>
<
xsl:
when test="$type = 'uuid'">
<
xsl:
value-
of select="$tmpname"/>
<
xsl:
text>.uuid().toStringCurly().c_str()</
xsl:
text>
<
xsl:
when test="$type = '$unknown'">
<
xsl:
text>(void *)</
xsl:
text>
<
xsl:
value-
of select="$tmpname"/>
<
xsl:
text>.ptr()</
xsl:
text>
<
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
text>(void *)</
xsl:
text>
<
xsl:
value-
of select="$tmpname"/>
<
xsl:
text>.ptr()</
xsl:
text>
<
xsl:
value-
of select="$tmpname"/>
<
xsl:
if test="$dir != 'in'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
if test="$type = 'boolean'">
<
xsl:
text> != FALSE</
xsl:
text>
Same as emitDTraceParamValue except no temporary variables are used (they are out of scope). Note! There are two other instances of this code with different @dir values, see below. <
xsl:
template name="emitDTraceParamValNoTmp">
<!-- To speed this up, the logic of paramconversionviatmp has been duplicated/inlined here. --> <
xsl:
variable name="type" select="@type"/>
<
xsl:
when test="@safearray = 'yes'">
<
xsl:
text>0, 0</
xsl:
text>
<
xsl:
when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
if test="@dir != 'in'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
if test="$type = 'boolean'">
<
xsl:
text> != FALSE</
xsl:
text>
<!-- Copy of emitDTraceParamValNoTmp with @dir = 'in' for speeding up the code (noticable difference). --> <
xsl:
template name="emitDTraceParamValNoTmp-DirIn">
<
xsl:
variable name="type" select="@type"/>
<
xsl:
when test="@safearray = 'yes'">
<
xsl:
text>0, 0</
xsl:
text>
<
xsl:
when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
if test="$type = 'boolean'">
<
xsl:
text> != FALSE</
xsl:
text>
<!-- Copy of emitDTraceParamValNoTmp with @dir != 'in' for speeding up attributes (noticable difference). --> <
xsl:
template name="emitDTraceParamValNoTmp-DirNotIn">
<
xsl:
variable name="type" select="@type"/>
<
xsl:
when test="@safearray = 'yes'">
<
xsl:
text>0, 0</
xsl:
text>
<
xsl:
when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
if test="$type = 'boolean'">
<
xsl:
text> != FALSE</
xsl:
text>
<
xsl:
template match="attribute/@type | param/@type" mode="dtraceparamdecl">
<
xsl:
variable name="gluetype">
<
xsl:
call-
template name="translatedtracetype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
with-
param name="mod" select="../@mod"/>
<!-- Safe arrays get an extra size parameter. --> <
xsl:
if test="../@safearray='yes'">
<
xsl:
text>uint32_t a_c</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
value-
of select="$gluetype"/>
<
xsl:
when test="../@safearray='yes'">
<
xsl:
text> *a_pa</
xsl:
text>
<
xsl:
if test="substring($gluetype,string-length($gluetype))!='*'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<!-- Call this to determine whether a temporary conversion variable is used for the current parameter. Returns empty if not needed, non-empty ('yes') if needed. --> <
xsl:
template name="paramconversionviatmp">
<
xsl:
variable name="type" select="."/>
<
xsl:
when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid'">
<
xsl:
when test="../@safearray = 'yes'">
<
xsl:
when test="$type = 'boolean' or $type = 'long' or $type = 'long' or $type = 'long long'"/>
<!-- XXX: drop this? --> <
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<!-- Call this to get the argument conversion class, if any is needed. --> <
xsl:
template name="paramconversionclass">
<
xsl:
variable name="type" select="."/>
<
xsl:
when test="$type='$unknown'">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComTypeInConverter<IUnknown></
xsl:
text>
<
xsl:
text>ComTypeOutConverter<IUnknown></
xsl:
text>
<
xsl:
when test="$type='wstring'">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>BSTRInConverter</
xsl:
text>
<
xsl:
text>BSTROutConverter</
xsl:
text>
<
xsl:
when test="$type='uuid'">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>UuidInConverter</
xsl:
text>
<
xsl:
text>UuidOutConverter</
xsl:
text>
<
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComTypeInConverter</
xsl:
text>
<
xsl:
text>ComTypeOutConverter</
xsl:
text>
<
xsl:
value-
of select="concat('<', $type, '>')"/>
<
xsl:
when test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>InConverter</
xsl:
text>
<
xsl:
text>OutConverter</
xsl:
text>
<
xsl:
variable name="gluetype">
<
xsl:
call-
template name="translatepublictype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
with-
param name="mod" select="../@mod"/>
<
xsl:
value-
of select="concat('<', $gluetype, '>')"/>
<!-- Emits code for converting the parameter to a temporary variable. --> <
xsl:
template match="attribute/@type | param/@type" mode="paramvalconversion2tmpvar">
<
xsl:
variable name="conversionclass">
<
xsl:
call-
template name="paramconversionclass">
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
if test="$conversionclass != ''">
<
xsl:
value-
of select="$conversionclass"/>
<
xsl:
text> Tmp</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
if test="../@safearray = 'yes'">
<
xsl:
when test="$dir = 'in'">
<
xsl:
text>ComSafeArrayInArg(</
xsl:
text>
<
xsl:
text>ComSafeArrayOutArg(</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
if test="../@safearray = 'yes'">
<!-- Partner to paramvalconversion2tmpvar that emits the parameter when calling call the internal worker method. --> <
xsl:
template match="attribute/@type | param/@type" mode="paramvalconversionusingtmp">
<
xsl:
variable name="viatmpvar">
<
xsl:
call-
template name="paramconversionviatmp">
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
variable name="type" select="."/>
<
xsl:
when test="$viatmpvar = 'yes'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
when test="../@safearray='yes'">
<
xsl:
text>.array()</
xsl:
text>
<
xsl:
when test="$type = 'wstring'">
<
xsl:
text>.str()</
xsl:
text>
<
xsl:
when test="$type = 'uuid'">
<
xsl:
text>.uuid()</
xsl:
text>
<
xsl:
when test="$type = '$unknown'">
<
xsl:
text>.ptr()</
xsl:
text>
<
xsl:
when test="count(key('G_keyInterfacesByName', $type)) > 0">
<
xsl:
text>.ptr()</
xsl:
text>
<
xsl:
otherwise><
xsl:
message terminate="yes">Oops #1</
xsl:
message></
xsl:
otherwise>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<!-- Make sure BOOL values we pass down are either TRUE or FALSE. --> <
xsl:
if test="$type = 'boolean' and $dir = 'in'">
<
xsl:
text> != FALSE</
xsl:
text>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="attribute" mode="public">
<
xsl:
param name="target"/>
<
xsl:
call-
template name="emitTargetBegin">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
variable name="attrbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
value-
of select="concat(' STDMETHOD(COMGETTER(', $attrbasename, '))(')"/>
<
xsl:
call-
template name="emitPublicParameter">
<
xsl:
with-
param name="dir">out</
xsl:
with-
param>
<
xsl:
if test="not(@readonly) or @readonly!='yes'">
<
xsl:
value-
of select="concat(' STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
<
xsl:
call-
template name="emitPublicParameter">
<
xsl:
with-
param name="dir">in</
xsl:
with-
param>
<
xsl:
call-
template name="emitTargetEnd">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
template match="attribute" mode="wrapped">
<
xsl:
param name="target"/>
<
xsl:
call-
template name="emitTargetBegin">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
variable name="attrbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
value-
of select="concat(' virtual HRESULT get', $attrbasename, '(')"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>AutoCaller &aAutoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="wrapped">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
if test="not(@readonly) or @readonly!='yes'">
<
xsl:
value-
of select="concat(' virtual HRESULT set', $attrbasename, '(')"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>AutoCaller &aAutoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="wrapped">
<
xsl:
with-
param name="dir" select="'in'"/>
<
xsl:
call-
template name="emitTargetEnd">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
template match="attribute" mode="code">
<
xsl:
param name="topclass"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
param name="target"/>
<
xsl:
call-
template name="emitTargetBegin">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
variable name="attrbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
variable name="limitedAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'limitedcaller'"/>
<
xsl:
variable name="dtraceattrname">
<
xsl:
when test="@dtracename">
<
xsl:
value-
of select="@dtracename"/>
<
xsl:
value-
of select="$attrbasename"/>
<
xsl:
value-
of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(', $attrbasename, ')(')"/>
<
xsl:
call-
template name="emitPublicParameter">
<
xsl:
with-
param name="dir">out</
xsl:
with-
param>
LogRelFlow(("{%p} %s: enter </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
with-
param name="isref" select="'yes'"/>
<
xsl:
text>\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::get', $attrbasename, '", ')"/>
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
with-
param name="isref" select="'yes'"/>
VirtualBoxBase::clearError();
CheckComArgOutPointerValidThrow(a</
xsl:
text>
<
xsl:
value-
of select="$attrbasename"/>
<
xsl:
apply-
templates select="@type" mode="paramvalconversion2tmpvar">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_ENTER('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
when test="$limitedAutoCaller = 'true'">
<
xsl:
text>AutoLimitedCaller</
xsl:
text>
<
xsl:
text>AutoCaller</
xsl:
text>
<
xsl:
text> autoCaller(this);
<
xsl:
value-
of select="concat(' hrc = get', $attrbasename, '(')"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>autoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="paramvalconversionusingtmp">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 0 /*normal*/,</
xsl:
text>
<
xsl:
call-
template name="emitDTraceParamValue">
<
xsl:
with-
param name="dir">out</
xsl:
with-
param>
<
xsl:
if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 1 /*hrc exception*/,</
xsl:
text>
<
xsl:
call-
template name="emitDTraceParamValNoTmp-DirNotIn"/>
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);</
xsl:
text>
<
xsl:
if test="$attrbasename != 'MidlDoesNotLikEmptyInterfaces'">
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 9 /*unhandled exception*/,</
xsl:
text>
<
xsl:
call-
template name="emitDTraceParamValNoTmp-DirNotIn"/>
LogRelFlow(("{%p} %s: leave </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
with-
param name="isref" select="''"/>
<
xsl:
text> hrc=%Rhrc\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::get', $dtraceattrname, '", ')"/>
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
with-
param name="isref" select="''"/>
<
xsl:
if test="not(@readonly) or @readonly!='yes'">
<
xsl:
value-
of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
<
xsl:
call-
template name="emitPublicParameter">
<
xsl:
with-
param name="dir">in</
xsl:
with-
param>
<!-- @todo check in parameters if possible --> LogRelFlow(("{%p} %s: enter </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="'in'"/>
<
xsl:
with-
param name="isref" select="''"/>
<
xsl:
text>\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::set', $attrbasename, '", ')"/>
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="'in'"/>
<
xsl:
with-
param name="isref" select="''"/>
VirtualBoxBase::clearError();
<
xsl:
apply-
templates select="@type" mode="paramvalconversion2tmpvar">
<
xsl:
with-
param name="dir" select="'in'"/>
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $topclass, '_SET_', $dtraceattrname, '_ENTER('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, </
xsl:
text>
<
xsl:
call-
template name="emitDTraceParamValue">
<
xsl:
with-
param name="dir">in</
xsl:
with-
param>
<
xsl:
when test="$limitedAutoCaller = 'true'">
<
xsl:
text>AutoLimitedCaller</
xsl:
text>
<
xsl:
text>AutoCaller</
xsl:
text>
<
xsl:
text> autoCaller(this);
<
xsl:
value-
of select="concat(' hrc = set', $attrbasename, '(')"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>autoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="paramvalconversionusingtmp">
<
xsl:
with-
param name="dir" select="'in'"/>
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 0 /*normal*/,</
xsl:
text>
<
xsl:
call-
template name="emitDTraceParamValue">
<
xsl:
with-
param name="dir">in</
xsl:
with-
param>
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 1 /*hrc exception*/,</
xsl:
text>
<
xsl:
call-
template name="emitDTraceParamValNoTmp-DirIn"/>
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 9 /*unhandled exception*/,</
xsl:
text>
<
xsl:
call-
template name="emitDTraceParamValNoTmp-DirIn"/>
LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::set', $attrbasename, '", ')"/>
<
xsl:
call-
template name="emitTargetEnd">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
call-
template name="xsltprocNewlineOutputHack"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - Emit DTrace probes for the given attribute. - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="attribute" mode="dtrace-probes">
<
xsl:
param name="topclass"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
param name="target"/>
<
xsl:
variable name="dtraceattrname">
<
xsl:
when test="@dtracename">
<
xsl:
value-
of select="@dtracename"/>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
if test="@name != 'midlDoesNotLikEmptyInterfaces'">
<
xsl:
text> probe </
xsl:
text>
<!-- <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__enter(struct ', $topclass)"/> --> <
xsl:
value-
of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__enter(void')"/>
<!-- <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__return(struct ', $topclass, ' *a_pThis')"/> --> <
xsl:
value-
of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__return(void *a_pThis')"/>
<
xsl:
text>, uint32_t a_hrc, int32_t enmWhy, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="dtraceparamdecl">
<
xsl:
with-
param name="dir">out</
xsl:
with-
param>
<
xsl:
if test="(not(@readonly) or @readonly!='yes') and @name != 'midlDoesNotLikEmptyInterfaces'">
<
xsl:
text> probe </
xsl:
text>
<!-- <xsl:value-of select="concat($topclass, '__set__', $dtraceattrname, '__enter(struct ', $topclass, ' *a_pThis, ')"/>--> <
xsl:
value-
of select="concat($topclass, '__set__', $dtraceattrname, '__enter(void *a_pThis, ')"/>
<
xsl:
apply-
templates select="@type" mode="dtraceparamdecl">
<
xsl:
with-
param name="dir" select="'in'"/>
<!-- <xsl:value-of select="concat($dtracetopclass, '__set__', $dtraceattrname, '__return(struct ', $topclass, ' *a_pThis')"/> --> <
xsl:
value-
of select="concat($dtracetopclass, '__set__', $dtraceattrname, '__return(void *a_pThis')"/>
<
xsl:
text>, uint32_t a_hrc, int32_t enmWhy, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="dtraceparamdecl">
<
xsl:
with-
param name="dir">in</
xsl:
with-
param>
<!-- - - - - - - - - - - - - - - - - - - - - - - Emit all attributes of an interface (current node). - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAttributes">
<
xsl:
param name="topclass"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
param name="pmode"/>
<!-- first recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $extends)">
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
when test="$pmode='code'">
<
xsl:
value-
of select="concat('// ', @name, ' properties')"/>
<
xsl:
when test="$pmode != 'dtrace-probes'">
<
xsl:
value-
of select="concat($G_sNewLine, ' // ', $pmode, ' ', @name, ' properties', $G_sNewLine)"/>
<
xsl:
when test="$pmode='public'">
<
xsl:
apply-
templates select="/attribute | /if" mode="public">
<
xsl:
with-
param name="emitmode" select="'attribute'"/>
<
xsl:
when test="$pmode='wrapped'">
<
xsl:
apply-
templates select="/attribute | /if" mode="wrapped">
<
xsl:
with-
param name="emitmode" select="'attribute'"/>
<
xsl:
when test="$pmode='code'">
<
xsl:
apply-
templates select="/attribute | /if" mode="code">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="emitmode" select="'attribute'"/>
<
xsl:
when test="$pmode = 'dtrace-probes'">
<
xsl:
apply-
templates select="/attribute | /if" mode="dtrace-probes">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="emitmode" select="'attribute'"/>
<
xsl:
otherwise><
xsl:
message terminate="yes">Otherwise oops in emitAttributes</
xsl:
message></
xsl:
otherwise>
<
xsl:
template name="emitTargetBegin">
<
xsl:
param name="target"/>
<
xsl:
when test="$target = ''"/>
<
xsl:
when test="$target = 'xpidl'">
<
xsl:
text>#ifdef VBOX_WITH_XPCOM
<
xsl:
when test="$target = 'midl'">
<
xsl:
text>#ifndef VBOX_WITH_XPCOM
<
xsl:
otherwise><
xsl:
message terminate="yes">Otherwise oops in emitTargetBegin: target=<
xsl:
value-
of select="$target"/></
xsl:
message></
xsl:
otherwise>
<
xsl:
template name="emitTargetEnd">
<
xsl:
param name="target"/>
<
xsl:
when test="$target = ''"/>
<
xsl:
when test="$target = 'xpidl'">
<
xsl:
text>#endif /* VBOX_WITH_XPCOM */
<
xsl:
when test="$target = 'midl'">
<
xsl:
text>#endif /* !VBOX_WITH_XPCOM */
<
xsl:
otherwise><
xsl:
message terminate="yes">Otherwise oops in emitTargetEnd target=<
xsl:
value-
of select="$target"/></
xsl:
message></
xsl:
otherwise>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="method" mode="public">
<
xsl:
param name="target"/>
<
xsl:
call-
template name="emitTargetBegin">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
variable name="methodindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
text> STDMETHOD(</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
for-
each select="param">
<
xsl:
call-
template name="emitPublicParameter">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
call-
template name="emitTargetEnd">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
template match="method" mode="wrapped">
<
xsl:
param name="target"/>
<
xsl:
call-
template name="emitTargetBegin">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
variable name="methodindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
text> virtual HRESULT </
xsl:
text>
<
xsl:
call-
template name="uncapitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>AutoCaller &aAutoCaller</
xsl:
text>
<
xsl:
if test="count(param) > 0">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="wrapped">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
call-
template name="emitTargetEnd">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
template match="method" mode="code">
<
xsl:
param name="topclass"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
param name="target"/>
<
xsl:
call-
template name="emitTargetBegin">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
variable name="methodindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
variable name="methodclassindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="concat($topclass, @name)"/>
<
xsl:
variable name="methodbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
variable name="limitedAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'limitedcaller'"/>
<
xsl:
variable name="dtracemethodname">
<
xsl:
when test="@dtracename">
<
xsl:
value-
of select="@dtracename"/>
<
xsl:
value-
of select="@name"/>
<
xsl:
variable name="dtracenamehack">
<!-- Ugly hack to deal with Session::assignMachine and similar. --> <
xsl:
if test="name(..) = 'if'">
<
xsl:
value-
of select="concat('__', ../@target)"/>
<
xsl:
value-
of select="concat('STDMETHODIMP ', $topclass, 'Wrap::', $methodbasename, '(')"/>
<
xsl:
for-
each select="param">
<
xsl:
call-
template name="emitPublicParameter">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodclassindent"/>
LogRelFlow(("{%p} %s:enter</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
with-
param name="isref" select="'yes'"/>
<
xsl:
text>\n", this</
xsl:
text>
<
xsl:
value-
of select="concat(', "', $topclass, '::', @name, '"')"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
with-
param name="isref" select="'yes'"/>
VirtualBoxBase::clearError();
<!-- @todo check in parameters if possible --> <
xsl:
for-
each select="param">
<
xsl:
if test="@dir!='in'">
<
xsl:
text> CheckComArgOutPointerValidThrow(a</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="paramvalconversion2tmpvar">
<
xsl:
with-
param name="dir" select="@dir"/>
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_ENTER('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this</
xsl:
text>
<
xsl:
for-
each select="param[@dir='in']">
<
xsl:
call-
template name="emitDTraceParamValue">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
when test="$limitedAutoCaller = 'true'">
<
xsl:
text>AutoLimitedCaller</
xsl:
text>
<
xsl:
text>AutoCaller</
xsl:
text>
<
xsl:
text> autoCaller(this);
<
xsl:
value-
of select="concat(' hrc = ', @name, '(')"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>autoCaller</
xsl:
text>
<
xsl:
if test="count(param) > 0">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="paramvalconversionusingtmp">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodindent"/>
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 0 /*normal*/</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
call-
template name="emitDTraceParamValue">
<
xsl:
with-
param name="dir" select="@dir"/>
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 1 /*hrc exception*/</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
call-
template name="emitDTraceParamValNoTmp"/>
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
#ifdef VBOX_WITH_DTRACE_R3_MAIN
<
xsl:
value-
of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
<
xsl:
text>this, hrc, 9 /*unhandled exception*/</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
call-
template name="emitDTraceParamValNoTmp"/>
LogRelFlow(("{%p} %s: leave</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
if test="@dir!='in'">
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
with-
param name="isref" select="''"/>
<
xsl:
text> hrc=%Rhrc\n", this</
xsl:
text>
<
xsl:
value-
of select="concat(', "', $topclass, '::', @name, '"')"/>
<
xsl:
for-
each select="param">
<
xsl:
if test="@dir!='in'">
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
with-
param name="isref" select="''"/>
<
xsl:
call-
template name="emitTargetEnd">
<
xsl:
with-
param name="target" select="$target"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - Emits the DTrace probes for a method. - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="method" mode="dtrace-probes">
<
xsl:
param name="topclass"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
param name="target"/>
<
xsl:
variable name="dtracemethodname">
<
xsl:
when test="@dtracename">
<
xsl:
value-
of select="@dtracename"/>
<
xsl:
value-
of select="@name"/>
<
xsl:
variable name="dtracenamehack">
<!-- Ugly hack to deal with Session::assignMachine and similar. --> <
xsl:
if test="name(..) = 'if'">
<
xsl:
value-
of select="concat('__', ../@target)"/>
<
xsl:
text> probe </
xsl:
text>
<!-- <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__enter(struct ', $dtracetopclass, ' *a_pThis')"/> --> <
xsl:
value-
of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__enter(void *a_pThis')"/>
<
xsl:
for-
each select="param[@dir='in']">
<
xsl:
apply-
templates select="@type" mode="dtraceparamdecl">
<
xsl:
with-
param name="dir" select="'@dir'"/>
<!-- <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, '__return(struct ', $dtracetopclass, ' *a_pThis')"/> --> <
xsl:
value-
of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__return(void *a_pThis')"/>
<
xsl:
text>, uint32_t a_hrc, int32_t enmWhy</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="dtraceparamdecl">
<
xsl:
with-
param name="dir" select="'@dir'"/>
<
xsl:
template name="emitIf">
<
xsl:
param name="passmode"/>
<
xsl:
param name="target"/>
<
xsl:
param name="topclass"/>
<
xsl:
param name="emitmode"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
if test="($target = 'xpidl') or ($target = 'midl')">
<
xsl:
when test="$passmode='public'">
<
xsl:
when test="$emitmode='method'">
<
xsl:
apply-
templates select="method" mode="public">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
when test="$emitmode='attribute'">
<
xsl:
apply-
templates select="attribute" mode="public">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
when test="$passmode='wrapped'">
<
xsl:
when test="$emitmode='method'">
<
xsl:
apply-
templates select="method" mode="wrapped">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
when test="$emitmode='attribute'">
<
xsl:
apply-
templates select="attribute" mode="wrapped">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
when test="$passmode='code'">
<
xsl:
when test="$emitmode='method'">
<
xsl:
apply-
templates select="method" mode="code">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
when test="$emitmode='attribute'">
<
xsl:
apply-
templates select="attribute" mode="code">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
when test="$passmode = 'dtrace-probes'">
<
xsl:
when test="$emitmode = 'method'">
<
xsl:
apply-
templates select="method" mode="dtrace-probes">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
when test="$emitmode = 'attribute'">
<
xsl:
apply-
templates select="attribute" mode="dtrace-probes">
<
xsl:
with-
param name="target" select="$target"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
template match="if" mode="public">
<
xsl:
param name="emitmode"/>
<
xsl:
call-
template name="emitIf">
<
xsl:
with-
param name="passmode" select="'public'"/>
<
xsl:
with-
param name="target" select="@target"/>
<
xsl:
with-
param name="emitmode" select="$emitmode"/>
<
xsl:
template match="if" mode="wrapped">
<
xsl:
param name="emitmode"/>
<
xsl:
call-
template name="emitIf">
<
xsl:
with-
param name="passmode" select="'wrapped'"/>
<
xsl:
with-
param name="target" select="@target"/>
<
xsl:
with-
param name="emitmode" select="$emitmode"/>
<
xsl:
template match="if" mode="code">
<
xsl:
param name="topclass"/>
<
xsl:
param name="emitmode"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
call-
template name="emitIf">
<
xsl:
with-
param name="passmode" select="'code'"/>
<
xsl:
with-
param name="target" select="@target"/>
<
xsl:
with-
param name="emitmode" select="$emitmode"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
template match="if" mode="dtrace-probes">
<
xsl:
param name="topclass"/>
<
xsl:
param name="emitmode"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
call-
template name="emitIf">
<
xsl:
with-
param name="passmode" select="'dtrace-probes'"/>
<
xsl:
with-
param name="target" select="@target"/>
<
xsl:
with-
param name="emitmode" select="$emitmode"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all methods of the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitMethods">
<
xsl:
param name="topclass"/>
<
xsl:
param name="pmode"/>
<
xsl:
param name="dtracetopclass"/>
<!-- first recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $extends)">
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
when test="$pmode='code'">
<
xsl:
value-
of select="concat('// ', @name, ' methods')"/>
<
xsl:
when test="$pmode='dtrace-probes'"/>
<
xsl:
value-
of select="concat($G_sNewLine, ' // ', $pmode, ' ', @name, ' methods', $G_sNewLine)"/>
<
xsl:
when test="$pmode='public'">
<
xsl:
apply-
templates select="/method | /if" mode="public">
<
xsl:
with-
param name="emitmode" select="'method'"/>
<
xsl:
when test="$pmode='wrapped'">
<
xsl:
apply-
templates select="/method | /if" mode="wrapped">
<
xsl:
with-
param name="emitmode" select="'method'"/>
<
xsl:
when test="$pmode='code'">
<
xsl:
apply-
templates select="/method | /if" mode="code">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="emitmode" select="'method'"/>
<
xsl:
when test="$pmode='dtrace-probes'">
<
xsl:
apply-
templates select="/method | /if" mode="dtrace-probes">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="emitmode" select="'method'"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all attributes and methods declarations of the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitInterfaceDecls">
<
xsl:
param name="pmode"/>
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="pmode" select="$pmode"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit auxiliary method declarations of the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAuxMethodDecls">
<!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr --> <!-- - - - - - - - - - - - - - - - - - - - - - - emit the header file of the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitHeader">
<
xsl:
param name="addinterfaces"/>
<
xsl:
variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
<
xsl:
apply-
templates select="." mode="startfile">
<
xsl:
with-
param name="file" select="$filename"/>
<
xsl:
call-
template name="fileheader">
<
xsl:
with-
param name="name" select="$filename"/>
<
xsl:
with-
param name="class" select="substring(@name, 2)"/>
<
xsl:
with-
param name="type" select="'header'"/>
<
xsl:
apply-
templates select="." mode="classheader">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="pmode" select="'public'"/>
<
xsl:
for-
each select="exsl:node-set($addinterfaces)/token">
<!-- This is super tricky, as the for-each switches to the node set, which means the normal document isn't available any more. We get the data we need, uses a for-each to switch document and then a key() to look up the interface by name. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
for-
each select="$G_root">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $addifname)">
<
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="pmode" select="'public'"/>
<!-- auxiliary methods (public) --> <
xsl:
call-
template name="emitAuxMethodDecls"/>
<!-- switch to private --> <
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="pmode" select="'wrapped'"/>
<
xsl:
for-
each select="exsl:node-set($addinterfaces)/token">
<!-- This is super tricky, as the for-each switches to the node set, which means the normal document isn't available any more. We get the data we need, uses a for-each to switch document and then a key() to look up the interface by name. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
for-
each select="$G_root">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $addifname)">
<
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="pmode" select="'wrapped'"/>
<
xsl:
apply-
templates select="." mode="classfooter"/>
<
xsl:
apply-
templates select="." mode="endfile">
<
xsl:
with-
param name="file" select="$filename"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all attributes and methods definitions (pmode=code) or probes (pmode=dtrace-probes) of the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitInterfaceDefs">
<
xsl:
param name="addinterfaces"/>
<
xsl:
param name="pmode" select="'code'"/>
<
xsl:
variable name="topclass" select="substring(@name, 2)"/>
<
xsl:
variable name="dtracetopclass">
<
xsl:
when test="@dtracename"><
xsl:
value-
of select="@dtracename"/></
xsl:
when>
<
xsl:
otherwise><
xsl:
value-
of select="$topclass"/></
xsl:
otherwise>
<
xsl:
if test="$pmode = 'code'">
<
xsl:
value-
of select="concat('DEFINE_EMPTY_CTOR_DTOR(', $topclass, 'Wrap)', $G_sNewLine, $G_sNewLine)"/>
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
for-
each select="exsl:node-set($addinterfaces)/token">
<!-- This is super tricky, as the for-each switches to the node set, which means the normal document isn't available any more. We get the data we need, uses a for-each to switch document and then a key() to look up the interface by name. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
for-
each select="$G_root">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $addifname)">
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
call-
template name="xsltprocNewlineOutputHack"/>
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
for-
each select="exsl:node-set($addinterfaces)/token">
<!-- This is super tricky, as the for-each switches to the node set, which means the normal document isn't available any more. We get the data we need, uses a for-each to switch document and then a key() to look up the interface by name. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
for-
each select="$G_root">
<
xsl:
for-
each select="key('G_keyInterfacesByName', $addifname)">
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit auxiliary method declarations of the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAuxMethodDefs">
<
xsl:
param name="pmode" select="'code'"/>
<!-- currently nothing, maybe later some generic FinalConstruct/... implementation --> <!-- - - - - - - - - - - - - - - - - - - - - - - emit the code file of the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitCode">
<
xsl:
param name="addinterfaces"/>
<
xsl:
variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
<
xsl:
apply-
templates select="." mode="startfile">
<
xsl:
with-
param name="file" select="$filename"/>
<
xsl:
call-
template name="fileheader">
<
xsl:
with-
param name="name" select="$filename"/>
<
xsl:
with-
param name="class" select="substring(@name, 2)"/>
<
xsl:
with-
param name="type" select="'code'"/>
<
xsl:
apply-
templates select="." mode="codeheader">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
call-
template name="emitInterfaceDefs">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<!-- auxiliary methods (public) --> <
xsl:
call-
template name="emitAuxMethodDefs"/>
<
xsl:
apply-
templates select="." mode="codefooter">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
apply-
templates select="." mode="endfile">
<
xsl:
with-
param name="file" select="$filename"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit the DTrace probes for the current interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitDTraceProbes">
<
xsl:
param name="addinterfaces"/>
<
xsl:
call-
template name="emitInterfaceDefs">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
with-
param name="pmode">dtrace-probes</
xsl:
with-
param>
<!-- auxiliary methods (public) --> <
xsl:
call-
template name="emitAuxMethodDefs">
<
xsl:
with-
param name="pmode">dtrace-probes</
xsl:
with-
param>
<!-- - - - - - - - - - - - - - - - - - - - - - - wildcard match, ignore everything which has no explicit match - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="*"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - ignore all if tags except those for XPIDL or MIDL target - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="if">
<
xsl:
if test="(@target = 'xpidl') or (@target = 'midl')">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="interface">
<
xsl:
if test="not(@internal='yes') and not(@supportsErrorInfo='no')">
<
xsl:
call-
template name="emitInterface"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="library">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="/idl">
<
xsl:
when test="$generating = 'headers'">
<
xsl:
when test="$generating = 'sources'">
<
xsl:
when test="$generating = 'dtrace-probes'">
<
xsl:
message terminate="yes">
Unknown string parameter value: generating='<
xsl:
value-
of select="$generating"/>'
<!-- vi: set tabstop=4 shiftwidth=4 expandtab: -->