c1ec0862a43a7fbb25c5e1f3243f67c1f787d4ebvboxsync <
xsl:
value-
of select="string-length($option) > 0 and contains(concat(',', translate($optionlist, ' ', ''), ','), concat(',', $option, ','))"/>
<
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>
<!-- 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:
when test="//interface[@name=$type]">
<
xsl:
variable name="thatif" select="//interface[@name=$type]"/>
<
xsl:
variable name="thatifname" select="$thatif/@name"/>
<
xsl:
value-
of select="concat($thatifname, ' *')"/>
<
xsl:
when test="//enum[@name=$type]">
<
xsl:
value-
of select="concat($type, '_T')"/>
<
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>
<!-- 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:
when test="//interface[@name=$type]">
<
xsl:
variable name="thatif" select="//interface[@name=$type]"/>
<
xsl:
variable name="thatifname" select="$thatif/@name"/>
<
xsl:
if test="$dir='in' and not($safearray='yes')">
<
xsl:
text>const </
xsl:
text>
<
xsl:
value-
of select="concat('ComPtr<', $thatifname, '> &')"/>
<
xsl:
when test="//enum[@name=$type]">
<
xsl:
value-
of select="concat($type, '_T')"/>
<
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="//enum[@name=$type]">
<
xsl:
text>%RU32</
xsl:
text>
<
xsl:
when test="$type='$unknown'">
<
xsl:
when test="//interface[@name=$type]">
<
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="//enum[@name=$type]">
<!-- <xsl:value-of select="concat($type, '_T')"/> - later we can emit enums into dtrace the library --> <
xsl:
when test="$type='$unknown'">
<!-- <xsl:text>struct IUnknown *</xsl:text> --> <
xsl:
text>void *</
xsl:
text>
<
xsl:
when test="//interface[@name=$type]">
<xsl:variable name="thatif" select="//interface[@name=$type]"/> <xsl:variable name="thatifname" select="$thatif/@name"/> <xsl:value-of select="concat('struct ', $thatifname, ' *')"/> <
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 - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitInterface">
<
xsl:
param name="iface"/>
<
xsl:
when test="$generating != 'filelist'">
<!-- sources, headers and dtrace-probes all needs attribute lists --> <
xsl:
variable name="addinterfaces">
<
xsl:
call-
template name="getattrlist">
<
xsl:
with-
param name="val" select="$iface/@wrap-hint-server-addinterfaces"/>
<
xsl:
when test="$generating = 'sources'">
<
xsl:
call-
template name="emitCode">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
when test="$generating = 'headers'">
<
xsl:
call-
template name="emitHeader">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
when test="$generating = 'dtrace-probes'">
<
xsl:
call-
template name="emitDTraceProbes">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
when test="$generating = 'filelist'">
<
xsl:
value-
of select="concat('	', substring(@name, 2), 'Wrap.h \', $G_sNewLine)"/>
<
xsl:
value-
of select="concat('	', substring(@name, 2), 'Wrap.cpp \', $G_sNewLine)"/>
<
xsl:
template match="attribute/@type | param/@type" mode="public">
<
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:
if test="../@safearray='yes'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayIn(</
xsl:
text>
<
xsl:
text>ComSafeArrayOut(</
xsl:
text>
<
xsl:
value-
of select="$gluetype"/>
<
xsl:
when test="../@safearray='yes'">
<
xsl:
if test="substring($gluetype,string-length($gluetype))!='*'">
<
xsl:
when test="$dir='in'">
<
xsl:
value-
of select="'*'"/>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
value-
of select="')'"/>
<
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:
when test="../@safearray='yes'">
<
xsl:
if test="$dir='in'">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>std::vector<</
xsl:
text>
<
xsl:
when test="substring($wraptype,string-length($wraptype))='&'">
<
xsl:
variable name="wraptype2">
<
xsl:
value-
of select="substring($wraptype,1,string-length($wraptype)-2)"/>
<
xsl:
when test="substring($wraptype2,string-length($wraptype2))='>'">
<
xsl:
value-
of select="concat($wraptype2, ' ')"/>
<
xsl:
value-
of select="$wraptype2"/>
<
xsl:
when test="substring($wraptype,string-length($wraptype))='>'">
<
xsl:
value-
of select="concat($wraptype, ' ')"/>
<
xsl:
value-
of select="$wraptype"/>
<
xsl:
text>> &</
xsl:
text>
<
xsl:
value-
of select="$wraptype"/>
<
xsl:
if test="substring($wraptype,string-length($wraptype))!='&'">
<
xsl:
if test="substring($wraptype,string-length($wraptype))!='*'">
<
xsl:
when test="$dir='in'">
<
xsl:
value-
of select="'*'"/>
<
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'">
<
xsl:
template match="attribute/@type | param/@type" mode="dtraceparamval">
<
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:
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:
variable name="thatif" select="//interface[@name=$type]"/>
<
xsl:
when test="$thatif">
<
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 dtraceparamval except no temporary variables are used (they are out of scope). --> <
xsl:
template match="attribute/@type | param/@type" mode="dtraceparamvalnotmp">
<
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:
if test="../@safearray = 'yes'">
<
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>
<
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' or ../@safearray = 'yes'">
<!-- Micro optimizations: Postpone calculating $thatif. --> <
xsl:
variable name="thatif" select="//interface[@name=$type]"/>
<!-- 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>
<!-- Micro optimizations: Delay calculating thatif. --> <
xsl:
variable name="thatif" select="//interface[@name=$type]"/>
<
xsl:
when test="$thatif">
<
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:
variable name="thatifname" select="$thatif/@name"/>
<
xsl:
value-
of select="concat('<', $thatifname, '>')"/>
<
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:
variable name="thatif" select="//interface[@name=$type]"/>
<
xsl:
text>.ptr()</
xsl:
text>
<
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:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
if test="not(@readonly) or @readonly!='yes'">
<
xsl:
value-
of select="concat(' STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
<
xsl:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'in'"/>
<
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:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'out'"/>
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:
apply-
templates select="@type" mode="dtraceparamval">
<
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:
apply-
templates select="@type" mode="dtraceparamvalnotmp">
<
xsl:
with-
param name="dir">out</
xsl:
with-
param>
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:
apply-
templates select="@type" mode="dtraceparamvalnotmp">
<
xsl:
with-
param name="dir">out</
xsl:
with-
param>
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:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'in'"/>
<!-- @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:
apply-
templates select="@type" mode="dtraceparamval">
<
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:
apply-
templates select="@type" mode="dtraceparamval">
<
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:
apply-
templates select="@type" mode="dtraceparamvalnotmp">
<
xsl:
with-
param name="dir">in</
xsl:
with-
param>
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:
apply-
templates select="@type" mode="dtraceparamvalnotmp">
<
xsl:
with-
param name="dir">in</
xsl:
with-
param>
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"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAttributes">
<
xsl:
param name="iface"/>
<
xsl:
param name="topclass"/>
<
xsl:
param name="dtracetopclass"/>
<
xsl:
param name="pmode"/>
<!-- first recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="$iface/@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="iface" select="//interface[@name=$extends]"/>
<
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('// ', $iface/@name, ' properties')"/>
<
xsl:
when test="$pmode = 'dtrace-probes'">
<
xsl:
value-
of select="concat($G_sNewLine, ' // ', $pmode, ' ', $iface/@name, ' properties', $G_sNewLine)"/>
<
xsl:
when test="$pmode='public'">
<
xsl:
with-
param name="emitmode" select="'attribute'"/>
<
xsl:
when test="$pmode='wrapped'">
<
xsl:
with-
param name="emitmode" select="'attribute'"/>
<
xsl:
when test="$pmode='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:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="emitmode" select="'attribute'"/>
<
xsl:
template name="emitTargetBegin">
<
xsl:
param name="target"/>
<
xsl:
when test="$target = 'xpidl'">
<
xsl:
text>#ifdef VBOX_WITH_XPCOM
<
xsl:
when test="$target = 'midl'">
<
xsl:
text>#ifndef VBOX_WITH_XPCOM
<
xsl:
template name="emitTargetEnd">
<
xsl:
param name="target"/>
<
xsl:
when test="$target = 'xpidl'">
<
xsl:
text>#endif /* VBOX_WITH_XPCOM */
<
xsl:
when test="$target = 'midl'">
<
xsl:
text>#endif /* !VBOX_WITH_XPCOM */
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
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:
apply-
templates select="@type" mode="public">
<
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:
apply-
templates select="@type" mode="public">
<
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:
apply-
templates select="@type" mode="dtraceparamval">
<
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:
apply-
templates select="@type" mode="dtraceparamval">
<
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:
apply-
templates select="@type" mode="dtraceparamvalnotmp">
<
xsl:
with-
param name="dir" select="@dir"/>
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:
apply-
templates select="@type" mode="dtraceparamvalnotmp">
<
xsl:
with-
param name="dir" select="@dir"/>
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="$generating != 'filelist'">
<
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 an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitMethods">
<
xsl:
param name="iface"/>
<
xsl:
param name="topclass"/>
<
xsl:
param name="pmode"/>
<
xsl:
param name="dtracetopclass"/>
<!-- first recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="$iface/@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="iface" select="//interface[@name=$extends]"/>
<
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('// ', $iface/@name, ' methods')"/>
<
xsl:
when test="$pmode='dtrace-probes'"/>
<
xsl:
value-
of select="concat($G_sNewLine, ' // ', $pmode, ' ', $iface/@name, ' methods', $G_sNewLine)"/>
<
xsl:
when test="$pmode='public'">
<
xsl:
with-
param name="emitmode" select="'method'"/>
<
xsl:
when test="$pmode='wrapped'">
<
xsl:
with-
param name="emitmode" select="'method'"/>
<
xsl:
when test="$pmode='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:
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 an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitInterfaceDecls">
<
xsl:
param name="iface"/>
<
xsl:
param name="pmode"/>
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit auxiliary method declarations of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAuxMethodDecls">
<
xsl:
param name="iface"/>
<!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr --> <!-- - - - - - - - - - - - - - - - - - - - - - - emit the header file of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitHeader">
<
xsl:
param name="iface"/>
<
xsl:
param name="addinterfaces"/>
<
xsl:
if test="$generating != 'headers'">
<!-- Paranoia --> <
xsl:
message terminate="yes">
Did not expect generating='<
xsl:
value-
of select="$generating"/>' in the emitHeader template.
<
xsl:
variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
<
xsl:
apply-
templates select="$iface" 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="$iface" mode="classheader">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="iface" select="$iface"/>
<
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. So need to use the global root node to get back into the documemt to find corresponding interface data. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="iface" select="$G_root//interface[@name=$addifname]"/>
<
xsl:
with-
param name="pmode" select="'public'"/>
<!-- auxiliary methods (public) --> <
xsl:
call-
template name="emitAuxMethodDecls">
<
xsl:
with-
param name="iface" select="$iface"/>
<!-- switch to private --> <
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="iface" select="$iface"/>
<
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. So need to use the global root node to get back into the documemt to find corresponding interface data. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="iface" select="$G_root//interface[@name=$addifname]"/>
<
xsl:
with-
param name="pmode" select="'wrapped'"/>
<
xsl:
apply-
templates select="$iface" mode="classfooter"/>
<
xsl:
apply-
templates select="$iface" mode="endfile">
<
xsl:
with-
param name="file" select="$filename"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all attributes and methods definitions (pmode=code) or probes (pmode=dtrace-probes) of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitInterfaceDefs">
<
xsl:
param name="iface"/>
<
xsl:
param name="addinterfaces"/>
<
xsl:
param name="pmode" select="'code'"/>
<
xsl:
if test="$pmode = 'code'">
<
xsl:
value-
of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap)', $G_sNewLine, $G_sNewLine)"/>
<
xsl:
variable name="dtracetopclass">
<
xsl:
when test="$iface/@dtracename"><
xsl:
value-
of select="$iface/@dtracename"/></
xsl:
when>
<
xsl:
otherwise><
xsl:
value-
of select="substring($iface/@name, 2)"/></
xsl:
otherwise>
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="topclass" select="substring($iface/@name, 2)"/>
<
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. So need to use the global root node to get back into the documemt to find corresponding interface data. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="iface" select="$G_root//interface[@name=$addifname]"/>
<
xsl:
with-
param name="topclass" select="substring($iface/@name, 2)"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="topclass" select="substring($iface/@name, 2)"/>
<
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. So need to use the global root node to get back into the documemt to find corresponding interface data. --> <
xsl:
variable name="addifname">
<
xsl:
value-
of select="string(.)"/>
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="iface" select="$G_root//interface[@name=$addifname]"/>
<
xsl:
with-
param name="topclass" select="substring($iface/@name, 2)"/>
<
xsl:
with-
param name="dtracetopclass" select="$dtracetopclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit auxiliary method declarations of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAuxMethodDefs">
<
xsl:
param name="iface"/>
<
xsl:
param name="pmode" select="'code'"/>
<!-- currently nothing, maybe later some generic FinalConstruct/... implementation --> <!-- - - - - - - - - - - - - - - - - - - - - - - emit the code file of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitCode">
<
xsl:
param name="iface"/>
<
xsl:
param name="addinterfaces"/>
<
xsl:
if test="$generating != 'sources'">
<!-- Paranoia --> <
xsl:
message terminate="yes">
Did not expect generating='<
xsl:
value-
of select="$generating"/>' in the emitCode template.
<
xsl:
variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
<
xsl:
apply-
templates select="$iface" 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="$iface" mode="codeheader">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
call-
template name="emitInterfaceDefs">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<!-- auxiliary methods (public) --> <
xsl:
call-
template name="emitAuxMethodDefs">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
apply-
templates select="$iface" mode="codefooter">
<
xsl:
with-
param name="addinterfaces" select="$addinterfaces"/>
<
xsl:
apply-
templates select="$iface" mode="endfile">
<
xsl:
with-
param name="file" select="$filename"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit the DTrace probes for an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitDTraceProbes">
<
xsl:
param name="iface"/>
<
xsl:
param name="addinterfaces"/>
<
xsl:
if test="$generating != 'dtrace-probes'">
<!-- Paranoia --> <
xsl:
message terminate="yes">
Did not expect generating='<
xsl:
value-
of select="$generating"/>' in the emitDTraceProbes template.
<
xsl:
call-
template name="emitInterfaceDefs">
<
xsl:
with-
param name="iface" select="$iface"/>
<
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="iface" select="$iface"/>
<
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:
with-
param name="iface" select="."/>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="library">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="/idl">
<
xsl:
when test="$generating = 'filelist'">
<
xsl:
value-
of select="concat($filelistonly, ' := \', $G_sNewLine)"/>
<
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: -->