VirtualBox

Changeset 56396 in vbox for trunk


Ignore:
Timestamp:
Jun 12, 2015 6:02:06 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100996
Message:

Main/idl: introduce attributes to define how many reserved attributes/methods should be added to a particular interface (currently unused, i.e. not much tested)

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/cbinding/capiidl.xsl

    r54027 r56396  
    17721772  <xsl:param name="iface"/>
    17731773
     1774  <xsl:variable name="name" select="@name"/>
    17741775  <xsl:variable name="extends" select="@extends"/>
    17751776  <xsl:choose>
     
    18361837    <xsl:with-param name="iface" select="$iface"/>
    18371838  </xsl:apply-templates>
     1839  <xsl:variable name="reservedAttributes" select="@reservedAttributes"/>
     1840  <xsl:if test="$reservedAttributes > 0">
     1841    <!-- tricky way to do a "for" loop without recursion -->
     1842    <xsl:for-each select="(//*)[position() &lt;= $reservedAttributes]">
     1843      <xsl:text>    nsresult (*GetInternalAndReservedAttribute</xsl:text>
     1844      <xsl:value-of select="concat(position(), $name)"/>
     1845      <xsl:text>)(</xsl:text>
     1846      <xsl:value-of select="$iface"/>
     1847      <xsl:text> *pThis, PRUint32 *reserved);&#x0A;</xsl:text>
     1848      <xsl:text>    nsresult (*SetInternalAndReservedAttribute</xsl:text>
     1849      <xsl:value-of select="concat(position(), $name)"/>
     1850      <xsl:text>)(</xsl:text>
     1851      <xsl:value-of select="$iface"/>
     1852      <xsl:text> *pThis, PRUint32 reserved);&#x0A;&#x0A;</xsl:text>
     1853    </xsl:for-each>
     1854  </xsl:if>
    18381855  <!-- methods -->
    18391856  <xsl:apply-templates select="method | if/method">
    18401857    <xsl:with-param name="iface" select="$iface"/>
    18411858  </xsl:apply-templates>
     1859  <xsl:variable name="reservedMethods" select="@reservedMethods"/>
     1860  <xsl:if test="$reservedMethods > 0">
     1861    <!-- tricky way to do a "for" loop without recursion -->
     1862    <xsl:for-each select="(//*)[position() &lt;= $reservedMethods]">
     1863      <xsl:text>    nsresult (*InternalAndReservedMethod</xsl:text>
     1864      <xsl:value-of select="concat(position(), $name)"/>
     1865      <xsl:text>)(</xsl:text>
     1866      <xsl:value-of select="$iface"/>
     1867      <xsl:text> *pThis);&#x0A;&#x0A;</xsl:text>
     1868    </xsl:for-each>
     1869  </xsl:if>
    18421870</xsl:template>
    18431871
  • trunk/src/VBox/Main/idl/apiwrap-server.xsl

    r55961 r56396  
    15131513    <xsl:param name="pmode"/>
    15141514
     1515    <xsl:variable name="name" select="@name"/>
    15151516    <!-- first recurse to emit all base interfaces -->
    15161517    <xsl:variable name="extends" select="@extends"/>
     
    15291530            <xsl:text>//
    15301531</xsl:text>
    1531             <xsl:value-of select="concat('// ', @name, ' properties')"/>
     1532            <xsl:value-of select="concat('// ', $name, ' properties')"/>
    15321533            <xsl:text>
    15331534//
     
    15361537        </xsl:when>
    15371538        <xsl:when test="$pmode != 'dtrace-probes'">
    1538             <xsl:value-of select="concat($G_sNewLine, '    // ', $pmode, ' ', @name, ' properties', $G_sNewLine)"/>
     1539            <xsl:value-of select="concat($G_sNewLine, '    // ', $pmode, ' ', $name, ' properties', $G_sNewLine)"/>
    15391540        </xsl:when>
    15401541    </xsl:choose>
     
    15441545                <xsl:with-param name="emitmode" select="'attribute'"/>
    15451546            </xsl:apply-templates>
     1547            <xsl:variable name="reservedAttributes" select="@reservedAttributes"/>
     1548            <xsl:if test="$reservedAttributes > 0">
     1549                <!-- tricky way to do a "for" loop without recursion -->
     1550                <xsl:for-each select="(//*)[position() &lt;= $reservedAttributes]">
     1551                    <xsl:text>    STDMETHOD(COMGETTER(InternalAndReservedAttribute</xsl:text>
     1552                    <xsl:value-of select="concat(position(), $name)"/>
     1553                    <xsl:text>))(ULONG *aReserved);&#x0A;</xsl:text>
     1554                    <xsl:text>    STDMETHOD(COMSETTER(InternalAndReservedAttribute</xsl:text>
     1555                    <xsl:value-of select="concat(position(), $name)"/>
     1556                    <xsl:text>))(ULONG aReserved);&#x0A;</xsl:text>
     1557                </xsl:for-each>
     1558            </xsl:if>
    15461559        </xsl:when>
    15471560        <xsl:when test="$pmode='wrapped'">
     
    15561569                <xsl:with-param name="emitmode" select="'attribute'"/>
    15571570            </xsl:apply-templates>
     1571            <xsl:variable name="reservedAttributes" select="@reservedAttributes"/>
     1572            <xsl:if test="$reservedAttributes > 0">
     1573                <!-- tricky way to do a "for" loop without recursion -->
     1574                <xsl:for-each select="(//*)[position() &lt;= $reservedAttributes]">
     1575                    <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(InternalAndReservedAttribute', position(), $name, ')(ULONG *aReserved)&#x0A;')"/>
     1576                    <xsl:text>{
     1577    NOREF(aReserved);
     1578    return E_NOTIMPL;
     1579}
     1580
     1581</xsl:text>
     1582                    <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(InternalAndReservedAttribute', position(), $name, ')(ULONG aReserved)&#x0A;')"/>
     1583                    <xsl:text>{
     1584    NOREF(aReserved);
     1585    return E_NOTIMPL;
     1586}
     1587
     1588</xsl:text>
     1589                </xsl:for-each>
     1590            </xsl:if>
    15581591        </xsl:when>
    15591592        <xsl:when test="$pmode = 'dtrace-probes'">
     
    21172150    <xsl:param name="dtracetopclass"/>
    21182151
     2152    <xsl:variable name="name" select="@name"/>
    21192153    <!-- first recurse to emit all base interfaces -->
    21202154    <xsl:variable name="extends" select="@extends"/>
     
    21332167            <xsl:text>//
    21342168</xsl:text>
    2135             <xsl:value-of select="concat('// ', @name, ' methods')"/>
     2169            <xsl:value-of select="concat('// ', $name, ' methods')"/>
    21362170            <xsl:text>
    21372171//
     
    21412175        <xsl:when test="$pmode='dtrace-probes'"/>
    21422176        <xsl:otherwise>
    2143             <xsl:value-of select="concat($G_sNewLine, '    // ', $pmode, ' ', @name, ' methods', $G_sNewLine)"/>
     2177            <xsl:value-of select="concat($G_sNewLine, '    // ', $pmode, ' ', $name, ' methods', $G_sNewLine)"/>
    21442178        </xsl:otherwise>
    21452179    </xsl:choose>
     
    21492183                <xsl:with-param name="emitmode" select="'method'"/>
    21502184            </xsl:apply-templates>
     2185            <xsl:variable name="reservedMethods" select="@reservedMethods"/>
     2186            <xsl:if test="$reservedMethods > 0">
     2187                <!-- tricky way to do a "for" loop without recursion -->
     2188                <xsl:for-each select="(//*)[position() &lt;= $reservedMethods]">
     2189                    <xsl:text>    STDMETHOD(InternalAndReservedMethod</xsl:text>
     2190                    <xsl:value-of select="concat(position(), $name)"/>
     2191                    <xsl:text>)();&#x0A;</xsl:text>
     2192                </xsl:for-each>
     2193            </xsl:if>
    21512194        </xsl:when>
    21522195        <xsl:when test="$pmode='wrapped'">
     
    21612204                <xsl:with-param name="emitmode" select="'method'"/>
    21622205            </xsl:apply-templates>
     2206            <xsl:variable name="reservedMethods" select="@reservedMethods"/>
     2207            <xsl:if test="$reservedMethods > 0">
     2208                <!-- tricky way to do a "for" loop without recursion -->
     2209                <xsl:for-each select="(//*)[position() &lt;= $reservedMethods]">
     2210                    <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::InternalAndReservedMethod', position(), $name, '()&#x0A;')"/>
     2211                    <xsl:text>{
     2212    return E_NOTIMPL;
     2213}
     2214
     2215</xsl:text>
     2216                </xsl:for-each>
     2217            </xsl:if>
    21632218        </xsl:when>
    21642219        <xsl:when test="$pmode='dtrace-probes'">
  • trunk/src/VBox/Main/idl/midl.xsl

    r53920 r56396  
    66 *  from the generic interface definition expressed in XML.
    77
    8     Copyright (C) 2006-2014 Oracle Corporation
     8    Copyright (C) 2006-2015 Oracle Corporation
    99
    1010    This file is part of VirtualBox Open Source Edition (OSE), as
     
    201201]
    202202<xsl:text>interface </xsl:text>
    203   <xsl:value-of select="@name"/>
     203  <xsl:variable name="name" select="@name"/>
     204  <xsl:value-of select="$name"/>
    204205  <xsl:text> : </xsl:text>
    205206  <xsl:choose>
     
    215216  <!-- attributes (properties) -->
    216217  <xsl:apply-templates select="attribute"/>
     218  <xsl:variable name="reservedAttributes" select="@reservedAttributes"/>
     219  <xsl:if test="$reservedAttributes > 0">
     220    <!-- tricky way to do a "for" loop without recursion -->
     221    <xsl:for-each select="(//*)[position() &lt;= $reservedAttributes]">
     222      <xsl:text>    [propget] HRESULT InternalAndReservedAttribute</xsl:text>
     223      <xsl:value-of select="concat(position(), $name)"/>
     224      <xsl:text> ([out, retval] ULONG *aReserved);&#x0A;&#x0A;</xsl:text>
     225      <xsl:text>    [propput] HRESULT InternalAndReservedAttribute</xsl:text>
     226      <xsl:value-of select="concat(position(), $name)"/>
     227      <xsl:text> ([in] ULONG aReserved);&#x0A;&#x0A;</xsl:text>
     228    </xsl:for-each>
     229  </xsl:if>
    217230  <!-- methods -->
    218231  <xsl:apply-templates select="method"/>
     232  <xsl:variable name="reservedMethods" select="@reservedMethods"/>
     233  <xsl:if test="$reservedMethods > 0">
     234    <!-- tricky way to do a "for" loop without recursion -->
     235    <xsl:for-each select="(//*)[position() &lt;= $reservedMethods]">
     236      <xsl:text>    HRESULT InternalAndReservedMethod</xsl:text>
     237      <xsl:value-of select="concat(position(), $name)"/>
     238      <xsl:text>();&#x0A;&#x0A;</xsl:text>
     239    </xsl:for-each>
     240  </xsl:if>
    219241  <!-- 'if' enclosed elements, unsorted -->
    220242  <xsl:apply-templates select="if"/>
    221243  <!-- -->
    222244  <xsl:text>}; /* interface </xsl:text>
    223   <xsl:value-of select="@name"/>
     245  <xsl:value-of select="$name"/>
    224246  <xsl:text> */&#x0A;&#x0A;</xsl:text>
    225247  <!-- Interface implementation forwarder macro -->
     
    231253  <!-- 2) COM_FORWARD_Interface_TO(smth) -->
    232254  <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
    233   <xsl:value-of select="@name"/>
     255  <xsl:value-of select="$name"/>
    234256  <xsl:text>_TO(smth) </xsl:text>
    235257  <xsl:apply-templates select="attribute" mode="forwarder">
     
    245267  <!-- 3) COM_FORWARD_Interface_TO_OBJ(obj) -->
    246268  <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
    247   <xsl:value-of select="@name"/>
     269  <xsl:value-of select="$name"/>
    248270  <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
    249   <xsl:value-of select="@name"/>
     271  <xsl:value-of select="$name"/>
    250272  <xsl:text>_TO ((obj)->)")&#x0A;</xsl:text>
    251273  <!-- 4) COM_FORWARD_Interface_TO_BASE(base) -->
    252274  <xsl:text>cpp_quote("#define COM_FORWARD_</xsl:text>
    253   <xsl:value-of select="@name"/>
     275  <xsl:value-of select="$name"/>
    254276  <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
    255   <xsl:value-of select="@name"/>
     277  <xsl:value-of select="$name"/>
    256278  <xsl:text>_TO (base::)")&#x0A;</xsl:text>
    257279  <!-- end -->
  • trunk/src/VBox/Main/idl/xpidl.xsl

    r53939 r56396  
    66 *  from the generic interface definition expressed in XML.
    77
    8     Copyright (C) 2006-2014 Oracle Corporation
     8    Copyright (C) 2006-2015 Oracle Corporation
    99
    1010    This file is part of VirtualBox Open Source Edition (OSE), as
     
    191191]
    192192<xsl:text>interface </xsl:text>
    193   <xsl:value-of select="@name"/>
     193  <xsl:variable name="name" select="@name"/>
     194  <xsl:value-of select="$name"/>
    194195  <xsl:text> : </xsl:text>
    195196  <xsl:choose>
     
    202203  <!-- attributes (properties) -->
    203204  <xsl:apply-templates select="attribute"/>
     205  <xsl:variable name="reservedAttributes" select="@reservedAttributes"/>
     206  <xsl:if test="$reservedAttributes > 0">
     207    <!-- tricky way to do a "for" loop without recursion -->
     208    <xsl:for-each select="(//*)[position() &lt;= $reservedAttributes]">
     209      <xsl:text>    attribute unsigned long InternalAndReservedAttribute</xsl:text>
     210      <xsl:value-of select="concat(position(), $name)"/>
     211      <xsl:text>;&#x0A;&#x0A;</xsl:text>
     212    </xsl:for-each>
     213  </xsl:if>
    204214  <!-- methods -->
    205215  <xsl:apply-templates select="method"/>
     216  <xsl:variable name="reservedMethods" select="@reservedMethods"/>
     217  <xsl:if test="$reservedMethods > 0">
     218    <!-- tricky way to do a "for" loop without recursion -->
     219    <xsl:for-each select="(//*)[position() &lt;= $reservedMethods]">
     220      <xsl:text>    void InternalAndReservedMethod</xsl:text>
     221      <xsl:value-of select="concat(position(), $name)"/>
     222      <xsl:text>();&#x0A;&#x0A;</xsl:text>
     223    </xsl:for-each>
     224  </xsl:if>
    206225  <!-- 'if' enclosed elements, unsorted -->
    207226  <xsl:apply-templates select="if"/>
    208227  <!-- -->
    209228  <xsl:text>}; /* interface </xsl:text>
    210   <xsl:value-of select="@name"/>
     229  <xsl:value-of select="$name"/>
    211230  <xsl:text> */&#x0A;&#x0A;</xsl:text>
    212231  <!-- Interface implementation forwarder macro -->
     
    219238  <!-- 2) COM_FORWARD_Interface_TO(smth) -->
    220239  <xsl:text>#define COM_FORWARD_</xsl:text>
    221   <xsl:value-of select="@name"/>
     240  <xsl:value-of select="$name"/>
    222241  <xsl:text>_TO(smth) NS_FORWARD_</xsl:text>
    223242  <xsl:call-template name="string-to-upper">
    224     <xsl:with-param name="str" select="@name"/>
     243    <xsl:with-param name="str" select="$name"/>
    225244  </xsl:call-template>
    226245  <xsl:text> (smth)&#x0A;</xsl:text>
    227246  <!-- 3) COM_FORWARD_Interface_TO_OBJ(obj) -->
    228247  <xsl:text>#define COM_FORWARD_</xsl:text>
    229   <xsl:value-of select="@name"/>
     248  <xsl:value-of select="$name"/>
    230249  <xsl:text>_TO_OBJ(obj) COM_FORWARD_</xsl:text>
    231   <xsl:value-of select="@name"/>
     250  <xsl:value-of select="$name"/>
    232251  <xsl:text>_TO ((obj)->)&#x0A;</xsl:text>
    233252  <!-- 4) COM_FORWARD_Interface_TO_BASE(base) -->
    234253  <xsl:text>#define COM_FORWARD_</xsl:text>
    235   <xsl:value-of select="@name"/>
     254  <xsl:value-of select="$name"/>
    236255  <xsl:text>_TO_BASE(base) COM_FORWARD_</xsl:text>
    237   <xsl:value-of select="@name"/>
     256  <xsl:value-of select="$name"/>
    238257  <xsl:text>_TO (base::)&#x0A;&#x0A;</xsl:text>
    239258  <!-- -->
    240259  <xsl:text>// for compatibility with Win32&#x0A;</xsl:text>
    241260  <xsl:text>VBOX_EXTERN_C const nsID IID_</xsl:text>
    242   <xsl:value-of select="@name"/>
     261  <xsl:value-of select="$name"/>
    243262  <xsl:text>;&#x0A;</xsl:text>
    244263  <xsl:text>%}&#x0A;&#x0A;</xsl:text>
Note: See TracChangeset for help on using the changeset viewer.

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