Changeset 53903 in vbox for trunk/src/VBox/Main/idl
- Timestamp:
- Jan 21, 2015 4:58:34 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/apiwrap-server.xsl
r53886 r53903 47 47 48 48 <xsl:include href="typemap-shared.inc.xsl"/> 49 50 <!-- - - - - - - - - - - - - - - - - - - - - - - 51 keys for more efficiently looking up types. 52 - - - - - - - - - - - - - - - - - - - - - - --> 53 54 <xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/> 55 <xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/> 56 49 57 50 58 <!-- - - - - - - - - - - - - - - - - - - - - - - … … 98 106 </xsl:template> 99 107 108 <!-- Emits COM_INTERFACE_ENTRY statements for the current interface node and whatever it inherits from. --> 100 109 <xsl:template name="emitCOMInterfaces"> 101 <xsl:param name="iface"/> 102 103 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $iface/@name, ')' , $G_sNewLine)"/> 110 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', @name, ')' , $G_sNewLine)"/> 104 111 <!-- now recurse to emit all base interfaces --> 105 <xsl:variable name="extends" select=" $iface/@extends"/>112 <xsl:variable name="extends" select="@extends"/> 106 113 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')"> 107 <xsl: call-template name="emitCOMInterfaces">108 <xsl: with-param name="iface" select="//interface[@name=$extends]"/>109 </xsl: call-template>114 <xsl:for-each select="key('G_keyInterfacesByName', $extends)"> 115 <xsl:call-template name="emitCOMInterfaces"/> 116 </xsl:for-each> 110 117 </xsl:if> 111 118 </xsl:template> … … 150 157 <xsl:text> COM_INTERFACE_ENTRY(ISupportErrorInfo) 151 158 </xsl:text> 152 <xsl:call-template name="emitCOMInterfaces"> 153 <xsl:with-param name="iface" select="."/> 154 </xsl:call-template> 159 <xsl:call-template name="emitCOMInterfaces"/> 155 160 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')', $G_sNewLine)"/> 156 161 <xsl:variable name="manualAddInterfaces"> … … 162 167 <xsl:if test="not($manualAddInterfaces = 'true')"> 163 168 <xsl:for-each select="exsl:node-set($addinterfaces)/token"> 164 <!-- This is super tricky, as the for-each switches to the node 165 set, which means the normal document isn't available any more.166 So need to use the global root node to get back into the167 documemt to find corresponding interface data. -->169 <!-- This is super tricky, as the for-each switches to the node set, 170 which means the normal document isn't available any more. We get 171 the data we need, uses a for-each to switch document and then a 172 key() to look up the interface by name. --> 168 173 <xsl:variable name="addifname"> 169 174 <xsl:value-of select="string(.)"/> 170 175 </xsl:variable> 171 <xsl:call-template name="emitCOMInterfaces"> 172 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/> 173 </xsl:call-template> 176 <xsl:for-each select="$G_root"> 177 <xsl:for-each select="key('G_keyInterfacesByName', $addifname)"> 178 <xsl:call-template name="emitCOMInterfaces"/> 179 </xsl:for-each> 180 </xsl:for-each> 174 181 </xsl:for-each> 175 182 </xsl:if> … … 210 217 <xsl:choose> 211 218 <xsl:when test="$extends and not($extends='$unknown') and not($extends='$errorinfo')"> 212 <xsl:variable name="newextends" select=" //interface[@name=$extends]/@extends"/>219 <xsl:variable name="newextends" select="key('G_keyInterfacesByName', $extends)/@extends"/> 213 220 <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $extends)"/> 214 221 <xsl:call-template name="emitISupports"> … … 225 232 <xsl:when test="count($addinterfaces_ns/token) > 0"> 226 233 <xsl:variable name="addifname" select="$addinterfaces_ns/token[1]"/> 227 <xsl:variable name="addif" select=" //interface[@name=$addifname]/@extends"/>234 <xsl:variable name="addif" select="key('G_keyInterfacesByName', $addifname)/@extends"/> 228 235 <xsl:variable name="newextends" select="$addif/@extends"/> 229 236 <xsl:variable name="newaddinterfaces" select="$addinterfaces_ns/token[position() > 1]"/> … … 346 353 </xsl:when> 347 354 348 <xsl:when test="//interface[@name=$type]"> 349 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 350 <xsl:variable name="thatifname" select="$thatif/@name"/> 351 <xsl:value-of select="concat($thatifname, ' *')"/> 352 </xsl:when> 353 354 <xsl:when test="//enum[@name=$type]"> 355 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 356 <xsl:value-of select="concat($type, ' *')"/> 357 </xsl:when> 358 359 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0"> 355 360 <xsl:value-of select="concat($type, '_T')"/> 356 361 </xsl:when> … … 406 411 </xsl:when> 407 412 408 <xsl:when test="//interface[@name=$type]"> 409 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 410 <xsl:variable name="thatifname" select="$thatif/@name"/> 413 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 411 414 <xsl:if test="$dir='in' and not($safearray='yes')"> 412 415 <xsl:text>const </xsl:text> 413 416 </xsl:if> 414 <xsl:value-of select="concat('ComPtr<', $t hatifname, '> &')"/>415 </xsl:when> 416 417 <xsl:when test=" //enum[@name=$type]">417 <xsl:value-of select="concat('ComPtr<', $type, '> &')"/> 418 </xsl:when> 419 420 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0"> 418 421 <xsl:value-of select="concat($type, '_T')"/> 419 422 </xsl:when> … … 451 454 <xsl:value-of select="$wrapfmt"/> 452 455 </xsl:when> 453 <xsl:when test="//enum[@name=$type]">454 <xsl:text>%RU32</xsl:text>455 </xsl:when>456 456 <xsl:when test="$type='$unknown'"> 457 457 <xsl:text>%p</xsl:text> 458 458 </xsl:when> 459 <xsl:when test="//interface[@name=$type]"> 459 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0"> 460 <xsl:text>%RU32</xsl:text> 461 </xsl:when> 462 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 460 463 <xsl:text>%p</xsl:text> 461 464 </xsl:when> … … 483 486 <xsl:text>void *</xsl:text> 484 487 </xsl:when> 485 <xsl:when test=" //enum[@name=$type]">488 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0"> 486 489 <!-- <xsl:value-of select="concat($type, '_T')"/> - later we can emit enums into dtrace the library --> 487 490 <xsl:text>int</xsl:text> 488 491 </xsl:when> 489 <xsl:when test=" //interface[@name=$type]">492 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 490 493 <!-- 491 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 492 <xsl:variable name="thatifname" select="$thatif/@name"/> 493 <xsl:value-of select="concat('struct ', $thatifname, ' *')"/> 494 <xsl:value-of select="concat('struct ', $type, ' *')"/> 494 495 --> 495 496 <xsl:text>void *</xsl:text> … … 511 512 - - - - - - - - - - - - - - - - - - - - - - --> 512 513 514 <!-- Called on interface node. --> 513 515 <xsl:template name="emitInterface"> 514 <xsl:param name="iface"/>515 516 516 <xsl:choose> 517 517 <xsl:when test="$generating != 'filelist'"> … … 519 519 <xsl:variable name="addinterfaces"> 520 520 <xsl:call-template name="getattrlist"> 521 <xsl:with-param name="val" select=" $iface/@wrap-hint-server-addinterfaces"/>521 <xsl:with-param name="val" select="@wrap-hint-server-addinterfaces"/> 522 522 </xsl:call-template> 523 523 </xsl:variable> 524 524 525 <xsl:choose> 525 526 <xsl:when test="$generating = 'sources'"> 526 527 <xsl:call-template name="emitCode"> 527 <xsl:with-param name="iface" select="$iface"/>528 528 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 529 529 </xsl:call-template> … … 531 531 <xsl:when test="$generating = 'headers'"> 532 532 <xsl:call-template name="emitHeader"> 533 <xsl:with-param name="iface" select="$iface"/>534 533 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 535 534 </xsl:call-template> … … 537 536 <xsl:when test="$generating = 'dtrace-probes'"> 538 537 <xsl:call-template name="emitDTraceProbes"> 539 <xsl:with-param name="iface" select="$iface"/>540 538 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 541 539 </xsl:call-template> … … 750 748 <xsl:text>.ptr()</xsl:text> 751 749 </xsl:when> 750 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 751 <xsl:text>(void *)</xsl:text> 752 <xsl:value-of select="$tmpname"/> 753 <xsl:text>.ptr()</xsl:text> 754 </xsl:when> 752 755 <xsl:otherwise> 753 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 754 <xsl:choose> 755 <xsl:when test="$thatif"> 756 <xsl:text>(void *)</xsl:text> 757 <xsl:value-of select="$tmpname"/> 758 <xsl:text>.ptr()</xsl:text> 759 </xsl:when> 760 <xsl:otherwise> 761 <xsl:value-of select="$tmpname"/> 762 </xsl:otherwise> 763 </xsl:choose> 756 <xsl:value-of select="$tmpname"/> 764 757 </xsl:otherwise> 765 758 </xsl:choose> … … 867 860 <xsl:text>yes</xsl:text> 868 861 </xsl:when> 869 <!-- Micro optimizations: Postpone calculating $thatif. --> 870 <xsl:when test="$type = 'boolean' or $type = 'long' or $type = 'long' or $type = 'long long'"/> 871 <xsl:otherwise> 872 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 873 <xsl:if test="$thatif"> 874 <xsl:text>yes</xsl:text> 875 </xsl:if> 876 </xsl:otherwise> 862 <xsl:when test="$type = 'boolean' or $type = 'long' or $type = 'long' or $type = 'long long'"/> <!-- XXX: drop this? --> 863 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 864 <xsl:text>yes</xsl:text> 865 </xsl:when> 877 866 </xsl:choose> 878 867 </xsl:template> … … 926 915 </xsl:when> 927 916 928 <!-- Micro optimizations: Delay calculating thatif. --> 929 <xsl:otherwise> 930 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 917 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 918 <xsl:if test="../@safearray='yes'"> 919 <xsl:text>Array</xsl:text> 920 </xsl:if> 931 921 <xsl:choose> 932 <xsl:when test="$thatif"> 933 <xsl:if test="../@safearray='yes'"> 934 <xsl:text>Array</xsl:text> 935 </xsl:if> 936 <xsl:choose> 937 <xsl:when test="$dir='in'"> 938 <xsl:text>ComTypeInConverter</xsl:text> 939 </xsl:when> 940 <xsl:otherwise> 941 <xsl:text>ComTypeOutConverter</xsl:text> 942 </xsl:otherwise> 943 </xsl:choose> 944 <xsl:variable name="thatifname" select="$thatif/@name"/> 945 <xsl:value-of select="concat('<', $thatifname, '>')"/> 946 </xsl:when> 947 948 <xsl:when test="../@safearray='yes'"> 949 <xsl:text>Array</xsl:text> 950 <xsl:choose> 951 <xsl:when test="$dir='in'"> 952 <xsl:text>InConverter</xsl:text> 953 </xsl:when> 954 <xsl:otherwise> 955 <xsl:text>OutConverter</xsl:text> 956 </xsl:otherwise> 957 </xsl:choose> 958 <xsl:variable name="gluetype"> 959 <xsl:call-template name="translatepublictype"> 960 <xsl:with-param name="type" select="."/> 961 <xsl:with-param name="dir" select="$dir"/> 962 <xsl:with-param name="mod" select="../@mod"/> 963 </xsl:call-template> 964 </xsl:variable> 965 <xsl:value-of select="concat('<', $gluetype, '>')"/> 966 </xsl:when> 922 <xsl:when test="$dir='in'"> 923 <xsl:text>ComTypeInConverter</xsl:text> 924 </xsl:when> 925 <xsl:otherwise> 926 <xsl:text>ComTypeOutConverter</xsl:text> 927 </xsl:otherwise> 967 928 </xsl:choose> 968 </xsl:otherwise> 929 <xsl:value-of select="concat('<', $type, '>')"/> 930 </xsl:when> 931 932 <xsl:when test="../@safearray='yes'"> 933 <xsl:text>Array</xsl:text> 934 <xsl:choose> 935 <xsl:when test="$dir='in'"> 936 <xsl:text>InConverter</xsl:text> 937 </xsl:when> 938 <xsl:otherwise> 939 <xsl:text>OutConverter</xsl:text> 940 </xsl:otherwise> 941 </xsl:choose> 942 <xsl:variable name="gluetype"> 943 <xsl:call-template name="translatepublictype"> 944 <xsl:with-param name="type" select="."/> 945 <xsl:with-param name="dir" select="$dir"/> 946 <xsl:with-param name="mod" select="../@mod"/> 947 </xsl:call-template> 948 </xsl:variable> 949 <xsl:value-of select="concat('<', $gluetype, '>')"/> 950 </xsl:when> 969 951 </xsl:choose> 970 952 </xsl:template> … … 1040 1022 <xsl:text>.ptr()</xsl:text> 1041 1023 </xsl:when> 1024 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0"> 1025 <xsl:text>.ptr()</xsl:text> 1026 </xsl:when> 1042 1027 <xsl:otherwise> 1043 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 1044 <xsl:if test="$thatif"> 1045 <xsl:text>.ptr()</xsl:text> 1046 </xsl:if> 1028 <xsl:message terminate="yes">Oops #1</xsl:message> 1047 1029 </xsl:otherwise> 1048 1030 </xsl:choose> … … 1497 1479 1498 1480 <!-- - - - - - - - - - - - - - - - - - - - - - - 1499 emit all attributes of an interface1481 Emit all attributes of an interface (current node). 1500 1482 - - - - - - - - - - - - - - - - - - - - - - --> 1501 1483 <xsl:template name="emitAttributes"> 1502 <xsl:param name="iface"/>1503 1484 <xsl:param name="topclass"/> 1504 1485 <xsl:param name="dtracetopclass"/> … … 1506 1487 1507 1488 <!-- first recurse to emit all base interfaces --> 1508 <xsl:variable name="extends" select=" $iface/@extends"/>1489 <xsl:variable name="extends" select="@extends"/> 1509 1490 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')"> 1510 <xsl:call-template name="emitAttributes"> 1511 <xsl:with-param name="iface" select="//interface[@name=$extends]"/> 1512 <xsl:with-param name="topclass" select="$topclass"/> 1513 <xsl:with-param name="pmode" select="$pmode"/> 1514 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 1515 </xsl:call-template> 1491 <xsl:for-each select="key('G_keyInterfacesByName', $extends)"> 1492 <xsl:call-template name="emitAttributes"> 1493 <xsl:with-param name="topclass" select="$topclass"/> 1494 <xsl:with-param name="pmode" select="$pmode"/> 1495 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 1496 </xsl:call-template> 1497 </xsl:for-each> 1516 1498 </xsl:if> 1517 1499 … … 1520 1502 <xsl:text>// 1521 1503 </xsl:text> 1522 <xsl:value-of select="concat('// ', $iface/@name, ' properties')"/>1504 <xsl:value-of select="concat('// ', @name, ' properties')"/> 1523 1505 <xsl:text> 1524 1506 // … … 1529 1511 </xsl:when> 1530 1512 <xsl:otherwise> 1531 <xsl:value-of select="concat($G_sNewLine, ' // ', $pmode, ' ', $iface/@name, ' properties', $G_sNewLine)"/>1513 <xsl:value-of select="concat($G_sNewLine, ' // ', $pmode, ' ', @name, ' properties', $G_sNewLine)"/> 1532 1514 </xsl:otherwise> 1533 1515 </xsl:choose> 1534 1516 <xsl:choose> 1535 1517 <xsl:when test="$pmode='public'"> 1536 <xsl:apply-templates select=" $iface/attribute | $iface/if" mode="public">1518 <xsl:apply-templates select="./attribute | ./if" mode="public"> 1537 1519 <xsl:with-param name="emitmode" select="'attribute'"/> 1538 1520 </xsl:apply-templates> 1539 1521 </xsl:when> 1540 1522 <xsl:when test="$pmode='wrapped'"> 1541 <xsl:apply-templates select=" $iface/attribute | $iface/if" mode="wrapped">1523 <xsl:apply-templates select="./attribute | ./if" mode="wrapped"> 1542 1524 <xsl:with-param name="emitmode" select="'attribute'"/> 1543 1525 </xsl:apply-templates> 1544 1526 </xsl:when> 1545 1527 <xsl:when test="$pmode='code'"> 1546 <xsl:apply-templates select=" $iface/attribute | $iface/if" mode="code">1528 <xsl:apply-templates select="./attribute | ./if" mode="code"> 1547 1529 <xsl:with-param name="topclass" select="$topclass"/> 1548 1530 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> … … 1551 1533 </xsl:when> 1552 1534 <xsl:when test="$pmode = 'dtrace-probes'"> 1553 <xsl:apply-templates select=" $iface/attribute | $iface/if" mode="dtrace-probes">1535 <xsl:apply-templates select="./attribute | ./if" mode="dtrace-probes"> 1554 1536 <xsl:with-param name="topclass" select="$topclass"/> 1555 1537 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> … … 2112 2094 2113 2095 <!-- - - - - - - - - - - - - - - - - - - - - - - 2114 emit all methods of aninterface2096 emit all methods of the current interface 2115 2097 - - - - - - - - - - - - - - - - - - - - - - --> 2116 2098 <xsl:template name="emitMethods"> 2117 <xsl:param name="iface"/>2118 2099 <xsl:param name="topclass"/> 2119 2100 <xsl:param name="pmode"/> … … 2121 2102 2122 2103 <!-- first recurse to emit all base interfaces --> 2123 <xsl:variable name="extends" select=" $iface/@extends"/>2104 <xsl:variable name="extends" select="@extends"/> 2124 2105 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')"> 2125 <xsl:call-template name="emitMethods"> 2126 <xsl:with-param name="iface" select="//interface[@name=$extends]"/> 2127 <xsl:with-param name="topclass" select="$topclass"/> 2128 <xsl:with-param name="pmode" select="$pmode"/> 2129 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2130 </xsl:call-template> 2106 <xsl:for-each select="key('G_keyInterfacesByName', $extends)"> 2107 <xsl:call-template name="emitMethods"> 2108 <xsl:with-param name="topclass" select="$topclass"/> 2109 <xsl:with-param name="pmode" select="$pmode"/> 2110 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2111 </xsl:call-template> 2112 </xsl:for-each> 2131 2113 </xsl:if> 2132 2114 … … 2135 2117 <xsl:text>// 2136 2118 </xsl:text> 2137 <xsl:value-of select="concat('// ', $iface/@name, ' methods')"/>2119 <xsl:value-of select="concat('// ', @name, ' methods')"/> 2138 2120 <xsl:text> 2139 2121 // … … 2143 2125 <xsl:when test="$pmode='dtrace-probes'"/> 2144 2126 <xsl:otherwise> 2145 <xsl:value-of select="concat($G_sNewLine, ' // ', $pmode, ' ', $iface/@name, ' methods', $G_sNewLine)"/>2127 <xsl:value-of select="concat($G_sNewLine, ' // ', $pmode, ' ', @name, ' methods', $G_sNewLine)"/> 2146 2128 </xsl:otherwise> 2147 2129 </xsl:choose> 2148 2130 <xsl:choose> 2149 2131 <xsl:when test="$pmode='public'"> 2150 <xsl:apply-templates select=" $iface/method | $iface/if" mode="public">2132 <xsl:apply-templates select="./method | ./if" mode="public"> 2151 2133 <xsl:with-param name="emitmode" select="'method'"/> 2152 2134 </xsl:apply-templates> 2153 2135 </xsl:when> 2154 2136 <xsl:when test="$pmode='wrapped'"> 2155 <xsl:apply-templates select=" $iface/method | $iface/if" mode="wrapped">2137 <xsl:apply-templates select="./method | ./if" mode="wrapped"> 2156 2138 <xsl:with-param name="emitmode" select="'method'"/> 2157 2139 </xsl:apply-templates> 2158 2140 </xsl:when> 2159 2141 <xsl:when test="$pmode='code'"> 2160 <xsl:apply-templates select=" $iface/method | $iface/if" mode="code">2142 <xsl:apply-templates select="./method | ./if" mode="code"> 2161 2143 <xsl:with-param name="topclass" select="$topclass"/> 2162 2144 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> … … 2165 2147 </xsl:when> 2166 2148 <xsl:when test="$pmode='dtrace-probes'"> 2167 <xsl:apply-templates select=" $iface/method | $iface/if" mode="dtrace-probes">2149 <xsl:apply-templates select="./method | ./if" mode="dtrace-probes"> 2168 2150 <xsl:with-param name="topclass" select="$topclass"/> 2169 2151 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> … … 2176 2158 2177 2159 <!-- - - - - - - - - - - - - - - - - - - - - - - 2178 emit all attributes and methods declarations of aninterface2160 emit all attributes and methods declarations of the current interface 2179 2161 - - - - - - - - - - - - - - - - - - - - - - --> 2180 2162 <xsl:template name="emitInterfaceDecls"> 2181 <xsl:param name="iface"/>2182 2163 <xsl:param name="pmode"/> 2183 2164 2184 2165 <!-- attributes --> 2185 2166 <xsl:call-template name="emitAttributes"> 2186 <xsl:with-param name="iface" select="$iface"/>2187 2167 <xsl:with-param name="pmode" select="$pmode"/> 2188 2168 </xsl:call-template> … … 2190 2170 <!-- methods --> 2191 2171 <xsl:call-template name="emitMethods"> 2192 <xsl:with-param name="iface" select="$iface"/>2193 2172 <xsl:with-param name="pmode" select="$pmode"/> 2194 2173 </xsl:call-template> … … 2196 2175 2197 2176 <!-- - - - - - - - - - - - - - - - - - - - - - - 2198 emit auxiliary method declarations of aninterface2177 emit auxiliary method declarations of the current interface 2199 2178 - - - - - - - - - - - - - - - - - - - - - - --> 2200 2179 <xsl:template name="emitAuxMethodDecls"> 2201 <xsl:param name="iface"/>2202 2180 <!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr --> 2203 2181 </xsl:template> 2204 2182 2205 2183 <!-- - - - - - - - - - - - - - - - - - - - - - - 2206 emit the header file of aninterface2184 emit the header file of the current interface 2207 2185 - - - - - - - - - - - - - - - - - - - - - - --> 2208 2186 <xsl:template name="emitHeader"> 2209 <xsl:param name="iface"/>2210 2187 <xsl:param name="addinterfaces"/> 2211 2188 2212 <xsl:if test="$generating != 'headers'"> <!-- Paranoia -->2213 <xsl:message terminate="yes">2214 Did not expect generating='<xsl:value-of select="$generating"/>' in the emitHeader template.2215 </xsl:message>2216 </xsl:if>2217 2218 2189 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/> 2219 2190 2220 <xsl:apply-templates select=" $iface" mode="startfile">2191 <xsl:apply-templates select="." mode="startfile"> 2221 2192 <xsl:with-param name="file" select="$filename"/> 2222 2193 </xsl:apply-templates> … … 2226 2197 <xsl:with-param name="type" select="'header'"/> 2227 2198 </xsl:call-template> 2228 <xsl:apply-templates select=" $iface" mode="classheader">2199 <xsl:apply-templates select="." mode="classheader"> 2229 2200 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 2230 2201 </xsl:apply-templates> … … 2232 2203 <!-- interface attributes/methods (public) --> 2233 2204 <xsl:call-template name="emitInterfaceDecls"> 2234 <xsl:with-param name="iface" select="$iface"/>2235 2205 <xsl:with-param name="pmode" select="'public'"/> 2236 2206 </xsl:call-template> 2237 2207 2238 2208 <xsl:for-each select="exsl:node-set($addinterfaces)/token"> 2239 <!-- This is super tricky, as the for-each switches to the node 2240 set, which means the normal document isn't available any2241 more. So need to use the global root node to get back into2242 the documemt to find corresponding interface data. -->2209 <!-- This is super tricky, as the for-each switches to the node set, 2210 which means the normal document isn't available any more. We get 2211 the data we need, uses a for-each to switch document and then a 2212 key() to look up the interface by name. --> 2243 2213 <xsl:variable name="addifname"> 2244 2214 <xsl:value-of select="string(.)"/> 2245 2215 </xsl:variable> 2246 <xsl:call-template name="emitInterfaceDecls"> 2247 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/> 2248 <xsl:with-param name="pmode" select="'public'"/> 2249 </xsl:call-template> 2216 <xsl:for-each select="$G_root"> 2217 <xsl:for-each select="key('G_keyInterfacesByName', $addifname)"> 2218 <xsl:call-template name="emitInterfaceDecls"> 2219 <xsl:with-param name="pmode" select="'public'"/> 2220 </xsl:call-template> 2221 </xsl:for-each> 2222 </xsl:for-each> 2250 2223 </xsl:for-each> 2251 2224 2252 2225 <!-- auxiliary methods (public) --> 2253 <xsl:call-template name="emitAuxMethodDecls"> 2254 <xsl:with-param name="iface" select="$iface"/> 2255 </xsl:call-template> 2226 <xsl:call-template name="emitAuxMethodDecls"/> 2256 2227 2257 2228 <!-- switch to private --> … … 2261 2232 <!-- wrapped interface attributes/methods (private) --> 2262 2233 <xsl:call-template name="emitInterfaceDecls"> 2263 <xsl:with-param name="iface" select="$iface"/>2264 2234 <xsl:with-param name="pmode" select="'wrapped'"/> 2265 2235 </xsl:call-template> 2266 2236 2267 2237 <xsl:for-each select="exsl:node-set($addinterfaces)/token"> 2268 <!-- This is super tricky, as the for-each switches to the node 2269 set, which means the normal document isn't available any2270 more. So need to use the global root node to get back into2271 the documemt to find corresponding interface data. -->2238 <!-- This is super tricky, as the for-each switches to the node set, 2239 which means the normal document isn't available any more. We get 2240 the data we need, uses a for-each to switch document and then a 2241 key() to look up the interface by name. --> 2272 2242 <xsl:variable name="addifname"> 2273 2243 <xsl:value-of select="string(.)"/> 2274 2244 </xsl:variable> 2275 <xsl:call-template name="emitInterfaceDecls"> 2276 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/> 2277 <xsl:with-param name="pmode" select="'wrapped'"/> 2278 </xsl:call-template> 2245 <xsl:for-each select="$G_root"> 2246 <xsl:for-each select="key('G_keyInterfacesByName', $addifname)"> 2247 <xsl:call-template name="emitInterfaceDecls"> 2248 <xsl:with-param name="pmode" select="'wrapped'"/> 2249 </xsl:call-template> 2250 </xsl:for-each> 2251 </xsl:for-each> 2279 2252 </xsl:for-each> 2280 2253 2281 <xsl:apply-templates select=" $iface" mode="classfooter"/>2282 <xsl:apply-templates select=" $iface" mode="endfile">2254 <xsl:apply-templates select="." mode="classfooter"/> 2255 <xsl:apply-templates select="." mode="endfile"> 2283 2256 <xsl:with-param name="file" select="$filename"/> 2284 2257 </xsl:apply-templates> … … 2286 2259 2287 2260 <!-- - - - - - - - - - - - - - - - - - - - - - - 2288 emit all attributes and methods definitions (pmode=code) or probes (pmode=dtrace-probes) of aninterface2261 emit all attributes and methods definitions (pmode=code) or probes (pmode=dtrace-probes) of the current interface 2289 2262 - - - - - - - - - - - - - - - - - - - - - - --> 2290 2263 <xsl:template name="emitInterfaceDefs"> 2291 <xsl:param name="iface"/>2292 2264 <xsl:param name="addinterfaces"/> 2293 2265 <xsl:param name="pmode" select="'code'"/> 2294 2266 2295 <xsl:if test="$pmode = 'code'"> 2296 <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap)', $G_sNewLine, $G_sNewLine)"/> 2297 </xsl:if> 2298 2267 <xsl:variable name="topclass" select="substring(@name, 2)"/> 2299 2268 <xsl:variable name="dtracetopclass"> 2300 2269 <xsl:choose> 2301 <xsl:when test=" $iface/@dtracename"><xsl:value-of select="$iface/@dtracename"/></xsl:when>2302 <xsl:otherwise><xsl:value-of select=" substring($iface/@name, 2)"/></xsl:otherwise>2270 <xsl:when test="@dtracename"><xsl:value-of select="@dtracename"/></xsl:when> 2271 <xsl:otherwise><xsl:value-of select="$topclass"/></xsl:otherwise> 2303 2272 </xsl:choose> 2304 2273 </xsl:variable> 2274 2275 <xsl:if test="$pmode = 'code'"> 2276 <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', $topclass, 'Wrap)', $G_sNewLine, $G_sNewLine)"/> 2277 </xsl:if> 2305 2278 2306 2279 <!-- attributes --> 2307 2280 <xsl:call-template name="emitAttributes"> 2308 <xsl:with-param name="iface" select="$iface"/> 2309 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/> 2281 <xsl:with-param name="topclass" select="$topclass"/> 2310 2282 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2311 2283 <xsl:with-param name="pmode" select="$pmode"/> … … 2314 2286 <xsl:for-each select="exsl:node-set($addinterfaces)/token"> 2315 2287 <!-- This is super tricky, as the for-each switches to the node set, 2316 which means the normal document isn't available any more. So need2317 t o use the global root node to get back into the documemt to find2318 corresponding interface data. -->2288 which means the normal document isn't available any more. We get 2289 the data we need, uses a for-each to switch document and then a 2290 key() to look up the interface by name. --> 2319 2291 <xsl:variable name="addifname"> 2320 2292 <xsl:value-of select="string(.)"/> 2321 2293 </xsl:variable> 2322 <xsl:call-template name="emitAttributes"> 2323 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/> 2324 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/> 2325 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2326 <xsl:with-param name="pmode" select="$pmode"/> 2327 </xsl:call-template> 2294 <xsl:for-each select="$G_root"> 2295 <xsl:for-each select="key('G_keyInterfacesByName', $addifname)"> 2296 <xsl:call-template name="emitAttributes"> 2297 <xsl:with-param name="topclass" select="$topclass"/> 2298 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2299 <xsl:with-param name="pmode" select="$pmode"/> 2300 </xsl:call-template> 2301 </xsl:for-each> 2302 </xsl:for-each> 2328 2303 </xsl:for-each> 2329 2304 2330 2305 <!-- methods --> 2331 2306 <xsl:call-template name="emitMethods"> 2332 <xsl:with-param name="iface" select="$iface"/> 2333 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/> 2307 <xsl:with-param name="topclass" select="$topclass"/> 2334 2308 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2335 2309 <xsl:with-param name="pmode" select="$pmode"/> … … 2338 2312 <xsl:for-each select="exsl:node-set($addinterfaces)/token"> 2339 2313 <!-- This is super tricky, as the for-each switches to the node set, 2340 which means the normal document isn't available any more. So need2341 t o use the global root node to get back into the documemt to find2342 corresponding interface data. -->2314 which means the normal document isn't available any more. We get 2315 the data we need, uses a for-each to switch document and then a 2316 key() to look up the interface by name. --> 2343 2317 <xsl:variable name="addifname"> 2344 2318 <xsl:value-of select="string(.)"/> 2345 2319 </xsl:variable> 2346 <xsl:call-template name="emitMethods"> 2347 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/> 2348 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/> 2349 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2350 <xsl:with-param name="pmode" select="$pmode"/> 2351 </xsl:call-template> 2320 <xsl:for-each select="$G_root"> 2321 <xsl:for-each select="key('G_keyInterfacesByName', $addifname)"> 2322 <xsl:call-template name="emitMethods"> 2323 <xsl:with-param name="topclass" select="$topclass"/> 2324 <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/> 2325 <xsl:with-param name="pmode" select="$pmode"/> 2326 </xsl:call-template> 2327 </xsl:for-each> 2328 </xsl:for-each> 2352 2329 </xsl:for-each> 2353 2330 </xsl:template> 2354 2331 2355 2332 <!-- - - - - - - - - - - - - - - - - - - - - - - 2356 emit auxiliary method declarations of aninterface2333 emit auxiliary method declarations of the current interface 2357 2334 - - - - - - - - - - - - - - - - - - - - - - --> 2358 2335 <xsl:template name="emitAuxMethodDefs"> 2359 <xsl:param name="iface"/>2360 2336 <xsl:param name="pmode" select="'code'"/> 2361 2337 <!-- currently nothing, maybe later some generic FinalConstruct/... implementation --> … … 2364 2340 2365 2341 <!-- - - - - - - - - - - - - - - - - - - - - - - 2366 emit the code file of aninterface2342 emit the code file of the current interface 2367 2343 - - - - - - - - - - - - - - - - - - - - - - --> 2368 2344 <xsl:template name="emitCode"> 2369 <xsl:param name="iface"/>2370 2345 <xsl:param name="addinterfaces"/> 2371 2346 2372 <xsl:if test="$generating != 'sources'"> <!-- Paranoia -->2373 <xsl:message terminate="yes">2374 Did not expect generating='<xsl:value-of select="$generating"/>' in the emitCode template.2375 </xsl:message>2376 </xsl:if>2377 2378 2347 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/> 2379 2348 2380 <xsl:apply-templates select=" $iface" mode="startfile">2349 <xsl:apply-templates select="." mode="startfile"> 2381 2350 <xsl:with-param name="file" select="$filename"/> 2382 2351 </xsl:apply-templates> … … 2386 2355 <xsl:with-param name="type" select="'code'"/> 2387 2356 </xsl:call-template> 2388 <xsl:apply-templates select=" $iface" mode="codeheader">2357 <xsl:apply-templates select="." mode="codeheader"> 2389 2358 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 2390 2359 </xsl:apply-templates> … … 2392 2361 <!-- interface attributes/methods (public) --> 2393 2362 <xsl:call-template name="emitInterfaceDefs"> 2394 <xsl:with-param name="iface" select="$iface"/>2395 2363 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 2364 </xsl:call-template> 2365 2366 <!-- auxiliary methods (public) --> 2367 <xsl:call-template name="emitAuxMethodDefs"/> 2368 2369 <xsl:apply-templates select="." mode="codefooter"> 2370 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 2371 </xsl:apply-templates> 2372 <xsl:apply-templates select="." mode="endfile"> 2373 <xsl:with-param name="file" select="$filename"/> 2374 </xsl:apply-templates> 2375 </xsl:template> 2376 2377 <!-- - - - - - - - - - - - - - - - - - - - - - - 2378 emit the DTrace probes for the current interface 2379 - - - - - - - - - - - - - - - - - - - - - - --> 2380 <xsl:template name="emitDTraceProbes"> 2381 <xsl:param name="addinterfaces"/> 2382 2383 <!-- interface attributes/methods (public) --> 2384 <xsl:call-template name="emitInterfaceDefs"> 2385 <xsl:with-param name="addinterfaces" select="$addinterfaces"/> 2386 <xsl:with-param name="pmode">dtrace-probes</xsl:with-param> 2396 2387 </xsl:call-template> 2397 2388 2398 2389 <!-- auxiliary methods (public) --> 2399 2390 <xsl:call-template name="emitAuxMethodDefs"> 2400 <xsl:with-param name="iface" select="$iface"/>2401 </xsl:call-template>2402 2403 <xsl:apply-templates select="$iface" mode="codefooter">2404 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>2405 </xsl:apply-templates>2406 <xsl:apply-templates select="$iface" mode="endfile">2407 <xsl:with-param name="file" select="$filename"/>2408 </xsl:apply-templates>2409 </xsl:template>2410 2411 <!-- - - - - - - - - - - - - - - - - - - - - - -2412 emit the DTrace probes for an interface2413 - - - - - - - - - - - - - - - - - - - - - - -->2414 <xsl:template name="emitDTraceProbes">2415 <xsl:param name="iface"/>2416 <xsl:param name="addinterfaces"/>2417 2418 <xsl:if test="$generating != 'dtrace-probes'"> <!-- Paranoia -->2419 <xsl:message terminate="yes">2420 Did not expect generating='<xsl:value-of select="$generating"/>' in the emitDTraceProbes template.2421 </xsl:message>2422 </xsl:if>2423 2424 <!-- interface attributes/methods (public) -->2425 <xsl:call-template name="emitInterfaceDefs">2426 <xsl:with-param name="iface" select="$iface"/>2427 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>2428 <xsl:with-param name="pmode">dtrace-probes</xsl:with-param>2429 </xsl:call-template>2430 2431 <!-- auxiliary methods (public) -->2432 <xsl:call-template name="emitAuxMethodDefs">2433 <xsl:with-param name="iface" select="$iface"/>2434 2391 <xsl:with-param name="pmode">dtrace-probes</xsl:with-param> 2435 2392 </xsl:call-template> … … 2460 2417 <xsl:template match="interface"> 2461 2418 <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no')"> 2462 <xsl:call-template name="emitInterface"> 2463 <xsl:with-param name="iface" select="."/> 2464 </xsl:call-template> 2419 <xsl:call-template name="emitInterface"/> 2465 2420 </xsl:if> 2466 2421 </xsl:template>
Note:
See TracChangeset
for help on using the changeset viewer.