VirtualBox

Changeset 50751 in vbox


Ignore:
Timestamp:
Mar 12, 2014 4:14:41 PM (11 years ago)
Author:
vboxsync
Message:

Main/idl/apiwrap-server.xsl: add proper handling for mod="ptr" attributes, and additionally make some cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/apiwrap-server.xsl

    r50183 r50751  
    216216    <xsl:param name="type"/>
    217217    <xsl:param name="dir"/>
     218    <xsl:param name="mod"/>
    218219
    219220    <!-- get C++ glue type from IDL type from table in typemap-shared.inc.xsl -->
     
    250251        </xsl:otherwise>
    251252    </xsl:choose>
     253    <xsl:if test="$mod='ptr'">
     254        <xsl:text> *</xsl:text>
     255    </xsl:if>
    252256</xsl:template>
    253257
     
    255259    <xsl:param name="type"/>
    256260    <xsl:param name="dir"/>
     261    <xsl:param name="mod"/>
    257262    <xsl:param name="safearray"/>
    258263
     
    298303        </xsl:otherwise>
    299304    </xsl:choose>
     305    <xsl:if test="$mod='ptr'">
     306        <xsl:text> *</xsl:text>
     307    </xsl:if>
    300308</xsl:template>
    301309
     
    303311    <xsl:param name="type"/>
    304312    <xsl:param name="dir"/>
     313    <xsl:param name="mod"/>
    305314    <xsl:param name="safearray"/>
    306     <xsl:param name="mod"/>
     315    <xsl:param name="isref"/>
    307316
    308317    <!-- get C format string for IDL type from table in typemap-shared.inc.xsl -->
    309318    <xsl:variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
    310319    <xsl:choose>
    311         <xsl:when test="$mod='ref' and $dir!='in'">
     320        <xsl:when test="$mod='ptr' or ($isref='yes' and $dir!='in')">
    312321            <xsl:text>%p</xsl:text>
    313322        </xsl:when>
     
    335344</xsl:template>
    336345
     346<!-- - - - - - - - - - - - - - - - - - - - - - -
     347  templates for handling entire interfaces and their contents
     348 - - - - - - - - - - - - - - - - - - - - - - -->
     349
     350<xsl:template name="emitInterface">
     351    <xsl:param name="iface"/>
     352
     353    <xsl:call-template name="emitHeader">
     354        <xsl:with-param name="iface" select="$iface"/>
     355    </xsl:call-template>
     356
     357    <xsl:call-template name="emitCode">
     358        <xsl:with-param name="iface" select="$iface"/>
     359    </xsl:call-template>
     360</xsl:template>
     361
    337362<xsl:template match="attribute/@type | param/@type" mode="public">
    338363    <xsl:param name="dir"/>
     
    342367            <xsl:with-param name="type" select="."/>
    343368            <xsl:with-param name="dir" select="$dir"/>
     369            <xsl:with-param name="mod" select="../@mod"/>
    344370        </xsl:call-template>
    345371    </xsl:variable>
     
    389415            <xsl:with-param name="type" select="."/>
    390416            <xsl:with-param name="dir" select="$dir"/>
     417            <xsl:with-param name="mod" select="../@mod"/>
    391418            <xsl:with-param name="safearray" select="../@safearray"/>
    392419        </xsl:call-template>
     
    447474<xsl:template match="attribute/@type | param/@type" mode="logparamtext">
    448475    <xsl:param name="dir"/>
    449     <xsl:param name="mod"/>
    450 
    451     <xsl:if test="$mod!='ref' and ($dir='out' or $dir='ret')">
     476    <xsl:param name="isref"/>
     477
     478    <xsl:if test="$isref!='yes' and ($dir='out' or $dir='ret')">
    452479        <xsl:text>*</xsl:text>
    453480    </xsl:if>
     
    460487        <xsl:with-param name="type" select="."/>
    461488        <xsl:with-param name="dir" select="$dir"/>
     489        <xsl:with-param name="mod" select="../@mod"/>
    462490        <xsl:with-param name="safearray" select="../@safearray"/>
    463         <xsl:with-param name="mod" select="$mod"/>
     491        <xsl:with-param name="isref" select="$isref"/>
    464492    </xsl:call-template>
    465493</xsl:template>
     
    467495<xsl:template match="attribute/@type | param/@type" mode="logparamval">
    468496    <xsl:param name="dir"/>
    469     <xsl:param name="mod"/>
    470 
    471     <xsl:choose>
    472         <xsl:when test="../@safearray='yes' and $mod!='ref'">
     497    <xsl:param name="isref"/>
     498
     499    <xsl:choose>
     500        <xsl:when test="../@safearray='yes' and $isref!='yes'">
    473501            <xsl:text>ComSafeArraySize(</xsl:text>
    474             <xsl:if test="$mod!='ref' and $dir!='in'">
     502            <xsl:if test="$isref!='yes' and $dir!='in'">
    475503                <xsl:text>*</xsl:text>
    476504            </xsl:if>
    477505        </xsl:when>
    478         <xsl:when test="$mod!='ref' and $dir!='in'">
     506        <xsl:when test="$isref!='yes' and $dir!='in'">
    479507            <xsl:text>*</xsl:text>
    480508        </xsl:when>
     
    485513    </xsl:call-template>
    486514    <xsl:choose>
    487         <xsl:when test="../@safearray='yes' and $mod!='ref'">
     515        <xsl:when test="../@safearray='yes' and $isref!='yes'">
    488516            <xsl:text>)</xsl:text>
    489517        </xsl:when>
     
    498526            <xsl:with-param name="type" select="."/>
    499527            <xsl:with-param name="dir" select="$dir"/>
     528            <xsl:with-param name="mod" select="../@mod"/>
    500529        </xsl:call-template>
    501530    </xsl:variable>
     
    745774    <xsl:apply-templates select="@type" mode="logparamtext">
    746775        <xsl:with-param name="dir" select="'out'"/>
    747         <xsl:with-param name="mod" select="'ref'"/>
     776        <xsl:with-param name="isref" select="'yes'"/>
    748777    </xsl:apply-templates>
    749778    <xsl:text>\n", this, </xsl:text>
     
    751780    <xsl:apply-templates select="@type" mode="logparamval">
    752781        <xsl:with-param name="dir" select="'out'"/>
    753         <xsl:with-param name="mod" select="'ref'"/>
     782        <xsl:with-param name="isref" select="'yes'"/>
    754783    </xsl:apply-templates>
    755784    <xsl:text>));
     
    797826    <xsl:apply-templates select="@type" mode="logparamtext">
    798827        <xsl:with-param name="dir" select="'out'"/>
     828        <xsl:with-param name="isref" select="''"/>
    799829    </xsl:apply-templates>
    800830    <xsl:text> hrc=%Rhrc\n", this, </xsl:text>
     
    802832    <xsl:apply-templates select="@type" mode="logparamval">
    803833        <xsl:with-param name="dir" select="'out'"/>
     834        <xsl:with-param name="isref" select="''"/>
    804835    </xsl:apply-templates>
    805836    <xsl:text>, hrc));
     
    819850        <xsl:apply-templates select="@type" mode="logparamtext">
    820851            <xsl:with-param name="dir" select="'in'"/>
     852            <xsl:with-param name="isref" select="''"/>
    821853        </xsl:apply-templates>
    822854        <xsl:text>\n", this, </xsl:text>
     
    824856        <xsl:apply-templates select="@type" mode="logparamval">
    825857            <xsl:with-param name="dir" select="'in'"/>
     858            <xsl:with-param name="isref" select="''"/>
    826859        </xsl:apply-templates>
    827860        <xsl:text>));
     
    10211054        <xsl:apply-templates select="@type" mode="logparamtext">
    10221055            <xsl:with-param name="dir" select="@dir"/>
    1023             <xsl:with-param name="mod" select="'ref'"/>
     1056            <xsl:with-param name="isref" select="'yes'"/>
    10241057        </xsl:apply-templates>
    10251058    </xsl:for-each>
     
    10301063        <xsl:apply-templates select="@type" mode="logparamval">
    10311064            <xsl:with-param name="dir" select="@dir"/>
    1032             <xsl:with-param name="mod" select="'ref'"/>
     1065            <xsl:with-param name="isref" select="'yes'"/>
    10331066        </xsl:apply-templates>
    10341067    </xsl:for-each>
     
    11011134            <xsl:apply-templates select="@type" mode="logparamtext">
    11021135                <xsl:with-param name="dir" select="@dir"/>
     1136                <xsl:with-param name="isref" select="''"/>
    11031137            </xsl:apply-templates>
    11041138        </xsl:if>
     
    11111145            <xsl:apply-templates select="@type" mode="logparamval">
    11121146                <xsl:with-param name="dir" select="@dir"/>
     1147                <xsl:with-param name="isref" select="''"/>
    11131148            </xsl:apply-templates>
    11141149        </xsl:if>
     
    13461381
    13471382<!-- - - - - - - - - - - - - - - - - - - - - - -
    1348   library match
     1383  interface match
    13491384 - - - - - - - - - - - - - - - - - - - - - - -->
    13501385
    13511386<xsl:template match="interface">
    1352     <xsl:if test="not(@supportsErrorInfo='no')">
    1353         <xsl:call-template name="emitHeader">
    1354             <xsl:with-param name="iface" select="."/>
    1355         </xsl:call-template>
    1356 
    1357         <xsl:call-template name="emitCode">
     1387    <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no')">
     1388        <xsl:call-template name="emitInterface">
    13581389            <xsl:with-param name="iface" select="."/>
    13591390        </xsl:call-template>
Note: See TracChangeset for help on using the changeset viewer.

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