VirtualBox

Ignore:
Timestamp:
Feb 29, 2008 11:36:31 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28535
Message:

Main/xml: Ident 4 -> 2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl

    r7207 r7216  
    3838-->
    3939<xsl:template name="capitalize">
    40     <xsl:param name="str" select="."/>
    41     <xsl:value-of select="
    42         concat(
    43             translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
    44             substring($str,2)
    45         )
    46     "/>
     40  <xsl:param name="str" select="."/>
     41  <xsl:value-of select="
     42    concat(
     43      translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
     44      substring($str,2)
     45    )
     46  "/>
    4747</xsl:template>
    4848
     
    5252-->
    5353<xsl:template name="uncapitalize">
    54     <xsl:param name="str" select="."/>
    55     <xsl:choose>
    56         <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
    57             <xsl:value-of select="
    58                 concat(
    59                     translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
    60                     substring($str,2)
    61                 )
    62             "/>
    63         </xsl:when>
    64         <xsl:otherwise>
    65             <xsl:value-of select="string($str)"/>
    66         </xsl:otherwise>
    67     </xsl:choose>
     54  <xsl:param name="str" select="."/>
     55  <xsl:choose>
     56    <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
     57      <xsl:value-of select="
     58        concat(
     59          translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
     60          substring($str,2)
     61        )
     62      "/>
     63    </xsl:when>
     64    <xsl:otherwise>
     65      <xsl:value-of select="string($str)"/>
     66    </xsl:otherwise>
     67  </xsl:choose>
    6868</xsl:template>
    6969
     
    7272-->
    7373<xsl:template name="uppercase">
    74     <xsl:param name="str" select="."/>
    75     <xsl:value-of select="
    76         translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
    77     "/>
     74  <xsl:param name="str" select="."/>
     75  <xsl:value-of select="
     76    translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
     77  "/>
    7878</xsl:template>
    7979
     
    119119
    120120</xsl:text>
    121     <xsl:for-each select="*/enum">
    122         <xsl:text>enum </xsl:text>
    123         <xsl:value-of select="concat('K',@name)"/>
    124         <xsl:text>&#x0A;{&#x0A;</xsl:text>
    125         <xsl:for-each select="const">
    126             <xsl:text>    </xsl:text>
    127             <xsl:value-of select="concat('K',../@name,'_',@name)"/>
    128             <xsl:text> = ::</xsl:text>
    129             <xsl:value-of select="concat(../@name,'_',@name)"/>
    130             <xsl:text>,&#x0A;</xsl:text>
    131         </xsl:for-each>
    132         <xsl:text>    </xsl:text>
    133         <xsl:value-of select="concat('K',@name,'_COUNT')"/>
    134         <xsl:text>&#x0A;};&#x0A;&#x0A;</xsl:text>
     121  <xsl:for-each select="*/enum">
     122    <xsl:text>enum </xsl:text>
     123    <xsl:value-of select="concat('K',@name)"/>
     124    <xsl:text>&#x0A;{&#x0A;</xsl:text>
     125    <xsl:for-each select="const">
     126      <xsl:text>    </xsl:text>
     127      <xsl:value-of select="concat('K',../@name,'_',@name)"/>
     128      <xsl:text> = ::</xsl:text>
     129      <xsl:value-of select="concat(../@name,'_',@name)"/>
     130      <xsl:text>,&#x0A;</xsl:text>
    135131    </xsl:for-each>
    136     <xsl:text>&#x0A;&#x0A;</xsl:text>
    137 
    138     <xsl:apply-templates/>
     132    <xsl:text>    </xsl:text>
     133    <xsl:value-of select="concat('K',@name,'_COUNT')"/>
     134    <xsl:text>&#x0A;};&#x0A;&#x0A;</xsl:text>
     135  </xsl:for-each>
     136  <xsl:text>&#x0A;&#x0A;</xsl:text>
     137
     138  <xsl:apply-templates/>
    139139
    140140</xsl:template>
     
    181181-->
    182182<xsl:template match="if" mode="begin">
    183     <xsl:if test="@target='xpidl'">
    184         <xsl:text>#if !defined (Q_WS_WIN32)&#x0A;</xsl:text>
    185     </xsl:if>
    186     <xsl:if test="@target='midl'">
    187         <xsl:text>#if defined (Q_WS_WIN32)&#x0A;</xsl:text>
    188     </xsl:if>
     183  <xsl:if test="@target='xpidl'">
     184    <xsl:text>#if !defined (Q_WS_WIN32)&#x0A;</xsl:text>
     185  </xsl:if>
     186  <xsl:if test="@target='midl'">
     187    <xsl:text>#if defined (Q_WS_WIN32)&#x0A;</xsl:text>
     188  </xsl:if>
    189189</xsl:template>
    190190<xsl:template match="if" mode="end">
     
    205205-->
    206206<xsl:template match="@if" mode="begin">
    207     <xsl:text>#if </xsl:text>
    208     <xsl:value-of select="."/>
    209     <xsl:text>&#x0A;</xsl:text>
     207  <xsl:text>#if </xsl:text>
     208  <xsl:value-of select="."/>
     209  <xsl:text>&#x0A;</xsl:text>
    210210</xsl:template>
    211211<xsl:template match="@if" mode="end">
    212     <xsl:text>#endif&#x0A;</xsl:text>
     212  <xsl:text>#endif&#x0A;</xsl:text>
    213213</xsl:template>
    214214
     
    218218-->
    219219<xsl:template match="library">
    220     <!-- forward declarations -->
    221     <xsl:text>// forward declarations&#x0A;&#x0A;</xsl:text>
    222     <xsl:for-each select="interface | collection | enumerator">
    223         <xsl:text>class C</xsl:text>
    224         <xsl:value-of select="substring(@name,2)"/>
    225         <xsl:text>;&#x0A;</xsl:text>
    226     </xsl:for-each>
    227     <xsl:text>&#x0A;</xsl:text>
    228     <!-- array typedefs -->
    229     <xsl:text>// array typedefs&#x0A;&#x0A;</xsl:text>
    230     <xsl:for-each select="interface[not(@internal='yes')]">
    231         <xsl:if test="
    232             (//attribute[@safearray='yes' and not(@internal='yes') and @type=current()/@name])
    233             or
    234             (//param[@safearray='yes' and not(../@internal='yes') and @type=current()/@name])
    235         ">
    236             <xsl:text>typedef QValueVector &lt;C</xsl:text>
    237             <xsl:value-of select="substring(@name,2)"/>
    238             <xsl:text>&gt; C</xsl:text>
    239             <xsl:value-of select="substring(@name,2)"/>
    240             <xsl:text>Vector;&#x0A;</xsl:text>
    241         </xsl:if>
    242     </xsl:for-each>
    243     <xsl:text>&#x0A;</xsl:text>
    244     <!-- wrapper declarations -->
    245     <xsl:text>// wrapper declarations&#x0A;&#x0A;</xsl:text>
    246     <xsl:apply-templates select="
    247             if |
    248             interface[not(@internal='yes')] |
    249             collection[not(@internal='yes')] |
    250             enumerator[not(@internal='yes')]
    251         "
    252         mode="declare"
    253     />
    254     <!-- wrapper definitions -->
    255     <xsl:text>// wrapper definitions&#x0A;&#x0A;</xsl:text>
    256     <xsl:apply-templates select="
    257             if |
    258             interface[not(@internal='yes')] |
    259             collection[not(@internal='yes')] |
    260             enumerator[not(@internal='yes')]
    261         "
    262         mode="define"
    263     />
     220  <!-- forward declarations -->
     221  <xsl:text>// forward declarations&#x0A;&#x0A;</xsl:text>
     222  <xsl:for-each select="interface | collection | enumerator">
     223    <xsl:text>class C</xsl:text>
     224    <xsl:value-of select="substring(@name,2)"/>
     225    <xsl:text>;&#x0A;</xsl:text>
     226  </xsl:for-each>
     227  <xsl:text>&#x0A;</xsl:text>
     228  <!-- array typedefs -->
     229  <xsl:text>// array typedefs&#x0A;&#x0A;</xsl:text>
     230  <xsl:for-each select="interface[not(@internal='yes')]">
     231    <xsl:if test="
     232      (//attribute[@safearray='yes' and not(@internal='yes') and @type=current()/@name])
     233      or
     234      (//param[@safearray='yes' and not(../@internal='yes') and @type=current()/@name])
     235    ">
     236      <xsl:text>typedef QValueVector &lt;C</xsl:text>
     237      <xsl:value-of select="substring(@name,2)"/>
     238      <xsl:text>&gt; C</xsl:text>
     239      <xsl:value-of select="substring(@name,2)"/>
     240      <xsl:text>Vector;&#x0A;</xsl:text>
     241    </xsl:if>
     242  </xsl:for-each>
     243  <xsl:text>&#x0A;</xsl:text>
     244  <!-- wrapper declarations -->
     245  <xsl:text>// wrapper declarations&#x0A;&#x0A;</xsl:text>
     246  <xsl:apply-templates select="
     247      if |
     248      interface[not(@internal='yes')] |
     249      collection[not(@internal='yes')] |
     250      enumerator[not(@internal='yes')]
     251    "
     252    mode="declare"
     253  />
     254  <!-- wrapper definitions -->
     255  <xsl:text>// wrapper definitions&#x0A;&#x0A;</xsl:text>
     256  <xsl:apply-templates select="
     257      if |
     258      interface[not(@internal='yes')] |
     259      collection[not(@internal='yes')] |
     260      enumerator[not(@internal='yes')]
     261    "
     262    mode="define"
     263  />
    264264</xsl:template>
    265265
     
    270270<xsl:template match="interface | collection | enumerator" mode="declare">
    271271
    272     <xsl:text>// </xsl:text>
    273     <xsl:value-of select="@name"/>
    274     <xsl:text> wrapper&#x0A;&#x0A;class C</xsl:text>
    275     <xsl:value-of select="substring(@name,2)"/>
    276     <xsl:text> : public CInterface &lt;</xsl:text>
    277     <xsl:value-of select="@name"/>
    278     <!-- use the correct base if supportsErrorInfo -->
    279     <xsl:call-template name="tryComposeFetchErrorInfo">
    280         <xsl:with-param name="mode" select="'getBaseClassName'"/>
    281     </xsl:call-template>
    282     <xsl:text>&gt;&#x0A;{&#x0A;public:&#x0A;&#x0A;</xsl:text>
    283 
    284     <!-- generate the Base typedef-->
    285     <xsl:text>    typedef CInterface &lt;</xsl:text>
    286     <xsl:value-of select="@name"/>
    287     <!-- Use the correct base if supportsErrorInfo -->
    288     <xsl:call-template name="tryComposeFetchErrorInfo">
    289         <xsl:with-param name="mode" select="'getBaseClassName'"/>
    290     </xsl:call-template>
    291     <xsl:text>&gt; Base;&#x0A;&#x0A;</xsl:text>
    292 
    293     <xsl:if test="name()='collection'">
    294         <xsl:text>    // collection stuff&#x0A;&#x0A;</xsl:text>
    295         <xsl:text>    ULONG GetCount () const;&#x0A;</xsl:text>
    296         <xsl:text>    </xsl:text>
    297         <xsl:apply-templates select="@type"/>
    298         <xsl:text> GetItemAt (ULONG index) const;&#x0A;</xsl:text>
    299         <xsl:text>    </xsl:text>
    300         <xsl:apply-templates select="@enumerator"/>
    301         <xsl:text> Enumerate () const;&#x0A;&#x0A;</xsl:text>
    302     </xsl:if>
    303 
    304     <xsl:if test="name()='enumerator'">
    305         <xsl:text>    // enumerator stuff&#x0A;&#x0A;</xsl:text>
    306         <xsl:text>    BOOL HasMore () const;&#x0A;</xsl:text>
    307         <xsl:text>    </xsl:text>
    308         <xsl:apply-templates select="@type"/>
    309         <xsl:text> GetNext () const;&#x0A;&#x0A;</xsl:text>
    310         <xsl:text>    // friend wrappers&#x0A;&#x0A;</xsl:text>
    311         <xsl:text>    friend class CUnknown;&#x0A;</xsl:text>
    312         <xsl:variable name="name" select="@name"/>
    313         <xsl:variable name="parent" select=".."/>
    314         <!-- for definitions inside <if> -->
    315         <xsl:if test="name(..)='if'">
    316             <xsl:for-each select="
    317                 preceding-sibling::collection | following-sibling::collection |
    318                 ../preceding-sibling::if[@target=$parent/@target]/collection |
    319                 ../following-sibling::if[@target=$parent/@target]/collection
    320             ">
    321                 <xsl:if test="@enumerator=$name">
    322                     <xsl:text>    friend class C</xsl:text>
    323                     <xsl:value-of select="substring(@name,2)"/>
    324                     <xsl:text>;&#x0A;</xsl:text>
    325                 </xsl:if>
    326             </xsl:for-each>
    327         </xsl:if>
    328         <!-- for definitions outside <if> (i.e. inside <library>) -->
    329         <xsl:if test="name(..)!='if'">
    330             <xsl:for-each select="
    331                 preceding-sibling::collection | following-sibling::collection
    332             ">
    333                 <xsl:if test="@enumerator=$name">
    334                     <xsl:text>    friend class C</xsl:text>
    335                     <xsl:value-of select="substring(@name,2)"/>
    336                     <xsl:text>;&#x0A;</xsl:text>
    337                 </xsl:if>
    338             </xsl:for-each>
    339         </xsl:if>
    340     </xsl:if>
    341 
    342     <xsl:if test="name()='interface' or name()='collection'">
    343         <xsl:call-template name="declareMembers"/>
    344     </xsl:if>
    345 
    346     <xsl:text>};&#x0A;&#x0A;</xsl:text>
    347 
    348 </xsl:template>
    349 
    350 <xsl:template name="declareMembers">
    351 
    352     <xsl:text>    // constructors and assignments taking CUnknown and </xsl:text>
    353     <xsl:text>raw iface pointer&#x0A;&#x0A;</xsl:text>
    354     <!-- default constructor -->
    355     <xsl:text>    C</xsl:text>
    356     <xsl:value-of select="substring(@name,2)"/>
    357     <xsl:text> () : Base () {}&#x0A;</xsl:text>
    358     <!-- constructor taking CUnknown -->
    359     <xsl:text>    C</xsl:text>
    360     <xsl:value-of select="substring(@name,2)"/>
    361     <xsl:text> (const CUnknown &amp; that) : Base (that) {}&#x0A;</xsl:text>
    362     <!-- constructor taking raw iface pointer -->
    363     <xsl:text>    C</xsl:text>
    364     <xsl:value-of select="substring(@name,2)"/>
    365     <xsl:text> (</xsl:text>
    366     <xsl:value-of select="@name"/>
    367     <xsl:text> *i) : Base (i) {}&#x0A;</xsl:text>
    368     <!-- assignment taking CUnknown -->
    369     <xsl:text>    C</xsl:text>
    370     <xsl:value-of select="substring(@name,2)"/>
    371     <xsl:text> &amp; operator = (const CUnknown &amp; that)&#x0A;    {&#x0A;        return (C</xsl:text>
    372     <xsl:value-of select="substring(@name,2)"/>
    373     <xsl:text> &amp;) Base::operator = (that);&#x0A;    }&#x0A;&#x0A;</xsl:text>
    374 
    375     <xsl:text>    // attributes (properties)&#x0A;&#x0A;</xsl:text>
    376     <xsl:apply-templates select=".//attribute[not(@internal='yes')]" mode="declare"/>
    377     <xsl:if test=".//attribute[not(@internal='yes')]">
    378         <xsl:text>&#x0A;</xsl:text>
    379     </xsl:if>
    380 
    381     <xsl:text>    // methods&#x0A;&#x0A;</xsl:text>
    382     <xsl:apply-templates select=".//method[not(@internal='yes')]" mode="declare"/>
    383     <xsl:if test=".//method[not(@internal='yes')]">
    384         <xsl:text>&#x0A;</xsl:text>
    385     </xsl:if>
    386 
     272  <xsl:text>// </xsl:text>
     273  <xsl:value-of select="@name"/>
     274  <xsl:text> wrapper&#x0A;&#x0A;class C</xsl:text>
     275  <xsl:value-of select="substring(@name,2)"/>
     276  <xsl:text> : public CInterface &lt;</xsl:text>
     277  <xsl:value-of select="@name"/>
     278  <!-- use the correct base if supportsErrorInfo -->
     279  <xsl:call-template name="tryComposeFetchErrorInfo">
     280    <xsl:with-param name="mode" select="'getBaseClassName'"/>
     281  </xsl:call-template>
     282  <xsl:text>&gt;&#x0A;{&#x0A;public:&#x0A;&#x0A;</xsl:text>
     283
     284  <!-- generate the Base typedef-->
     285  <xsl:text>    typedef CInterface &lt;</xsl:text>
     286  <xsl:value-of select="@name"/>
     287  <!-- Use the correct base if supportsErrorInfo -->
     288  <xsl:call-template name="tryComposeFetchErrorInfo">
     289    <xsl:with-param name="mode" select="'getBaseClassName'"/>
     290  </xsl:call-template>
     291  <xsl:text>&gt; Base;&#x0A;&#x0A;</xsl:text>
     292
     293  <xsl:if test="name()='collection'">
     294    <xsl:text>    // collection stuff&#x0A;&#x0A;</xsl:text>
     295    <xsl:text>    ULONG GetCount () const;&#x0A;</xsl:text>
     296    <xsl:text>    </xsl:text>
     297    <xsl:apply-templates select="@type"/>
     298    <xsl:text> GetItemAt (ULONG index) const;&#x0A;</xsl:text>
     299    <xsl:text>    </xsl:text>
     300    <xsl:apply-templates select="@enumerator"/>
     301    <xsl:text> Enumerate () const;&#x0A;&#x0A;</xsl:text>
     302  </xsl:if>
     303
     304  <xsl:if test="name()='enumerator'">
     305    <xsl:text>    // enumerator stuff&#x0A;&#x0A;</xsl:text>
     306    <xsl:text>    BOOL HasMore () const;&#x0A;</xsl:text>
     307    <xsl:text>    </xsl:text>
     308    <xsl:apply-templates select="@type"/>
     309    <xsl:text> GetNext () const;&#x0A;&#x0A;</xsl:text>
    387310    <xsl:text>    // friend wrappers&#x0A;&#x0A;</xsl:text>
    388311    <xsl:text>    friend class CUnknown;&#x0A;</xsl:text>
     
    391314    <!-- for definitions inside <if> -->
    392315    <xsl:if test="name(..)='if'">
    393         <xsl:for-each select="
    394             preceding-sibling::*[self::interface or self::collection or self::enumerator] |
    395             following-sibling::*[self::interface or self::collection or self::enumerator] |
    396             ../preceding-sibling::*[self::interface or self::collection or self::enumerator] |
    397             ../following-sibling::*[self::interface or self::collection or self::enumerator] |
    398             ../preceding-sibling::if[@target=$parent/@target]/*[self::interface or self::collection or self::enumerator] |
    399             ../following-sibling::if[@target=$parent/@target]/*[self::interface or self::collection or self::enumerator]
    400         ">
    401             <xsl:if test="
    402                 ((name()='interface' or name()='collection')
    403                  and
    404                  ((name(..)!='if' and (if[@target=$parent/@target]/method/param[@type=$name]
    405                                        or
    406                                        if[@target=$parent/@target]/attribute[@type=$name]))
    407                   or
    408                   (.//method/param[@type=$name] or attribute[@type=$name])))
    409                 or
    410                 (name(..)='if' and (name()='collection' or name()='enumerator') and @type=$name)
    411             ">
    412                 <xsl:text>    friend class C</xsl:text>
    413                 <xsl:value-of select="substring(@name,2)"/>
    414                 <xsl:text>;&#x0A;</xsl:text>
    415             </xsl:if>
    416         </xsl:for-each>
     316      <xsl:for-each select="
     317        preceding-sibling::collection | following-sibling::collection |
     318        ../preceding-sibling::if[@target=$parent/@target]/collection |
     319        ../following-sibling::if[@target=$parent/@target]/collection
     320      ">
     321        <xsl:if test="@enumerator=$name">
     322          <xsl:text>    friend class C</xsl:text>
     323          <xsl:value-of select="substring(@name,2)"/>
     324          <xsl:text>;&#x0A;</xsl:text>
     325        </xsl:if>
     326      </xsl:for-each>
    417327    </xsl:if>
    418328    <!-- for definitions outside <if> (i.e. inside <library>) -->
    419329    <xsl:if test="name(..)!='if'">
    420         <xsl:for-each select="
    421             preceding-sibling::*[self::interface or self::collection or self::enumerator] |
    422             following-sibling::*[self::interface or self::collection or self::enumerator] |
    423             preceding-sibling::if/*[self::interface or self::collection or self::enumerator] |
    424             following-sibling::if/*[self::interface or self::collection or self::enumerator]
    425         ">
    426             <xsl:if test="
    427                 ((name()='interface' or name()='collection')
    428                  and
    429                  (.//method/param[@type=$name] or attribute[@type=$name]))
    430                 or
    431                 ((name()='collection' or name()='enumerator') and @type=$name)
    432             ">
    433                 <xsl:text>    friend class C</xsl:text>
    434                 <xsl:value-of select="substring(@name,2)"/>
    435                 <xsl:text>;&#x0A;</xsl:text>
    436             </xsl:if>
    437         </xsl:for-each>
     330      <xsl:for-each select="
     331        preceding-sibling::collection | following-sibling::collection
     332      ">
     333        <xsl:if test="@enumerator=$name">
     334          <xsl:text>    friend class C</xsl:text>
     335          <xsl:value-of select="substring(@name,2)"/>
     336          <xsl:text>;&#x0A;</xsl:text>
     337        </xsl:if>
     338      </xsl:for-each>
    438339    </xsl:if>
     340  </xsl:if>
     341
     342  <xsl:if test="name()='interface' or name()='collection'">
     343    <xsl:call-template name="declareMembers"/>
     344  </xsl:if>
     345
     346  <xsl:text>};&#x0A;&#x0A;</xsl:text>
     347
     348</xsl:template>
     349
     350<xsl:template name="declareMembers">
     351
     352  <xsl:text>    // constructors and assignments taking CUnknown and </xsl:text>
     353  <xsl:text>raw iface pointer&#x0A;&#x0A;</xsl:text>
     354  <!-- default constructor -->
     355  <xsl:text>    C</xsl:text>
     356  <xsl:value-of select="substring(@name,2)"/>
     357  <xsl:text> () : Base () {}&#x0A;</xsl:text>
     358  <!-- constructor taking CUnknown -->
     359  <xsl:text>    C</xsl:text>
     360  <xsl:value-of select="substring(@name,2)"/>
     361  <xsl:text> (const CUnknown &amp; that) : Base (that) {}&#x0A;</xsl:text>
     362  <!-- constructor taking raw iface pointer -->
     363  <xsl:text>    C</xsl:text>
     364  <xsl:value-of select="substring(@name,2)"/>
     365  <xsl:text> (</xsl:text>
     366  <xsl:value-of select="@name"/>
     367  <xsl:text> *i) : Base (i) {}&#x0A;</xsl:text>
     368  <!-- assignment taking CUnknown -->
     369  <xsl:text>    C</xsl:text>
     370  <xsl:value-of select="substring(@name,2)"/>
     371  <xsl:text> &amp; operator = (const CUnknown &amp; that)&#x0A;    {&#x0A;        return (C</xsl:text>
     372  <xsl:value-of select="substring(@name,2)"/>
     373  <xsl:text> &amp;) Base::operator = (that);&#x0A;    }&#x0A;&#x0A;</xsl:text>
     374
     375  <xsl:text>    // attributes (properties)&#x0A;&#x0A;</xsl:text>
     376  <xsl:apply-templates select=".//attribute[not(@internal='yes')]" mode="declare"/>
     377  <xsl:if test=".//attribute[not(@internal='yes')]">
     378    <xsl:text>&#x0A;</xsl:text>
     379  </xsl:if>
     380
     381  <xsl:text>    // methods&#x0A;&#x0A;</xsl:text>
     382  <xsl:apply-templates select=".//method[not(@internal='yes')]" mode="declare"/>
     383  <xsl:if test=".//method[not(@internal='yes')]">
     384    <xsl:text>&#x0A;</xsl:text>
     385  </xsl:if>
     386
     387  <xsl:text>    // friend wrappers&#x0A;&#x0A;</xsl:text>
     388  <xsl:text>    friend class CUnknown;&#x0A;</xsl:text>
     389  <xsl:variable name="name" select="@name"/>
     390  <xsl:variable name="parent" select=".."/>
     391  <!-- for definitions inside <if> -->
     392  <xsl:if test="name(..)='if'">
     393    <xsl:for-each select="
     394      preceding-sibling::*[self::interface or self::collection or self::enumerator] |
     395      following-sibling::*[self::interface or self::collection or self::enumerator] |
     396      ../preceding-sibling::*[self::interface or self::collection or self::enumerator] |
     397      ../following-sibling::*[self::interface or self::collection or self::enumerator] |
     398      ../preceding-sibling::if[@target=$parent/@target]/*[self::interface or self::collection or self::enumerator] |
     399      ../following-sibling::if[@target=$parent/@target]/*[self::interface or self::collection or self::enumerator]
     400    ">
     401      <xsl:if test="
     402        ((name()='interface' or name()='collection')
     403         and
     404         ((name(..)!='if' and (if[@target=$parent/@target]/method/param[@type=$name]
     405                               or
     406                               if[@target=$parent/@target]/attribute[@type=$name]))
     407          or
     408          (.//method/param[@type=$name] or attribute[@type=$name])))
     409        or
     410        (name(..)='if' and (name()='collection' or name()='enumerator') and @type=$name)
     411      ">
     412        <xsl:text>    friend class C</xsl:text>
     413        <xsl:value-of select="substring(@name,2)"/>
     414        <xsl:text>;&#x0A;</xsl:text>
     415      </xsl:if>
     416    </xsl:for-each>
     417  </xsl:if>
     418  <!-- for definitions outside <if> (i.e. inside <library>) -->
     419  <xsl:if test="name(..)!='if'">
     420    <xsl:for-each select="
     421      preceding-sibling::*[self::interface or self::collection or self::enumerator] |
     422      following-sibling::*[self::interface or self::collection or self::enumerator] |
     423      preceding-sibling::if/*[self::interface or self::collection or self::enumerator] |
     424      following-sibling::if/*[self::interface or self::collection or self::enumerator]
     425    ">
     426      <xsl:if test="
     427        ((name()='interface' or name()='collection')
     428         and
     429         (.//method/param[@type=$name] or attribute[@type=$name]))
     430        or
     431        ((name()='collection' or name()='enumerator') and @type=$name)
     432      ">
     433        <xsl:text>    friend class C</xsl:text>
     434        <xsl:value-of select="substring(@name,2)"/>
     435        <xsl:text>;&#x0A;</xsl:text>
     436      </xsl:if>
     437    </xsl:for-each>
     438  </xsl:if>
    439439
    440440</xsl:template>
     
    442442<!-- attribute declarations -->
    443443<xsl:template match="interface//attribute | collection//attribute" mode="declare">
    444     <xsl:if test="@array">
    445         <xsl:message terminate="yes">
    446             <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
    447             <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
    448         </xsl:message>
    449     </xsl:if>
    450     <xsl:apply-templates select="parent::node()" mode="begin"/>
    451     <xsl:apply-templates select="@if" mode="begin"/>
     444  <xsl:if test="@array">
     445    <xsl:message terminate="yes">
     446      <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/>
     447      <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
     448    </xsl:message>
     449  </xsl:if>
     450  <xsl:apply-templates select="parent::node()" mode="begin"/>
     451  <xsl:apply-templates select="@if" mode="begin"/>
     452  <xsl:call-template name="composeMethod">
     453    <xsl:with-param name="return" select="."/>
     454  </xsl:call-template>
     455  <xsl:if test="not(@readonly='yes')">
    452456    <xsl:call-template name="composeMethod">
    453         <xsl:with-param name="return" select="."/>
     457      <xsl:with-param name="return" select="''"/>
    454458    </xsl:call-template>
    455     <xsl:if test="not(@readonly='yes')">
    456         <xsl:call-template name="composeMethod">
    457             <xsl:with-param name="return" select="''"/>
    458         </xsl:call-template>
    459     </xsl:if>
    460     <xsl:apply-templates select="@if" mode="end"/>
    461     <xsl:apply-templates select="parent::node()" mode="end"/>
     459  </xsl:if>
     460  <xsl:apply-templates select="@if" mode="end"/>
     461  <xsl:apply-templates select="parent::node()" mode="end"/>
    462462</xsl:template>
    463463
    464464<!-- method declarations -->
    465465<xsl:template match="interface//method | collection//method" mode="declare">
    466     <xsl:apply-templates select="parent::node()" mode="begin"/>
    467     <xsl:apply-templates select="@if" mode="begin"/>
    468     <xsl:call-template name="composeMethod"/>
    469     <xsl:apply-templates select="@if" mode="end"/>
    470     <xsl:apply-templates select="parent::node()" mode="end"/>
     466  <xsl:apply-templates select="parent::node()" mode="begin"/>
     467  <xsl:apply-templates select="@if" mode="begin"/>
     468  <xsl:call-template name="composeMethod"/>
     469  <xsl:apply-templates select="@if" mode="end"/>
     470  <xsl:apply-templates select="parent::node()" mode="end"/>
    471471</xsl:template>
    472472
     
    477477<xsl:template match="interface | collection | enumerator" mode="define">
    478478
    479     <xsl:text>// </xsl:text>
    480     <xsl:value-of select="@name"/>
    481     <xsl:text> wrapper&#x0A;&#x0A;</xsl:text>
    482 
    483     <xsl:if test="name()='collection'">
    484         <!-- GetCount -->
    485         <xsl:text>inline ULONG C</xsl:text>
    486         <xsl:value-of select="substring(@name,2)"/>
    487         <xsl:text>::GetCount () const&#x0A;{&#x0A;</xsl:text>
    488         <xsl:text>    ULONG count = 0;&#x0A;</xsl:text>
    489         <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
    490         <xsl:text>    if (!mIface)&#x0A;        return count;&#x0A;</xsl:text>
    491         <xsl:text>    mRC = mIface->COMGETTER(Count) (&amp;count);&#x0A;</xsl:text>
    492         <xsl:call-template name="tryComposeFetchErrorInfo"/>
    493         <xsl:text>    return count;&#x0A;</xsl:text>
    494         <xsl:text>}&#x0A;&#x0A;</xsl:text>
    495         <!-- GetItemAt -->
    496         <xsl:text>inline </xsl:text>
    497         <xsl:apply-templates select="@type"/>
    498         <xsl:text> C</xsl:text>
    499         <xsl:value-of select="substring(@name,2)"/>
    500         <xsl:text>::GetItemAt (ULONG index) const&#x0A;{&#x0A;</xsl:text>
    501         <xsl:text>    </xsl:text><xsl:apply-templates select="@type"/>
    502         <xsl:text> item;&#x0A;</xsl:text>
    503         <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
    504         <xsl:text>    if (!mIface)&#x0A;        return item;&#x0A;</xsl:text>
    505         <xsl:text>    mRC = mIface->GetItemAt (index, &amp;item.mIface);&#x0A;</xsl:text>
    506         <xsl:call-template name="tryComposeFetchErrorInfo"/>
    507         <xsl:text>    return item;&#x0A;</xsl:text>
    508         <xsl:text>}&#x0A;&#x0A;</xsl:text>
    509         <!-- Enumerate -->
    510         <xsl:text>inline </xsl:text>
    511         <xsl:apply-templates select="@enumerator"/>
    512         <xsl:text> C</xsl:text>
    513         <xsl:value-of select="substring(@name,2)"/>
    514         <xsl:text>::Enumerate () const&#x0A;{&#x0A;</xsl:text>
    515         <xsl:text>    </xsl:text><xsl:apply-templates select="@enumerator"/>
    516         <xsl:text> enumerator;&#x0A;</xsl:text>
    517         <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
    518         <xsl:text>    if (!mIface)&#x0A;        return enumerator;&#x0A;</xsl:text>
    519         <xsl:text>    mRC = mIface->Enumerate (&amp;enumerator.mIface);&#x0A;</xsl:text>
    520         <xsl:call-template name="tryComposeFetchErrorInfo"/>
    521         <xsl:text>    return enumerator;&#x0A;</xsl:text>
    522         <xsl:text>}&#x0A;&#x0A;</xsl:text>
    523     </xsl:if>
    524 
    525     <xsl:if test="name()='enumerator'">
    526         <!-- HasMore -->
    527         <xsl:text>inline BOOL C</xsl:text>
    528         <xsl:value-of select="substring(@name,2)"/>
    529         <xsl:text>::HasMore () const&#x0A;{&#x0A;</xsl:text>
    530         <xsl:text>    BOOL more = FALSE;&#x0A;</xsl:text>
    531         <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
    532         <xsl:text>    if (!mIface)&#x0A;        return more;&#x0A;</xsl:text>
    533         <xsl:text>    mRC = mIface->HasMore (&amp;more);&#x0A;</xsl:text>
    534         <xsl:call-template name="tryComposeFetchErrorInfo"/>
    535         <xsl:text>    return more;&#x0A;</xsl:text>
    536         <xsl:text>}&#x0A;&#x0A;</xsl:text>
    537         <!-- GetNext -->
    538         <xsl:text>inline </xsl:text>
    539         <xsl:apply-templates select="@type"/>
    540         <xsl:text> C</xsl:text>
    541         <xsl:value-of select="substring(@name,2)"/>
    542         <xsl:text>::GetNext () const&#x0A;{&#x0A;</xsl:text>
    543         <xsl:text>    </xsl:text><xsl:apply-templates select="@type"/>
    544         <xsl:text> next;&#x0A;</xsl:text>
    545         <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
    546         <xsl:text>    if (!mIface)&#x0A;        return next;&#x0A;</xsl:text>
    547         <xsl:text>    mRC = mIface->GetNext (&amp;next.mIface);&#x0A;</xsl:text>
    548         <xsl:call-template name="tryComposeFetchErrorInfo"/>
    549         <xsl:text>    return next;&#x0A;</xsl:text>
    550         <xsl:text>}&#x0A;&#x0A;</xsl:text>
    551     </xsl:if>
    552 
    553     <xsl:if test="name()='interface' or name()='collection'">
    554         <xsl:call-template name="defineMembers"/>
    555     </xsl:if>
     479  <xsl:text>// </xsl:text>
     480  <xsl:value-of select="@name"/>
     481  <xsl:text> wrapper&#x0A;&#x0A;</xsl:text>
     482
     483  <xsl:if test="name()='collection'">
     484    <!-- GetCount -->
     485    <xsl:text>inline ULONG C</xsl:text>
     486    <xsl:value-of select="substring(@name,2)"/>
     487    <xsl:text>::GetCount () const&#x0A;{&#x0A;</xsl:text>
     488    <xsl:text>    ULONG count = 0;&#x0A;</xsl:text>
     489    <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
     490    <xsl:text>    if (!mIface)&#x0A;        return count;&#x0A;</xsl:text>
     491    <xsl:text>    mRC = mIface->COMGETTER(Count) (&amp;count);&#x0A;</xsl:text>
     492    <xsl:call-template name="tryComposeFetchErrorInfo"/>
     493    <xsl:text>    return count;&#x0A;</xsl:text>
     494    <xsl:text>}&#x0A;&#x0A;</xsl:text>
     495    <!-- GetItemAt -->
     496    <xsl:text>inline </xsl:text>
     497    <xsl:apply-templates select="@type"/>
     498    <xsl:text> C</xsl:text>
     499    <xsl:value-of select="substring(@name,2)"/>
     500    <xsl:text>::GetItemAt (ULONG index) const&#x0A;{&#x0A;</xsl:text>
     501    <xsl:text>    </xsl:text><xsl:apply-templates select="@type"/>
     502    <xsl:text> item;&#x0A;</xsl:text>
     503    <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
     504    <xsl:text>    if (!mIface)&#x0A;        return item;&#x0A;</xsl:text>
     505    <xsl:text>    mRC = mIface->GetItemAt (index, &amp;item.mIface);&#x0A;</xsl:text>
     506    <xsl:call-template name="tryComposeFetchErrorInfo"/>
     507    <xsl:text>    return item;&#x0A;</xsl:text>
     508    <xsl:text>}&#x0A;&#x0A;</xsl:text>
     509    <!-- Enumerate -->
     510    <xsl:text>inline </xsl:text>
     511    <xsl:apply-templates select="@enumerator"/>
     512    <xsl:text> C</xsl:text>
     513    <xsl:value-of select="substring(@name,2)"/>
     514    <xsl:text>::Enumerate () const&#x0A;{&#x0A;</xsl:text>
     515    <xsl:text>    </xsl:text><xsl:apply-templates select="@enumerator"/>
     516    <xsl:text> enumerator;&#x0A;</xsl:text>
     517    <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
     518    <xsl:text>    if (!mIface)&#x0A;        return enumerator;&#x0A;</xsl:text>
     519    <xsl:text>    mRC = mIface->Enumerate (&amp;enumerator.mIface);&#x0A;</xsl:text>
     520    <xsl:call-template name="tryComposeFetchErrorInfo"/>
     521    <xsl:text>    return enumerator;&#x0A;</xsl:text>
     522    <xsl:text>}&#x0A;&#x0A;</xsl:text>
     523  </xsl:if>
     524
     525  <xsl:if test="name()='enumerator'">
     526    <!-- HasMore -->
     527    <xsl:text>inline BOOL C</xsl:text>
     528    <xsl:value-of select="substring(@name,2)"/>
     529    <xsl:text>::HasMore () const&#x0A;{&#x0A;</xsl:text>
     530    <xsl:text>    BOOL more = FALSE;&#x0A;</xsl:text>
     531    <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
     532    <xsl:text>    if (!mIface)&#x0A;        return more;&#x0A;</xsl:text>
     533    <xsl:text>    mRC = mIface->HasMore (&amp;more);&#x0A;</xsl:text>
     534    <xsl:call-template name="tryComposeFetchErrorInfo"/>
     535    <xsl:text>    return more;&#x0A;</xsl:text>
     536    <xsl:text>}&#x0A;&#x0A;</xsl:text>
     537    <!-- GetNext -->
     538    <xsl:text>inline </xsl:text>
     539    <xsl:apply-templates select="@type"/>
     540    <xsl:text> C</xsl:text>
     541    <xsl:value-of select="substring(@name,2)"/>
     542    <xsl:text>::GetNext () const&#x0A;{&#x0A;</xsl:text>
     543    <xsl:text>    </xsl:text><xsl:apply-templates select="@type"/>
     544    <xsl:text> next;&#x0A;</xsl:text>
     545    <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
     546    <xsl:text>    if (!mIface)&#x0A;        return next;&#x0A;</xsl:text>
     547    <xsl:text>    mRC = mIface->GetNext (&amp;next.mIface);&#x0A;</xsl:text>
     548    <xsl:call-template name="tryComposeFetchErrorInfo"/>
     549    <xsl:text>    return next;&#x0A;</xsl:text>
     550    <xsl:text>}&#x0A;&#x0A;</xsl:text>
     551  </xsl:if>
     552
     553  <xsl:if test="name()='interface' or name()='collection'">
     554    <xsl:call-template name="defineMembers"/>
     555  </xsl:if>
    556556
    557557</xsl:template>
     
    564564<!-- attribute definitions -->
    565565<xsl:template match="interface//attribute | collection//attribute" mode="define">
    566     <xsl:apply-templates select="parent::node()" mode="begin"/>
    567     <xsl:apply-templates select="@if" mode="begin"/>
     566  <xsl:apply-templates select="parent::node()" mode="begin"/>
     567  <xsl:apply-templates select="@if" mode="begin"/>
     568  <xsl:call-template name="composeMethod">
     569    <xsl:with-param name="return" select="."/>
     570    <xsl:with-param name="define" select="'yes'"/>
     571  </xsl:call-template>
     572  <xsl:if test="not(@readonly='yes')">
    568573    <xsl:call-template name="composeMethod">
    569         <xsl:with-param name="return" select="."/>
    570         <xsl:with-param name="define" select="'yes'"/>
     574      <xsl:with-param name="return" select="''"/>
     575      <xsl:with-param name="define" select="'yes'"/>
    571576    </xsl:call-template>
    572     <xsl:if test="not(@readonly='yes')">
    573         <xsl:call-template name="composeMethod">
    574             <xsl:with-param name="return" select="''"/>
    575             <xsl:with-param name="define" select="'yes'"/>
    576         </xsl:call-template>
    577     </xsl:if>
    578     <xsl:apply-templates select="@if" mode="end"/>
    579     <xsl:apply-templates select="parent::node()" mode="end"/>
    580     <xsl:text>&#x0A;</xsl:text>
     577  </xsl:if>
     578  <xsl:apply-templates select="@if" mode="end"/>
     579  <xsl:apply-templates select="parent::node()" mode="end"/>
     580  <xsl:text>&#x0A;</xsl:text>
    581581</xsl:template>
    582582
    583583<!-- method definitions -->
    584584<xsl:template match="interface//method | collection//method" mode="define">
    585     <xsl:apply-templates select="parent::node()" mode="begin"/>
    586     <xsl:apply-templates select="@if" mode="begin"/>
    587     <xsl:call-template name="composeMethod">
    588         <xsl:with-param name="define" select="'yes'"/>
    589     </xsl:call-template>
    590     <xsl:apply-templates select="@if" mode="end"/>
    591     <xsl:apply-templates select="parent::node()" mode="end"/>
    592     <xsl:text>&#x0A;</xsl:text>
     585  <xsl:apply-templates select="parent::node()" mode="begin"/>
     586  <xsl:apply-templates select="@if" mode="begin"/>
     587  <xsl:call-template name="composeMethod">
     588    <xsl:with-param name="define" select="'yes'"/>
     589  </xsl:call-template>
     590  <xsl:apply-templates select="@if" mode="end"/>
     591  <xsl:apply-templates select="parent::node()" mode="end"/>
     592  <xsl:text>&#x0A;</xsl:text>
    593593</xsl:template>
    594594
     
    620620-->
    621621<xsl:template name="composeMethod">
    622     <xsl:param name="return" select="param[@dir='return']"/>
    623     <xsl:param name="define" select="''"/>
    624     <xsl:variable name="namespace" select="(ancestor::interface | ancestor::collection)[1]"/>
    625     <xsl:choose>
    626         <!-- no return value -->
    627         <xsl:when test="not($return)">
    628             <xsl:choose>
    629                 <xsl:when test="$define">
    630                     <xsl:text>inline </xsl:text>
    631                 </xsl:when>
    632                 <xsl:otherwise>
    633                     <xsl:text>    </xsl:text>
    634                 </xsl:otherwise>
    635             </xsl:choose>
    636             <xsl:text>void </xsl:text>
    637             <xsl:if test="$define">
    638                 <xsl:text>C</xsl:text>
    639                 <xsl:value-of select="substring($namespace/@name,2)"/>
    640                 <xsl:text>::</xsl:text>
    641             </xsl:if>
    642             <xsl:call-template name="composeMethodDecl">
    643                 <xsl:with-param name="isSetter" select="'yes'"/>
    644             </xsl:call-template>
    645             <xsl:if test="$define">
    646                 <xsl:text>&#x0A;{&#x0A;</xsl:text>
    647                 <!-- iface assertion -->
    648                 <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
    649                 <xsl:text>    if (!mIface)&#x0A;        return;&#x0A;</xsl:text>
    650                 <!-- method call -->
    651                 <xsl:call-template name="composeMethodCall">
    652                     <xsl:with-param name="isSetter" select="'yes'"/>
    653                 </xsl:call-template>
    654                 <xsl:text>}&#x0A;</xsl:text>
    655             </xsl:if>
    656             <xsl:if test="not($define)">
    657                 <xsl:text>;&#x0A;</xsl:text>
    658             </xsl:if>
    659         </xsl:when>
    660         <!-- has a return value -->
    661         <xsl:when test="count($return) = 1">
    662             <xsl:choose>
    663                 <xsl:when test="$define">
    664                     <xsl:text>inline </xsl:text>
    665                 </xsl:when>
    666                 <xsl:otherwise>
    667                     <xsl:text>    </xsl:text>
    668                 </xsl:otherwise>
    669             </xsl:choose>
    670             <xsl:apply-templates select="$return/@type"/>
    671             <xsl:text> </xsl:text>
    672             <xsl:if test="$define">
    673                 <xsl:text>C</xsl:text>
    674                 <xsl:value-of select="substring($namespace/@name,2)"/>
    675                 <xsl:text>::</xsl:text>
    676             </xsl:if>
    677             <xsl:call-template name="composeMethodDecl"/>
    678             <xsl:if test="$define">
    679                 <xsl:text>&#x0A;{&#x0A;    </xsl:text>
    680                 <xsl:apply-templates select="$return/@type"/>
    681                 <xsl:text> a</xsl:text>
    682                 <xsl:call-template name="capitalize">
    683                     <xsl:with-param name="str" select="$return/@name"/>
    684                 </xsl:call-template>
    685                 <xsl:apply-templates select="$return/@type" mode="initializer"/>
    686                 <xsl:text>;&#x0A;</xsl:text>
    687                 <!-- iface assertion -->
    688                 <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
    689                 <xsl:text>    if (!mIface)&#x0A;        return a</xsl:text>
    690                 <xsl:call-template name="capitalize">
    691                     <xsl:with-param name="str" select="$return/@name"/>
    692                 </xsl:call-template>
    693                 <xsl:text>;&#x0A;</xsl:text>
    694                 <!-- method call -->
    695                 <xsl:call-template name="composeMethodCall"/>
    696                 <!-- return statement -->
    697                 <xsl:text>    return a</xsl:text>
    698                 <xsl:call-template name="capitalize">
    699                     <xsl:with-param name="str" select="$return/@name"/>
    700                 </xsl:call-template>
    701                 <xsl:text>;&#x0A;}&#x0A;</xsl:text>
    702             </xsl:if>
    703             <xsl:if test="not($define)">
    704                 <xsl:text>;&#x0A;</xsl:text>
    705             </xsl:if>
    706         </xsl:when>
    707         <!-- otherwise error -->
     622  <xsl:param name="return" select="param[@dir='return']"/>
     623  <xsl:param name="define" select="''"/>
     624  <xsl:variable name="namespace" select="(ancestor::interface | ancestor::collection)[1]"/>
     625  <xsl:choose>
     626    <!-- no return value -->
     627    <xsl:when test="not($return)">
     628      <xsl:choose>
     629        <xsl:when test="$define">
     630          <xsl:text>inline </xsl:text>
     631        </xsl:when>
    708632        <xsl:otherwise>
    709             <xsl:message terminate="yes">
    710                 <xsl:text>More than one return value in method: </xsl:text>
    711                 <xsl:value-of select="$namespace/@name"/>
    712                 <xsl:text>::</xsl:text>
    713                 <xsl:value-of select="@name"/>
    714             </xsl:message>
     633          <xsl:text>    </xsl:text>
    715634        </xsl:otherwise>
    716     </xsl:choose>
     635      </xsl:choose>
     636      <xsl:text>void </xsl:text>
     637      <xsl:if test="$define">
     638        <xsl:text>C</xsl:text>
     639        <xsl:value-of select="substring($namespace/@name,2)"/>
     640        <xsl:text>::</xsl:text>
     641      </xsl:if>
     642      <xsl:call-template name="composeMethodDecl">
     643        <xsl:with-param name="isSetter" select="'yes'"/>
     644      </xsl:call-template>
     645      <xsl:if test="$define">
     646        <xsl:text>&#x0A;{&#x0A;</xsl:text>
     647        <!-- iface assertion -->
     648        <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
     649        <xsl:text>    if (!mIface)&#x0A;        return;&#x0A;</xsl:text>
     650        <!-- method call -->
     651        <xsl:call-template name="composeMethodCall">
     652          <xsl:with-param name="isSetter" select="'yes'"/>
     653        </xsl:call-template>
     654        <xsl:text>}&#x0A;</xsl:text>
     655      </xsl:if>
     656      <xsl:if test="not($define)">
     657        <xsl:text>;&#x0A;</xsl:text>
     658      </xsl:if>
     659    </xsl:when>
     660    <!-- has a return value -->
     661    <xsl:when test="count($return) = 1">
     662      <xsl:choose>
     663        <xsl:when test="$define">
     664          <xsl:text>inline </xsl:text>
     665        </xsl:when>
     666        <xsl:otherwise>
     667          <xsl:text>    </xsl:text>
     668        </xsl:otherwise>
     669      </xsl:choose>
     670      <xsl:apply-templates select="$return/@type"/>
     671      <xsl:text> </xsl:text>
     672      <xsl:if test="$define">
     673        <xsl:text>C</xsl:text>
     674        <xsl:value-of select="substring($namespace/@name,2)"/>
     675        <xsl:text>::</xsl:text>
     676      </xsl:if>
     677      <xsl:call-template name="composeMethodDecl"/>
     678      <xsl:if test="$define">
     679        <xsl:text>&#x0A;{&#x0A;    </xsl:text>
     680        <xsl:apply-templates select="$return/@type"/>
     681        <xsl:text> a</xsl:text>
     682        <xsl:call-template name="capitalize">
     683          <xsl:with-param name="str" select="$return/@name"/>
     684        </xsl:call-template>
     685        <xsl:apply-templates select="$return/@type" mode="initializer"/>
     686        <xsl:text>;&#x0A;</xsl:text>
     687        <!-- iface assertion -->
     688        <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
     689        <xsl:text>    if (!mIface)&#x0A;        return a</xsl:text>
     690        <xsl:call-template name="capitalize">
     691          <xsl:with-param name="str" select="$return/@name"/>
     692        </xsl:call-template>
     693        <xsl:text>;&#x0A;</xsl:text>
     694        <!-- method call -->
     695        <xsl:call-template name="composeMethodCall"/>
     696        <!-- return statement -->
     697        <xsl:text>    return a</xsl:text>
     698        <xsl:call-template name="capitalize">
     699          <xsl:with-param name="str" select="$return/@name"/>
     700        </xsl:call-template>
     701        <xsl:text>;&#x0A;}&#x0A;</xsl:text>
     702      </xsl:if>
     703      <xsl:if test="not($define)">
     704        <xsl:text>;&#x0A;</xsl:text>
     705      </xsl:if>
     706    </xsl:when>
     707    <!-- otherwise error -->
     708    <xsl:otherwise>
     709      <xsl:message terminate="yes">
     710        <xsl:text>More than one return value in method: </xsl:text>
     711        <xsl:value-of select="$namespace/@name"/>
     712        <xsl:text>::</xsl:text>
     713        <xsl:value-of select="@name"/>
     714      </xsl:message>
     715    </xsl:otherwise>
     716  </xsl:choose>
    717717</xsl:template>
    718718
    719719<xsl:template name="composeMethodDecl">
    720     <xsl:param name="isSetter" select="''"/>
    721     <xsl:choose>
    722         <!-- attribute method call -->
    723         <xsl:when test="name()='attribute'">
    724             <xsl:choose>
    725                 <xsl:when test="$isSetter">
    726                     <!-- name -->
    727                     <xsl:text>Set</xsl:text>
    728                     <xsl:call-template name="capitalize">
    729                         <xsl:with-param name="str" select="@name"/>
    730                     </xsl:call-template>
    731                     <xsl:text> (</xsl:text>
    732                     <!-- parameter -->
    733                     <xsl:apply-templates select="@type" mode="param"/>
    734                     <xsl:text> a</xsl:text>
    735                     <xsl:call-template name="capitalize">
    736                         <xsl:with-param name="str" select="@name"/>
    737                     </xsl:call-template>
    738                     <xsl:text>)</xsl:text>
    739                 </xsl:when>
    740                 <xsl:otherwise>
    741                     <!-- name -->
    742                     <xsl:text>Get</xsl:text>
    743                     <xsl:call-template name="capitalize">
    744                         <xsl:with-param name="str" select="@name"/>
    745                     </xsl:call-template>
    746                     <xsl:text> (</xsl:text>
    747                     <!-- const method -->
    748                     <xsl:text>) const</xsl:text>
    749                 </xsl:otherwise>
    750             </xsl:choose>
    751         </xsl:when>
    752         <!-- regular method call -->
    753         <xsl:when test="name()='method'">
    754             <!-- name -->
    755             <xsl:call-template name="capitalize">
    756                 <xsl:with-param name="str" select="@name"/>
    757             </xsl:call-template>
    758             <xsl:text> (</xsl:text>
    759             <!-- parameters -->
    760             <xsl:for-each select="param[@dir!='return']">
    761                 <xsl:apply-templates select="@type" mode="param"/>
    762                 <xsl:text> a</xsl:text>
    763                 <xsl:call-template name="capitalize">
    764                     <xsl:with-param name="str" select="@name"/>
    765                 </xsl:call-template>
    766                 <xsl:if test="position() != last()">
    767                     <xsl:text>, </xsl:text>
    768                 </xsl:if>
    769             </xsl:for-each>
    770             <xsl:text>)</xsl:text>
    771             <!-- const method -->
    772             <xsl:if test="@const='yes'"> const</xsl:if>
    773         </xsl:when>
    774     </xsl:choose>
     720  <xsl:param name="isSetter" select="''"/>
     721  <xsl:choose>
     722    <!-- attribute method call -->
     723    <xsl:when test="name()='attribute'">
     724      <xsl:choose>
     725        <xsl:when test="$isSetter">
     726          <!-- name -->
     727          <xsl:text>Set</xsl:text>
     728          <xsl:call-template name="capitalize">
     729            <xsl:with-param name="str" select="@name"/>
     730          </xsl:call-template>
     731          <xsl:text> (</xsl:text>
     732          <!-- parameter -->
     733          <xsl:apply-templates select="@type" mode="param"/>
     734          <xsl:text> a</xsl:text>
     735          <xsl:call-template name="capitalize">
     736            <xsl:with-param name="str" select="@name"/>
     737          </xsl:call-template>
     738          <xsl:text>)</xsl:text>
     739        </xsl:when>
     740        <xsl:otherwise>
     741          <!-- name -->
     742          <xsl:text>Get</xsl:text>
     743          <xsl:call-template name="capitalize">
     744            <xsl:with-param name="str" select="@name"/>
     745          </xsl:call-template>
     746          <xsl:text> (</xsl:text>
     747          <!-- const method -->
     748          <xsl:text>) const</xsl:text>
     749        </xsl:otherwise>
     750      </xsl:choose>
     751    </xsl:when>
     752    <!-- regular method call -->
     753    <xsl:when test="name()='method'">
     754      <!-- name -->
     755      <xsl:call-template name="capitalize">
     756        <xsl:with-param name="str" select="@name"/>
     757      </xsl:call-template>
     758      <xsl:text> (</xsl:text>
     759      <!-- parameters -->
     760      <xsl:for-each select="param[@dir!='return']">
     761        <xsl:apply-templates select="@type" mode="param"/>
     762        <xsl:text> a</xsl:text>
     763        <xsl:call-template name="capitalize">
     764          <xsl:with-param name="str" select="@name"/>
     765        </xsl:call-template>
     766        <xsl:if test="position() != last()">
     767          <xsl:text>, </xsl:text>
     768        </xsl:if>
     769      </xsl:for-each>
     770      <xsl:text>)</xsl:text>
     771      <!-- const method -->
     772      <xsl:if test="@const='yes'"> const</xsl:if>
     773    </xsl:when>
     774  </xsl:choose>
    775775</xsl:template>
    776776
    777777<xsl:template name="composeMethodCall">
    778     <xsl:param name="isSetter" select="''"/>
    779     <!-- apply 'pre-call' hooks -->
    780     <xsl:choose>
    781         <xsl:when test="name()='attribute'">
    782             <xsl:call-template name="hooks">
    783                 <xsl:with-param name="when" select="'pre-call'"/>
    784                 <xsl:with-param name="isSetter" select="$isSetter"/>
    785             </xsl:call-template>
    786         </xsl:when>
    787         <xsl:when test="name()='method'">
    788             <xsl:for-each select="param">
    789                 <xsl:call-template name="hooks">
    790                     <xsl:with-param name="when" select="'pre-call'"/>
    791                 </xsl:call-template>
    792             </xsl:for-each>
    793         </xsl:when>
    794     </xsl:choose>
    795     <!-- start the call -->
    796     <xsl:text>    mRC = mIface-></xsl:text>
    797     <xsl:choose>
    798         <!-- attribute method call -->
    799         <xsl:when test="name()='attribute'">
    800             <!-- method name -->
    801             <xsl:choose>
    802                 <xsl:when test="$isSetter">
    803                     <xsl:text>COMSETTER(</xsl:text>
    804                 </xsl:when>
    805                 <xsl:otherwise>
    806                     <xsl:text>COMGETTER(</xsl:text>
    807                 </xsl:otherwise>
    808             </xsl:choose>
    809             <xsl:call-template name="capitalize">
    810                 <xsl:with-param name="str" select="@name"/>
    811             </xsl:call-template>
    812             <xsl:text>) (</xsl:text>
    813             <!-- parameter -->
    814             <xsl:call-template name="composeMethodCallParam">
    815                 <xsl:with-param name="isIn" select="$isSetter"/>
    816                 <xsl:with-param name="isOut" select="not($isSetter)"/>
    817             </xsl:call-template>
    818         </xsl:when>
    819         <!-- regular method call -->
    820         <xsl:when test="name()='method'">
    821             <!-- method name -->
    822             <xsl:call-template name="capitalize">
    823                 <xsl:with-param name="str" select="@name"/>
    824             </xsl:call-template>
    825             <xsl:text> (</xsl:text>
    826             <!-- parameters -->
    827             <xsl:for-each select="param">
    828                 <xsl:call-template name="composeMethodCallParam"/>
    829                 <xsl:if test="position() != last()">
    830                     <xsl:text>, </xsl:text>
    831                 </xsl:if>
    832             </xsl:for-each>
    833         </xsl:when>
    834     </xsl:choose>
    835     <xsl:text>);&#x0A;</xsl:text>
    836     <!-- apply 'post-call' hooks -->
    837     <xsl:choose>
    838         <xsl:when test="name()='attribute'">
    839             <xsl:call-template name="hooks">
    840                 <xsl:with-param name="when" select="'post-call'"/>
    841                 <xsl:with-param name="isSetter" select="$isSetter"/>
    842             </xsl:call-template>
    843         </xsl:when>
    844         <xsl:when test="name()='method'">
    845             <xsl:for-each select="param">
    846                 <xsl:call-template name="hooks">
    847                     <xsl:with-param name="when" select="'post-call'"/>
    848                 </xsl:call-template>
    849             </xsl:for-each>
    850         </xsl:when>
    851     </xsl:choose>
    852     <!-- -->
    853     <xsl:call-template name="tryComposeFetchErrorInfo"/>
     778  <xsl:param name="isSetter" select="''"/>
     779  <!-- apply 'pre-call' hooks -->
     780  <xsl:choose>
     781    <xsl:when test="name()='attribute'">
     782      <xsl:call-template name="hooks">
     783        <xsl:with-param name="when" select="'pre-call'"/>
     784        <xsl:with-param name="isSetter" select="$isSetter"/>
     785      </xsl:call-template>
     786    </xsl:when>
     787    <xsl:when test="name()='method'">
     788      <xsl:for-each select="param">
     789        <xsl:call-template name="hooks">
     790          <xsl:with-param name="when" select="'pre-call'"/>
     791        </xsl:call-template>
     792      </xsl:for-each>
     793    </xsl:when>
     794  </xsl:choose>
     795  <!-- start the call -->
     796  <xsl:text>    mRC = mIface-></xsl:text>
     797  <xsl:choose>
     798    <!-- attribute method call -->
     799    <xsl:when test="name()='attribute'">
     800      <!-- method name -->
     801      <xsl:choose>
     802        <xsl:when test="$isSetter">
     803          <xsl:text>COMSETTER(</xsl:text>
     804        </xsl:when>
     805        <xsl:otherwise>
     806          <xsl:text>COMGETTER(</xsl:text>
     807        </xsl:otherwise>
     808      </xsl:choose>
     809      <xsl:call-template name="capitalize">
     810        <xsl:with-param name="str" select="@name"/>
     811      </xsl:call-template>
     812      <xsl:text>) (</xsl:text>
     813      <!-- parameter -->
     814      <xsl:call-template name="composeMethodCallParam">
     815        <xsl:with-param name="isIn" select="$isSetter"/>
     816        <xsl:with-param name="isOut" select="not($isSetter)"/>
     817      </xsl:call-template>
     818    </xsl:when>
     819    <!-- regular method call -->
     820    <xsl:when test="name()='method'">
     821      <!-- method name -->
     822      <xsl:call-template name="capitalize">
     823        <xsl:with-param name="str" select="@name"/>
     824      </xsl:call-template>
     825      <xsl:text> (</xsl:text>
     826      <!-- parameters -->
     827      <xsl:for-each select="param">
     828        <xsl:call-template name="composeMethodCallParam"/>
     829        <xsl:if test="position() != last()">
     830          <xsl:text>, </xsl:text>
     831        </xsl:if>
     832      </xsl:for-each>
     833    </xsl:when>
     834  </xsl:choose>
     835  <xsl:text>);&#x0A;</xsl:text>
     836  <!-- apply 'post-call' hooks -->
     837  <xsl:choose>
     838    <xsl:when test="name()='attribute'">
     839      <xsl:call-template name="hooks">
     840        <xsl:with-param name="when" select="'post-call'"/>
     841        <xsl:with-param name="isSetter" select="$isSetter"/>
     842      </xsl:call-template>
     843    </xsl:when>
     844    <xsl:when test="name()='method'">
     845      <xsl:for-each select="param">
     846        <xsl:call-template name="hooks">
     847          <xsl:with-param name="when" select="'post-call'"/>
     848        </xsl:call-template>
     849      </xsl:for-each>
     850    </xsl:when>
     851  </xsl:choose>
     852  <!-- -->
     853  <xsl:call-template name="tryComposeFetchErrorInfo"/>
    854854</xsl:template>
    855855
     
    865865-->
    866866<xsl:template name="tryComposeFetchErrorInfo">
    867     <xsl:param name="mode" select="''"/>
    868     <xsl:variable name="ifaceSupportsErrorInfo" select="
    869         (ancestor-or-self::interface |
    870          ancestor-or-self::collection |
    871          ancestor-or-self::enumerator)[1]/@supportsErrorInfo
    872     "/>
    873     <xsl:variable name="librarySupportsErrorInfo" select="ancestor::library/@supportsErrorInfo"/>
    874     <xsl:choose>
    875         <xsl:when test="$ifaceSupportsErrorInfo">
    876             <xsl:call-template name="composeFetchErrorInfo">
    877                 <xsl:with-param name="supports" select="string($ifaceSupportsErrorInfo)"/>
    878                 <xsl:with-param name="mode" select="$mode"/>
    879             </xsl:call-template>
    880         </xsl:when>
    881         <xsl:when test="$librarySupportsErrorInfo">
    882             <xsl:call-template name="composeFetchErrorInfo">
    883                 <xsl:with-param name="supports" select="string($librarySupportsErrorInfo)"/>
    884                 <xsl:with-param name="mode" select="$mode"/>
    885             </xsl:call-template>
    886         </xsl:when>
    887     </xsl:choose>
     867  <xsl:param name="mode" select="''"/>
     868  <xsl:variable name="ifaceSupportsErrorInfo" select="
     869    (ancestor-or-self::interface |
     870     ancestor-or-self::collection |
     871     ancestor-or-self::enumerator)[1]/@supportsErrorInfo
     872  "/>
     873  <xsl:variable name="librarySupportsErrorInfo" select="ancestor::library/@supportsErrorInfo"/>
     874  <xsl:choose>
     875    <xsl:when test="$ifaceSupportsErrorInfo">
     876      <xsl:call-template name="composeFetchErrorInfo">
     877        <xsl:with-param name="supports" select="string($ifaceSupportsErrorInfo)"/>
     878        <xsl:with-param name="mode" select="$mode"/>
     879      </xsl:call-template>
     880    </xsl:when>
     881    <xsl:when test="$librarySupportsErrorInfo">
     882      <xsl:call-template name="composeFetchErrorInfo">
     883        <xsl:with-param name="supports" select="string($librarySupportsErrorInfo)"/>
     884        <xsl:with-param name="mode" select="$mode"/>
     885      </xsl:call-template>
     886    </xsl:when>
     887  </xsl:choose>
    888888</xsl:template>
    889889
    890890<xsl:template name="composeFetchErrorInfo">
    891     <xsl:param name="supports" select="''"/>
    892     <xsl:param name="mode" select="''"/>
    893     <xsl:choose>
    894         <xsl:when test="$mode='getBaseClassName'">
    895             <xsl:if test="$supports='strict' or $supports='yes'">
    896                 <xsl:text>, COMBaseWithEI</xsl:text>
    897             </xsl:if>
     891  <xsl:param name="supports" select="''"/>
     892  <xsl:param name="mode" select="''"/>
     893  <xsl:choose>
     894    <xsl:when test="$mode='getBaseClassName'">
     895      <xsl:if test="$supports='strict' or $supports='yes'">
     896        <xsl:text>, COMBaseWithEI</xsl:text>
     897      </xsl:if>
     898    </xsl:when>
     899    <xsl:otherwise>
     900      <xsl:if test="$supports='strict' or $supports='yes'">
     901        <xsl:text>    if (mRC != S_OK)&#x0A;    {&#x0A;</xsl:text>
     902        <xsl:text>        fetchErrorInfo (mIface, &amp;COM_IIDOF (Base::Iface));&#x0A;</xsl:text>
     903        <xsl:if test="$supports='strict'">
     904          <xsl:text>        AssertMsg (errInfo.isFullAvailable(), </xsl:text>
     905          <xsl:text>("for RC=0x%08X\n", mRC));&#x0A;</xsl:text>
     906        </xsl:if>
     907        <xsl:text>    }&#x0A;</xsl:text>
     908      </xsl:if>
     909    </xsl:otherwise>
     910  </xsl:choose>
     911</xsl:template>
     912
     913<xsl:template name="composeMethodCallParam">
     914
     915  <xsl:param name="isIn" select="@dir='in'"/>
     916  <xsl:param name="isOut" select="@dir='out' or @dir='return'"/>
     917
     918  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
     919
     920  <xsl:choose>
     921    <!-- safearrays -->
     922    <xsl:when test="@safearray='yes'">
     923      <xsl:choose>
     924        <xsl:when test="$isIn">
     925          <xsl:text>ComSafeArrayAsInParam (</xsl:text>
     926          <xsl:value-of select="@name"/>
     927          <xsl:text>)</xsl:text>
     928        </xsl:when>
     929        <xsl:when test="$isOut">
     930          <xsl:text>ComSafeArrayAsOutParam (</xsl:text>
     931          <xsl:value-of select="@name"/>
     932          <xsl:text>)</xsl:text>
     933        </xsl:when>
     934      </xsl:choose>
     935    </xsl:when>
     936    <!-- string types -->
     937    <xsl:when test="@type = 'wstring'">
     938      <xsl:choose>
     939        <xsl:when test="$isIn">
     940          <xsl:text>BSTRIn (a</xsl:text>
     941          <xsl:call-template name="capitalize">
     942            <xsl:with-param name="str" select="@name"/>
     943          </xsl:call-template>
     944          <xsl:text>)</xsl:text>
     945        </xsl:when>
     946        <xsl:when test="$isOut">
     947          <xsl:text>BSTROut (a</xsl:text>
     948          <xsl:call-template name="capitalize">
     949            <xsl:with-param name="str" select="@name"/>
     950          </xsl:call-template>
     951          <xsl:text>)</xsl:text>
     952        </xsl:when>
     953      </xsl:choose>
     954    </xsl:when>
     955    <!-- uuid type -->
     956    <xsl:when test="@type = 'uuid'">
     957      <xsl:choose>
     958        <xsl:when test="$isIn">
     959          <xsl:text>GUIDIn (a</xsl:text>
     960          <xsl:call-template name="capitalize">
     961            <xsl:with-param name="str" select="@name"/>
     962          </xsl:call-template>
     963          <xsl:text>)</xsl:text>
     964        </xsl:when>
     965        <xsl:when test="$isOut">
     966          <xsl:text>GUIDOut (a</xsl:text>
     967          <xsl:call-template name="capitalize">
     968            <xsl:with-param name="str" select="@name"/>
     969          </xsl:call-template>
     970          <xsl:text>)</xsl:text>
     971        </xsl:when>
     972      </xsl:choose>
     973    </xsl:when>
     974    <!-- enum types -->
     975    <xsl:when test="
     976      (ancestor::library/enum[@name=current()/@type]) or
     977      (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type])
     978    ">
     979      <xsl:choose>
     980        <xsl:when test="$isIn">
     981          <xsl:text>(</xsl:text>
     982          <xsl:value-of select="@type"/>
     983          <xsl:text>_T) a</xsl:text>
     984          <xsl:call-template name="capitalize">
     985            <xsl:with-param name="str" select="@name"/>
     986          </xsl:call-template>
     987        </xsl:when>
     988        <xsl:when test="$isOut">
     989          <xsl:text>ENUMOut &lt;K</xsl:text>
     990          <xsl:value-of select="@type"/>
     991          <xsl:text>, </xsl:text>
     992          <xsl:value-of select="@type"/>
     993          <xsl:text>_T&gt; (a</xsl:text>
     994          <xsl:call-template name="capitalize">
     995            <xsl:with-param name="str" select="@name"/>
     996          </xsl:call-template>
     997          <xsl:text>)</xsl:text>
     998        </xsl:when>
     999      </xsl:choose>
     1000    </xsl:when>
     1001    <!-- interface types -->
     1002    <xsl:when test="
     1003      @type='$unknown' or
     1004      ((ancestor::library/enumerator[@name=current()/@type]) or
     1005       (ancestor::library/if[@target=$self_target]/enumerator[@name=current()/@type])
     1006      ) or
     1007      ((ancestor::library/interface[@name=current()/@type]) or
     1008       (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
     1009      ) or
     1010      ((ancestor::library/collection[@name=current()/@type]) or
     1011       (ancestor::library/if[@target=$self_target]/collection[@name=current()/@type])
     1012      )
     1013    ">
     1014      <xsl:choose>
     1015        <xsl:when test="$isIn">
     1016          <xsl:text>a</xsl:text>
     1017          <xsl:call-template name="capitalize">
     1018            <xsl:with-param name="str" select="@name"/>
     1019          </xsl:call-template>
     1020          <xsl:choose>
     1021            <xsl:when test="@type='$unknown'">
     1022              <xsl:text>.iface()</xsl:text>
     1023            </xsl:when>
     1024            <xsl:otherwise>
     1025              <xsl:text>.mIface</xsl:text>
     1026            </xsl:otherwise>
     1027          </xsl:choose>
     1028        </xsl:when>
     1029        <xsl:when test="$isOut">
     1030          <xsl:text>&amp;a</xsl:text>
     1031          <xsl:call-template name="capitalize">
     1032            <xsl:with-param name="str" select="@name"/>
     1033          </xsl:call-template>
     1034          <xsl:choose>
     1035            <xsl:when test="@type='$unknown'">
     1036              <xsl:text>.ifaceRef()</xsl:text>
     1037            </xsl:when>
     1038            <xsl:otherwise>
     1039              <xsl:text>.mIface</xsl:text>
     1040            </xsl:otherwise>
     1041          </xsl:choose>
     1042        </xsl:when>
     1043      </xsl:choose>
     1044    </xsl:when>
     1045    <!-- currently unsupported types -->
     1046    <xsl:when test="@type = 'string'">
     1047      <xsl:message terminate="yes">
     1048        <xsl:text>Parameter type </xsl:text>
     1049        <xsl:value-of select="@type"/>
     1050        <xsl:text>is not currently supported</xsl:text>
     1051      </xsl:message>
     1052    </xsl:when>
     1053    <!-- assuming scalar types -->
     1054    <xsl:otherwise>
     1055      <xsl:choose>
     1056        <xsl:when test="$isIn">
     1057          <xsl:text>a</xsl:text>
     1058          <xsl:call-template name="capitalize">
     1059            <xsl:with-param name="str" select="@name"/>
     1060          </xsl:call-template>
     1061        </xsl:when>
     1062        <xsl:when test="$isOut">
     1063          <xsl:text>&amp;a</xsl:text>
     1064          <xsl:call-template name="capitalize">
     1065            <xsl:with-param name="str" select="@name"/>
     1066          </xsl:call-template>
     1067        </xsl:when>
     1068      </xsl:choose>
     1069    </xsl:otherwise>
     1070  </xsl:choose>
     1071</xsl:template>
     1072
     1073
     1074<!--
     1075 *  attribute/parameter type conversion (returns plain Qt type name)
     1076-->
     1077<xsl:template match="
     1078  attribute/@type | param/@type |
     1079  enumerator/@type | collection/@type | collection/@enumerator
     1080">
     1081  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
     1082
     1083  <xsl:if test="../@array and ../@safearray='yes'">
     1084    <xsl:message terminate="yes">
     1085      <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1086      <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
     1087    </xsl:message>
     1088  </xsl:if>
     1089
     1090  <xsl:if test="../@array and ((name(..)='param' and ../@dir='return') or (name(..)='attribute'))">
     1091    <xsl:message terminate="yes">
     1092      <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1093      <xsl:text>return 'array' parameters and 'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
     1094    </xsl:message>
     1095  </xsl:if>
     1096
     1097  <xsl:choose>
     1098    <!-- modifiers (ignored for 'enumeration' attributes)-->
     1099    <xsl:when test="name(current())='type' and ../@mod">
     1100      <xsl:if test="../@safearray">
     1101        <xsl:message terminate="yes">
     1102          <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1103          <xsl:text>either 'safearray' or 'mod' attribute is allowed, but not both!</xsl:text>
     1104        </xsl:message>
     1105      </xsl:if>
     1106      <xsl:if test="../@array">
     1107        <xsl:message terminate="yes">
     1108          <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1109          <xsl:text>either 'array' or 'mod' attribute is allowed, but not both!</xsl:text>
     1110        </xsl:message>
     1111      </xsl:if>
     1112      <xsl:choose>
     1113        <xsl:when test="../@mod='ptr'">
     1114          <xsl:choose>
     1115            <!-- standard types -->
     1116            <!--xsl:when test=".='result'">??</xsl:when-->
     1117            <xsl:when test=".='boolean'">BOOL *</xsl:when>
     1118            <xsl:when test=".='octet'">BYTE *</xsl:when>
     1119            <xsl:when test=".='short'">SHORT *</xsl:when>
     1120            <xsl:when test=".='unsigned short'">USHORT *</xsl:when>
     1121            <xsl:when test=".='long'">LONG *</xsl:when>
     1122            <xsl:when test=".='long long'">LONG64 *</xsl:when>
     1123            <xsl:when test=".='unsigned long'">ULONG *</xsl:when>
     1124            <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when>
     1125            <xsl:when test=".='char'">CHAR *</xsl:when>
     1126            <!--<xsl:when test=".='string'">??</xsl:when-->
     1127            <xsl:when test=".='wchar'">OLECHAR *</xsl:when>
     1128            <!--<xsl:when test=".='wstring'">??</xsl:when-->
     1129            <xsl:otherwise>
     1130              <xsl:message terminate="yes">
     1131                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1132                <xsl:text>attribute 'mod=</xsl:text>
     1133                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
     1134                <xsl:text>' cannot be used with type </xsl:text>
     1135                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
     1136              </xsl:message>
     1137            </xsl:otherwise>
     1138          </xsl:choose>
    8981139        </xsl:when>
    8991140        <xsl:otherwise>
    900             <xsl:if test="$supports='strict' or $supports='yes'">
    901                 <xsl:text>    if (mRC != S_OK)&#x0A;    {&#x0A;</xsl:text>
    902                 <xsl:text>        fetchErrorInfo (mIface, &amp;COM_IIDOF (Base::Iface));&#x0A;</xsl:text>
    903                 <xsl:if test="$supports='strict'">
    904                     <xsl:text>        AssertMsg (errInfo.isFullAvailable(), </xsl:text>
    905                     <xsl:text>("for RC=0x%08X\n", mRC));&#x0A;</xsl:text>
    906                 </xsl:if>
    907                 <xsl:text>    }&#x0A;</xsl:text>
    908             </xsl:if>
     1141          <xsl:message terminate="yes">
     1142            <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1143            <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
     1144            <xsl:text>of attribute 'mod' is invalid!</xsl:text>
     1145          </xsl:message>
    9091146        </xsl:otherwise>
    910     </xsl:choose>
    911 </xsl:template>
    912 
    913 <xsl:template name="composeMethodCallParam">
    914 
    915     <xsl:param name="isIn" select="@dir='in'"/>
    916     <xsl:param name="isOut" select="@dir='out' or @dir='return'"/>
    917 
    918     <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
    919 
    920     <xsl:choose>
    921         <!-- safearrays -->
    922         <xsl:when test="@safearray='yes'">
    923             <xsl:choose>
    924                 <xsl:when test="$isIn">
    925                     <xsl:text>ComSafeArrayAsInParam (</xsl:text>
    926                     <xsl:value-of select="@name"/>
    927                     <xsl:text>)</xsl:text>
    928                 </xsl:when>
    929                 <xsl:when test="$isOut">
    930                     <xsl:text>ComSafeArrayAsOutParam (</xsl:text>
    931                     <xsl:value-of select="@name"/>
    932                     <xsl:text>)</xsl:text>
    933                 </xsl:when>
    934             </xsl:choose>
    935         </xsl:when>
    936         <!-- string types -->
    937         <xsl:when test="@type = 'wstring'">
    938             <xsl:choose>
    939                 <xsl:when test="$isIn">
    940                     <xsl:text>BSTRIn (a</xsl:text>
    941                     <xsl:call-template name="capitalize">
    942                         <xsl:with-param name="str" select="@name"/>
    943                     </xsl:call-template>
    944                     <xsl:text>)</xsl:text>
    945                 </xsl:when>
    946                 <xsl:when test="$isOut">
    947                     <xsl:text>BSTROut (a</xsl:text>
    948                     <xsl:call-template name="capitalize">
    949                         <xsl:with-param name="str" select="@name"/>
    950                     </xsl:call-template>
    951                     <xsl:text>)</xsl:text>
    952                 </xsl:when>
    953             </xsl:choose>
    954         </xsl:when>
    955         <!-- uuid type -->
    956         <xsl:when test="@type = 'uuid'">
    957             <xsl:choose>
    958                 <xsl:when test="$isIn">
    959                     <xsl:text>GUIDIn (a</xsl:text>
    960                     <xsl:call-template name="capitalize">
    961                         <xsl:with-param name="str" select="@name"/>
    962                     </xsl:call-template>
    963                     <xsl:text>)</xsl:text>
    964                 </xsl:when>
    965                 <xsl:when test="$isOut">
    966                     <xsl:text>GUIDOut (a</xsl:text>
    967                     <xsl:call-template name="capitalize">
    968                         <xsl:with-param name="str" select="@name"/>
    969                     </xsl:call-template>
    970                     <xsl:text>)</xsl:text>
    971                 </xsl:when>
    972             </xsl:choose>
    973         </xsl:when>
    974         <!-- enum types -->
    975         <xsl:when test="
    976             (ancestor::library/enum[@name=current()/@type]) or
    977             (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type])
    978         ">
    979             <xsl:choose>
    980                 <xsl:when test="$isIn">
    981                     <xsl:text>(</xsl:text>
    982                     <xsl:value-of select="@type"/>
    983                     <xsl:text>_T) a</xsl:text>
    984                     <xsl:call-template name="capitalize">
    985                         <xsl:with-param name="str" select="@name"/>
    986                     </xsl:call-template>
    987                 </xsl:when>
    988                 <xsl:when test="$isOut">
    989                     <xsl:text>ENUMOut &lt;K</xsl:text>
    990                     <xsl:value-of select="@type"/>
    991                     <xsl:text>, </xsl:text>
    992                     <xsl:value-of select="@type"/>
    993                     <xsl:text>_T&gt; (a</xsl:text>
    994                     <xsl:call-template name="capitalize">
    995                         <xsl:with-param name="str" select="@name"/>
    996                     </xsl:call-template>
    997                     <xsl:text>)</xsl:text>
    998                 </xsl:when>
    999             </xsl:choose>
    1000         </xsl:when>
    1001         <!-- interface types -->
    1002         <xsl:when test="
    1003             @type='$unknown' or
    1004             ((ancestor::library/enumerator[@name=current()/@type]) or
    1005              (ancestor::library/if[@target=$self_target]/enumerator[@name=current()/@type])
    1006             ) or
    1007             ((ancestor::library/interface[@name=current()/@type]) or
    1008              (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
    1009             ) or
    1010             ((ancestor::library/collection[@name=current()/@type]) or
    1011              (ancestor::library/if[@target=$self_target]/collection[@name=current()/@type])
    1012             )
    1013         ">
    1014             <xsl:choose>
    1015                 <xsl:when test="$isIn">
    1016                     <xsl:text>a</xsl:text>
    1017                     <xsl:call-template name="capitalize">
    1018                         <xsl:with-param name="str" select="@name"/>
    1019                     </xsl:call-template>
    1020                     <xsl:choose>
    1021                         <xsl:when test="@type='$unknown'">
    1022                             <xsl:text>.iface()</xsl:text>
    1023                         </xsl:when>
    1024                         <xsl:otherwise>
    1025                             <xsl:text>.mIface</xsl:text>
    1026                         </xsl:otherwise>
    1027                     </xsl:choose>
    1028                 </xsl:when>
    1029                 <xsl:when test="$isOut">
    1030                     <xsl:text>&amp;a</xsl:text>
    1031                     <xsl:call-template name="capitalize">
    1032                         <xsl:with-param name="str" select="@name"/>
    1033                     </xsl:call-template>
    1034                     <xsl:choose>
    1035                         <xsl:when test="@type='$unknown'">
    1036                             <xsl:text>.ifaceRef()</xsl:text>
    1037                         </xsl:when>
    1038                         <xsl:otherwise>
    1039                             <xsl:text>.mIface</xsl:text>
    1040                         </xsl:otherwise>
    1041                     </xsl:choose>
    1042                 </xsl:when>
    1043             </xsl:choose>
    1044         </xsl:when>
    1045         <!-- currently unsupported types -->
    1046         <xsl:when test="@type = 'string'">
    1047             <xsl:message terminate="yes">
    1048                 <xsl:text>Parameter type </xsl:text>
    1049                 <xsl:value-of select="@type"/>
    1050                 <xsl:text>is not currently supported</xsl:text>
    1051             </xsl:message>
    1052         </xsl:when>
    1053         <!-- assuming scalar types -->
     1147      </xsl:choose>
     1148    </xsl:when>
     1149    <!-- no modifiers -->
     1150    <xsl:otherwise>
     1151      <xsl:if test="../@safearray">
     1152        <xsl:text>QValueVector &lt;</xsl:text>
     1153      </xsl:if>
     1154      <xsl:choose>
     1155        <!-- standard types -->
     1156        <xsl:when test=".='result'">HRESULT</xsl:when>
     1157        <xsl:when test=".='boolean'">BOOL</xsl:when>
     1158        <xsl:when test=".='octet'">BYTE</xsl:when>
     1159        <xsl:when test=".='short'">SHORT</xsl:when>
     1160        <xsl:when test=".='unsigned short'">USHORT</xsl:when>
     1161        <xsl:when test=".='long'">LONG</xsl:when>
     1162        <xsl:when test=".='long long'">LONG64</xsl:when>
     1163        <xsl:when test=".='unsigned long'">ULONG</xsl:when>
     1164        <xsl:when test=".='unsigned long long'">ULONG64</xsl:when>
     1165        <xsl:when test=".='char'">CHAR</xsl:when>
     1166        <xsl:when test=".='string'">CHAR *</xsl:when>
     1167        <xsl:when test=".='wchar'">OLECHAR</xsl:when>
     1168        <xsl:when test=".='wstring'">QString</xsl:when>
     1169        <!-- UUID type -->
     1170        <xsl:when test=".='uuid'">QUuid</xsl:when>
     1171        <!-- system interface types -->
     1172        <xsl:when test=".='$unknown'">CUnknown</xsl:when>
    10541173        <xsl:otherwise>
    1055             <xsl:choose>
    1056                 <xsl:when test="$isIn">
    1057                     <xsl:text>a</xsl:text>
    1058                     <xsl:call-template name="capitalize">
    1059                         <xsl:with-param name="str" select="@name"/>
    1060                     </xsl:call-template>
    1061                 </xsl:when>
    1062                 <xsl:when test="$isOut">
    1063                     <xsl:text>&amp;a</xsl:text>
    1064                     <xsl:call-template name="capitalize">
    1065                         <xsl:with-param name="str" select="@name"/>
    1066                     </xsl:call-template>
    1067                 </xsl:when>
    1068             </xsl:choose>
     1174          <xsl:choose>
     1175            <!-- enum types -->
     1176            <xsl:when test="
     1177              (ancestor::library/enum[@name=current()]) or
     1178              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
     1179            ">
     1180              <xsl:value-of select="concat('K',string(.))"/>
     1181            </xsl:when>
     1182            <!-- custom interface types -->
     1183            <xsl:when test="
     1184              (name(current())='enumerator' and
     1185               ((ancestor::library/enumerator[@name=current()]) or
     1186                (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
     1187              ) or
     1188              ((ancestor::library/interface[@name=current()]) or
     1189               (ancestor::library/if[@target=$self_target]/interface[@name=current()])
     1190              ) or
     1191              ((ancestor::library/collection[@name=current()]) or
     1192               (ancestor::library/if[@target=$self_target]/collection[@name=current()])
     1193              )
     1194            ">
     1195              <xsl:value-of select="concat('C',substring(.,2))"/>
     1196            </xsl:when>
     1197            <!-- other types -->
     1198            <xsl:otherwise>
     1199              <xsl:message terminate="yes">
     1200                <xsl:text>Unknown parameter type: </xsl:text>
     1201                <xsl:value-of select="."/>
     1202              </xsl:message>
     1203            </xsl:otherwise>
     1204          </xsl:choose>
    10691205        </xsl:otherwise>
    1070     </xsl:choose>
    1071 </xsl:template>
    1072 
    1073 
    1074 <!--
    1075  *  attribute/parameter type conversion (returns plain Qt type name)
    1076 -->
    1077 <xsl:template match="
    1078     attribute/@type | param/@type |
    1079     enumerator/@type | collection/@type | collection/@enumerator
    1080 ">
    1081     <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
    1082 
    1083     <xsl:if test="../@array and ../@safearray='yes'">
    1084         <xsl:message terminate="yes">
    1085                 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1086             <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>
    1087         </xsl:message>
    1088     </xsl:if>
    1089 
    1090     <xsl:if test="../@array and ((name(..)='param' and ../@dir='return') or (name(..)='attribute'))">
    1091         <xsl:message terminate="yes">
    1092             <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1093             <xsl:text>return 'array' parameters and 'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>
    1094         </xsl:message>
    1095     </xsl:if>
    1096 
    1097     <xsl:choose>
    1098         <!-- modifiers (ignored for 'enumeration' attributes)-->
    1099         <xsl:when test="name(current())='type' and ../@mod">
    1100             <xsl:if test="../@safearray">
    1101                 <xsl:message terminate="yes">
    1102                       <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1103                     <xsl:text>either 'safearray' or 'mod' attribute is allowed, but not both!</xsl:text>
    1104                 </xsl:message>
    1105             </xsl:if>
    1106             <xsl:if test="../@array">
    1107                 <xsl:message terminate="yes">
    1108                     <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1109                     <xsl:text>either 'array' or 'mod' attribute is allowed, but not both!</xsl:text>
    1110                 </xsl:message>
    1111             </xsl:if>
    1112             <xsl:choose>
    1113                 <xsl:when test="../@mod='ptr'">
    1114                     <xsl:choose>
    1115                         <!-- standard types -->
    1116                         <!--xsl:when test=".='result'">??</xsl:when-->
    1117                         <xsl:when test=".='boolean'">BOOL *</xsl:when>
    1118                         <xsl:when test=".='octet'">BYTE *</xsl:when>
    1119                         <xsl:when test=".='short'">SHORT *</xsl:when>
    1120                         <xsl:when test=".='unsigned short'">USHORT *</xsl:when>
    1121                         <xsl:when test=".='long'">LONG *</xsl:when>
    1122                         <xsl:when test=".='long long'">LONG64 *</xsl:when>
    1123                         <xsl:when test=".='unsigned long'">ULONG *</xsl:when>
    1124                         <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when>
    1125                         <xsl:when test=".='char'">CHAR *</xsl:when>
    1126                         <!--<xsl:when test=".='string'">??</xsl:when-->
    1127                         <xsl:when test=".='wchar'">OLECHAR *</xsl:when>
    1128                         <!--<xsl:when test=".='wstring'">??</xsl:when-->
    1129                         <xsl:otherwise>
    1130                             <xsl:message terminate="yes">
    1131                                 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1132                                 <xsl:text>attribute 'mod=</xsl:text>
    1133                                 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
    1134                                 <xsl:text>' cannot be used with type </xsl:text>
    1135                                 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
    1136                             </xsl:message>
    1137                         </xsl:otherwise>
    1138                     </xsl:choose>
    1139                 </xsl:when>
    1140                 <xsl:otherwise>
    1141                     <xsl:message terminate="yes">
    1142                         <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1143                         <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
    1144                         <xsl:text>of attribute 'mod' is invalid!</xsl:text>
    1145                     </xsl:message>
    1146                 </xsl:otherwise>
    1147             </xsl:choose>
    1148         </xsl:when>
    1149         <!-- no modifiers -->
    1150         <xsl:otherwise>
    1151             <xsl:if test="../@safearray">
    1152                 <xsl:text>QValueVector &lt;</xsl:text>
    1153             </xsl:if>
    1154             <xsl:choose>
    1155                 <!-- standard types -->
    1156                 <xsl:when test=".='result'">HRESULT</xsl:when>
    1157                 <xsl:when test=".='boolean'">BOOL</xsl:when>
    1158                 <xsl:when test=".='octet'">BYTE</xsl:when>
    1159                 <xsl:when test=".='short'">SHORT</xsl:when>
    1160                 <xsl:when test=".='unsigned short'">USHORT</xsl:when>
    1161                 <xsl:when test=".='long'">LONG</xsl:when>
    1162                 <xsl:when test=".='long long'">LONG64</xsl:when>
    1163                 <xsl:when test=".='unsigned long'">ULONG</xsl:when>
    1164                 <xsl:when test=".='unsigned long long'">ULONG64</xsl:when>
    1165                 <xsl:when test=".='char'">CHAR</xsl:when>
    1166                 <xsl:when test=".='string'">CHAR *</xsl:when>
    1167                 <xsl:when test=".='wchar'">OLECHAR</xsl:when>
    1168                 <xsl:when test=".='wstring'">QString</xsl:when>
    1169                 <!-- UUID type -->
    1170                 <xsl:when test=".='uuid'">QUuid</xsl:when>
    1171                 <!-- system interface types -->
    1172                 <xsl:when test=".='$unknown'">CUnknown</xsl:when>
    1173                 <xsl:otherwise>
    1174                     <xsl:choose>
    1175                         <!-- enum types -->
    1176                         <xsl:when test="
    1177                             (ancestor::library/enum[@name=current()]) or
    1178                             (ancestor::library/if[@target=$self_target]/enum[@name=current()])
    1179                         ">
    1180                             <xsl:value-of select="concat('K',string(.))"/>
    1181                         </xsl:when>
    1182                         <!-- custom interface types -->
    1183                         <xsl:when test="
    1184                             (name(current())='enumerator' and
    1185                              ((ancestor::library/enumerator[@name=current()]) or
    1186                               (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
    1187                             ) or
    1188                             ((ancestor::library/interface[@name=current()]) or
    1189                              (ancestor::library/if[@target=$self_target]/interface[@name=current()])
    1190                             ) or
    1191                             ((ancestor::library/collection[@name=current()]) or
    1192                              (ancestor::library/if[@target=$self_target]/collection[@name=current()])
    1193                             )
    1194                         ">
    1195                             <xsl:value-of select="concat('C',substring(.,2))"/>
    1196                         </xsl:when>
    1197                         <!-- other types -->
    1198                         <xsl:otherwise>
    1199                             <xsl:message terminate="yes">
    1200                                 <xsl:text>Unknown parameter type: </xsl:text>
    1201                                 <xsl:value-of select="."/>
    1202                             </xsl:message>
    1203                         </xsl:otherwise>
    1204                     </xsl:choose>
    1205                 </xsl:otherwise>
    1206             </xsl:choose>
    1207             <xsl:if test="../@safearray">
    1208                 <xsl:text>&gt;</xsl:text>
    1209             </xsl:if>
    1210         </xsl:otherwise>
    1211     </xsl:choose>
     1206      </xsl:choose>
     1207      <xsl:if test="../@safearray">
     1208        <xsl:text>&gt;</xsl:text>
     1209      </xsl:if>
     1210    </xsl:otherwise>
     1211  </xsl:choose>
    12121212</xsl:template>
    12131213
     
    12191219-->
    12201220<xsl:template match="
    1221     attribute/@type | param/@type |
    1222     enumerator/@type | collection/@type | collection/@enumerator
     1221  attribute/@type | param/@type |
     1222  enumerator/@type | collection/@type | collection/@enumerator
    12231223" mode="initializer">
    12241224
    1225     <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
    1226 
    1227     <xsl:choose>
    1228         <!-- safearrays don't need initializers -->
    1229         <xsl:when test="../@safearray">
    1230         </xsl:when>
    1231         <!-- modifiers (ignored for 'enumeration' attributes)-->
    1232         <xsl:when test="name(current())='type' and ../@mod">
    1233             <xsl:choose>
    1234                 <xsl:when test="../@mod='ptr'">
    1235                     <xsl:choose>
    1236                         <!-- standard types -->
    1237                         <!--xsl:when test=".='result'">??</xsl:when-->
    1238                         <xsl:when test=".='boolean'"> = NULL</xsl:when>
    1239                         <xsl:when test=".='octet'"> = NULL</xsl:when>
    1240                         <xsl:when test=".='short'"> = NULL</xsl:when>
    1241                         <xsl:when test=".='unsigned short'"> = NULL</xsl:when>
    1242                         <xsl:when test=".='long'"> = NULL</xsl:when>
    1243                         <xsl:when test=".='long long'"> = NULL</xsl:when>
    1244                         <xsl:when test=".='unsigned long'"> = NULL</xsl:when>
    1245                         <xsl:when test=".='unsigned long long'"> = NULL</xsl:when>
    1246                         <xsl:when test=".='char'"> = NULL</xsl:when>
    1247                         <!--<xsl:when test=".='string'">??</xsl:when-->
    1248                         <xsl:when test=".='wchar'"> = NULL</xsl:when>
    1249                         <!--<xsl:when test=".='wstring'">??</xsl:when-->
    1250                         <xsl:otherwise>
    1251                             <xsl:message terminate="yes">
    1252                                 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1253                                 <xsl:text>attribute 'mod=</xsl:text>
    1254                                 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
    1255                                 <xsl:text>' cannot be used with type </xsl:text>
    1256                                 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
    1257                             </xsl:message>
    1258                         </xsl:otherwise>
    1259                     </xsl:choose>
    1260                 </xsl:when>
    1261                 <xsl:otherwise>
    1262                     <xsl:message terminate="yes">
    1263                         <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1264                         <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
    1265                         <xsl:text>of attribute 'mod' is invalid!</xsl:text>
    1266                     </xsl:message>
    1267                 </xsl:otherwise>
    1268             </xsl:choose>
    1269         </xsl:when>
    1270         <!-- no modifiers -->
     1225  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
     1226
     1227  <xsl:choose>
     1228    <!-- safearrays don't need initializers -->
     1229    <xsl:when test="../@safearray">
     1230    </xsl:when>
     1231    <!-- modifiers (ignored for 'enumeration' attributes)-->
     1232    <xsl:when test="name(current())='type' and ../@mod">
     1233      <xsl:choose>
     1234        <xsl:when test="../@mod='ptr'">
     1235          <xsl:choose>
     1236            <!-- standard types -->
     1237            <!--xsl:when test=".='result'">??</xsl:when-->
     1238            <xsl:when test=".='boolean'"> = NULL</xsl:when>
     1239            <xsl:when test=".='octet'"> = NULL</xsl:when>
     1240            <xsl:when test=".='short'"> = NULL</xsl:when>
     1241            <xsl:when test=".='unsigned short'"> = NULL</xsl:when>
     1242            <xsl:when test=".='long'"> = NULL</xsl:when>
     1243            <xsl:when test=".='long long'"> = NULL</xsl:when>
     1244            <xsl:when test=".='unsigned long'"> = NULL</xsl:when>
     1245            <xsl:when test=".='unsigned long long'"> = NULL</xsl:when>
     1246            <xsl:when test=".='char'"> = NULL</xsl:when>
     1247            <!--<xsl:when test=".='string'">??</xsl:when-->
     1248            <xsl:when test=".='wchar'"> = NULL</xsl:when>
     1249            <!--<xsl:when test=".='wstring'">??</xsl:when-->
     1250            <xsl:otherwise>
     1251              <xsl:message terminate="yes">
     1252                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1253                <xsl:text>attribute 'mod=</xsl:text>
     1254                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
     1255                <xsl:text>' cannot be used with type </xsl:text>
     1256                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
     1257              </xsl:message>
     1258            </xsl:otherwise>
     1259          </xsl:choose>
     1260        </xsl:when>
    12711261        <xsl:otherwise>
    1272             <xsl:choose>
    1273                 <!-- standard types that need a zero initializer -->
    1274                 <xsl:when test=".='result'"> = S_OK</xsl:when>
    1275                 <xsl:when test=".='boolean'"> = FALSE</xsl:when>
    1276                 <xsl:when test=".='octet'"> = 0</xsl:when>
    1277                 <xsl:when test=".='short'"> = 0</xsl:when>
    1278                 <xsl:when test=".='unsigned short'"> = 0</xsl:when>
    1279                 <xsl:when test=".='long'"> = 0</xsl:when>
    1280                 <xsl:when test=".='long long'"> = 0</xsl:when>
    1281                 <xsl:when test=".='unsigned long'"> = 0</xsl:when>
    1282                 <xsl:when test=".='unsigned long long'"> = 0</xsl:when>
    1283                 <xsl:when test=".='char'"> = 0</xsl:when>
    1284                 <xsl:when test=".='string'"> = NULL</xsl:when>
    1285                 <xsl:when test=".='wchar'"> = 0</xsl:when>
    1286                 <xsl:otherwise>
    1287                     <xsl:choose>
    1288                         <!-- enum types initialized with 0 -->
    1289                         <xsl:when test="
    1290                             (ancestor::library/enum[@name=current()]) or
    1291                             (ancestor::library/if[@target=$self_target]/enum[@name=current()])
    1292                         ">
    1293                             <xsl:value-of select="concat(' = (K',string(.),') 0')"/>
    1294                         </xsl:when>
    1295                     </xsl:choose>
    1296                 </xsl:otherwise>
    1297             </xsl:choose>
     1262          <xsl:message terminate="yes">
     1263            <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1264            <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
     1265            <xsl:text>of attribute 'mod' is invalid!</xsl:text>
     1266          </xsl:message>
    12981267        </xsl:otherwise>
    1299     </xsl:choose>
     1268      </xsl:choose>
     1269    </xsl:when>
     1270    <!-- no modifiers -->
     1271    <xsl:otherwise>
     1272      <xsl:choose>
     1273        <!-- standard types that need a zero initializer -->
     1274        <xsl:when test=".='result'"> = S_OK</xsl:when>
     1275        <xsl:when test=".='boolean'"> = FALSE</xsl:when>
     1276        <xsl:when test=".='octet'"> = 0</xsl:when>
     1277        <xsl:when test=".='short'"> = 0</xsl:when>
     1278        <xsl:when test=".='unsigned short'"> = 0</xsl:when>
     1279        <xsl:when test=".='long'"> = 0</xsl:when>
     1280        <xsl:when test=".='long long'"> = 0</xsl:when>
     1281        <xsl:when test=".='unsigned long'"> = 0</xsl:when>
     1282        <xsl:when test=".='unsigned long long'"> = 0</xsl:when>
     1283        <xsl:when test=".='char'"> = 0</xsl:when>
     1284        <xsl:when test=".='string'"> = NULL</xsl:when>
     1285        <xsl:when test=".='wchar'"> = 0</xsl:when>
     1286        <xsl:otherwise>
     1287          <xsl:choose>
     1288            <!-- enum types initialized with 0 -->
     1289            <xsl:when test="
     1290              (ancestor::library/enum[@name=current()]) or
     1291              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
     1292            ">
     1293              <xsl:value-of select="concat(' = (K',string(.),') 0')"/>
     1294            </xsl:when>
     1295          </xsl:choose>
     1296        </xsl:otherwise>
     1297      </xsl:choose>
     1298    </xsl:otherwise>
     1299  </xsl:choose>
    13001300</xsl:template>
    13011301
     
    13061306<xsl:template match="attribute/@type | param/@type" mode="param">
    13071307
    1308     <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
    1309 
    1310     <xsl:choose>
    1311         <!-- class types -->
    1312         <xsl:when test="
    1313             .='string' or
    1314             .='wstring' or
    1315             ../@safearray='yes' or
    1316             ((ancestor::library/enum[@name=current()]) or
    1317              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
    1318             ) or
    1319             .='$unknown' or
    1320             ((ancestor::library/enumerator[@name=current()]) or
    1321              (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])
    1322             ) or
    1323             ((ancestor::library/interface[@name=current()]) or
    1324              (ancestor::library/if[@target=$self_target]/interface[@name=current()])
    1325             ) or
    1326             ((ancestor::library/collection[@name=current()]) or
    1327              (ancestor::library/if[@target=$self_target]/collection[@name=current()])
    1328             )
    1329         ">
    1330             <xsl:choose>
    1331                 <!-- <attribute> context -->
    1332                 <xsl:when test="name(..)='attribute'">
    1333                     <xsl:text>const </xsl:text>
    1334                     <xsl:apply-templates select="."/>
    1335                     <xsl:text> &amp;</xsl:text>
    1336                 </xsl:when>
    1337                 <!-- <param> context -->
    1338                 <xsl:when test="name(..)='param'">
    1339                     <xsl:choose>
    1340                         <xsl:when test="../@dir='in'">
    1341                             <xsl:text>const </xsl:text>
    1342                             <xsl:apply-templates select="."/>
    1343                             <xsl:text> &amp;</xsl:text>
    1344                         </xsl:when>
    1345                         <xsl:when test="../@dir='out'">
    1346                             <xsl:apply-templates select="."/>
    1347                             <xsl:text> &amp;</xsl:text>
    1348                         </xsl:when>
    1349                         <xsl:when test="../@dir='return'">
    1350                             <xsl:apply-templates select="."/>
    1351                         </xsl:when>
    1352                     </xsl:choose>
    1353                 </xsl:when>
    1354             </xsl:choose>
    1355         </xsl:when>
    1356         <!-- assume scalar types -->
    1357         <xsl:otherwise>
    1358             <xsl:choose>
    1359                 <!-- <attribute> context -->
    1360                 <xsl:when test="name(..)='attribute'">
    1361                     <xsl:apply-templates select="."/>
    1362                 </xsl:when>
    1363                 <!-- <param> context -->
    1364                 <xsl:when test="name(..)='param'">
    1365                     <xsl:choose>
    1366                         <xsl:when test="../@array">
    1367                             <xsl:apply-templates select="."/>
    1368                             <xsl:text> *</xsl:text>
    1369                             <xsl:if test="../@dir='out'">
    1370                                 <xsl:text> &amp;</xsl:text>
    1371                             </xsl:if>
    1372                         </xsl:when>
    1373                         <xsl:otherwise>
    1374                             <xsl:apply-templates select="."/>
    1375                             <xsl:if test="../@dir='out'">
    1376                                 <xsl:text> &amp;</xsl:text>
    1377                             </xsl:if>
    1378                         </xsl:otherwise>
    1379                     </xsl:choose>
    1380                 </xsl:when>
    1381             </xsl:choose>
    1382         </xsl:otherwise>
    1383     </xsl:choose>
     1308  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
     1309
     1310  <xsl:choose>
     1311    <!-- class types -->
     1312    <xsl:when test="
     1313      .='string' or
     1314      .='wstring' or
     1315      ../@safearray='yes' or
     1316      ((ancestor::library/enum[@name=current()]) or
     1317       (ancestor::library/if[@target=$self_target]/enum[@name=current()])
     1318      ) or
     1319      .='$unknown' or
     1320      ((ancestor::library/enumerator[@name=current()]) or
     1321       (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])
     1322      ) or
     1323      ((ancestor::library/interface[@name=current()]) or
     1324       (ancestor::library/if[@target=$self_target]/interface[@name=current()])
     1325      ) or
     1326      ((ancestor::library/collection[@name=current()]) or
     1327       (ancestor::library/if[@target=$self_target]/collection[@name=current()])
     1328      )
     1329    ">
     1330      <xsl:choose>
     1331        <!-- <attribute> context -->
     1332        <xsl:when test="name(..)='attribute'">
     1333          <xsl:text>const </xsl:text>
     1334          <xsl:apply-templates select="."/>
     1335          <xsl:text> &amp;</xsl:text>
     1336        </xsl:when>
     1337        <!-- <param> context -->
     1338        <xsl:when test="name(..)='param'">
     1339          <xsl:choose>
     1340            <xsl:when test="../@dir='in'">
     1341              <xsl:text>const </xsl:text>
     1342              <xsl:apply-templates select="."/>
     1343              <xsl:text> &amp;</xsl:text>
     1344            </xsl:when>
     1345            <xsl:when test="../@dir='out'">
     1346              <xsl:apply-templates select="."/>
     1347              <xsl:text> &amp;</xsl:text>
     1348            </xsl:when>
     1349            <xsl:when test="../@dir='return'">
     1350              <xsl:apply-templates select="."/>
     1351            </xsl:when>
     1352          </xsl:choose>
     1353        </xsl:when>
     1354      </xsl:choose>
     1355    </xsl:when>
     1356    <!-- assume scalar types -->
     1357    <xsl:otherwise>
     1358      <xsl:choose>
     1359        <!-- <attribute> context -->
     1360        <xsl:when test="name(..)='attribute'">
     1361          <xsl:apply-templates select="."/>
     1362        </xsl:when>
     1363        <!-- <param> context -->
     1364        <xsl:when test="name(..)='param'">
     1365          <xsl:choose>
     1366            <xsl:when test="../@array">
     1367              <xsl:apply-templates select="."/>
     1368              <xsl:text> *</xsl:text>
     1369              <xsl:if test="../@dir='out'">
     1370                <xsl:text> &amp;</xsl:text>
     1371              </xsl:if>
     1372            </xsl:when>
     1373            <xsl:otherwise>
     1374              <xsl:apply-templates select="."/>
     1375              <xsl:if test="../@dir='out'">
     1376                <xsl:text> &amp;</xsl:text>
     1377              </xsl:if>
     1378            </xsl:otherwise>
     1379          </xsl:choose>
     1380        </xsl:when>
     1381      </xsl:choose>
     1382    </xsl:otherwise>
     1383  </xsl:choose>
    13841384</xsl:template>
    13851385
     
    13901390-->
    13911391<xsl:template match="
    1392     attribute/@type | param/@type |
    1393     enumerator/@type | collection/@type | collection/@enumerator
     1392  attribute/@type | param/@type |
     1393  enumerator/@type | collection/@type | collection/@enumerator
    13941394" mode="com">
    13951395
    1396     <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
    1397 
    1398     <xsl:choose>
    1399         <!-- modifiers (ignored for 'enumeration' attributes)-->
    1400         <xsl:when test="name(current())='type' and ../@mod">
    1401             <xsl:choose>
    1402                 <xsl:when test="../@mod='ptr'">
    1403                     <xsl:choose>
    1404                         <!-- standard types -->
    1405                         <!--xsl:when test=".='result'">??</xsl:when-->
    1406                         <xsl:when test=".='boolean'">BOOL *</xsl:when>
    1407                         <xsl:when test=".='octet'">BYTE *</xsl:when>
    1408                         <xsl:when test=".='short'">SHORT *</xsl:when>
    1409                         <xsl:when test=".='unsigned short'">USHORT *</xsl:when>
    1410                         <xsl:when test=".='long'">LONG *</xsl:when>
    1411                         <xsl:when test=".='long long'">LONG64 *</xsl:when>
    1412                         <xsl:when test=".='unsigned long'">ULONG *</xsl:when>
    1413                         <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when>
    1414                         <xsl:when test=".='char'">CHAR *</xsl:when>
    1415                         <!--xsl:when test=".='string'">??</xsl:when-->
    1416                         <xsl:when test=".='wchar'">OLECHAR *</xsl:when>
    1417                         <!--xsl:when test=".='wstring'">??</xsl:when-->
    1418                         <xsl:otherwise>
    1419                             <xsl:message terminate="yes">
    1420                                 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1421                                 <xsl:text>attribute 'mod=</xsl:text>
    1422                                 <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
    1423                                 <xsl:text>' cannot be used with type </xsl:text>
    1424                                 <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
    1425                             </xsl:message>
    1426                         </xsl:otherwise>
    1427                     </xsl:choose>
    1428                 </xsl:when>
    1429                 <xsl:otherwise>
    1430                     <xsl:message terminate="yes">
    1431                         <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
    1432                         <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
    1433                         <xsl:text>of attribute 'mod' is invalid!</xsl:text>
    1434                     </xsl:message>
    1435                 </xsl:otherwise>
    1436             </xsl:choose>
    1437         </xsl:when>
    1438         <!-- no modifiers -->
     1396  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
     1397
     1398  <xsl:choose>
     1399    <!-- modifiers (ignored for 'enumeration' attributes)-->
     1400    <xsl:when test="name(current())='type' and ../@mod">
     1401      <xsl:choose>
     1402        <xsl:when test="../@mod='ptr'">
     1403          <xsl:choose>
     1404            <!-- standard types -->
     1405            <!--xsl:when test=".='result'">??</xsl:when-->
     1406            <xsl:when test=".='boolean'">BOOL *</xsl:when>
     1407            <xsl:when test=".='octet'">BYTE *</xsl:when>
     1408            <xsl:when test=".='short'">SHORT *</xsl:when>
     1409            <xsl:when test=".='unsigned short'">USHORT *</xsl:when>
     1410            <xsl:when test=".='long'">LONG *</xsl:when>
     1411            <xsl:when test=".='long long'">LONG64 *</xsl:when>
     1412            <xsl:when test=".='unsigned long'">ULONG *</xsl:when>
     1413            <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when>
     1414            <xsl:when test=".='char'">CHAR *</xsl:when>
     1415            <!--xsl:when test=".='string'">??</xsl:when-->
     1416            <xsl:when test=".='wchar'">OLECHAR *</xsl:when>
     1417            <!--xsl:when test=".='wstring'">??</xsl:when-->
     1418            <xsl:otherwise>
     1419              <xsl:message terminate="yes">
     1420                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1421                <xsl:text>attribute 'mod=</xsl:text>
     1422                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
     1423                <xsl:text>' cannot be used with type </xsl:text>
     1424                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
     1425              </xsl:message>
     1426            </xsl:otherwise>
     1427          </xsl:choose>
     1428        </xsl:when>
    14391429        <xsl:otherwise>
    1440             <xsl:choose>
    1441                 <!-- standard types -->
    1442                 <xsl:when test=".='result'">HRESULT</xsl:when>
    1443                 <xsl:when test=".='boolean'">BOOL</xsl:when>
    1444                 <xsl:when test=".='octet'">BYTE</xsl:when>
    1445                 <xsl:when test=".='short'">SHORT</xsl:when>
    1446                 <xsl:when test=".='unsigned short'">USHORT</xsl:when>
    1447                 <xsl:when test=".='long'">LONG</xsl:when>
    1448                 <xsl:when test=".='long long'">LONG64</xsl:when>
    1449                 <xsl:when test=".='unsigned long'">ULONG</xsl:when>
    1450                 <xsl:when test=".='unsigned long long'">ULONG64</xsl:when>
    1451                 <xsl:when test=".='char'">CHAR</xsl:when>
    1452                 <xsl:when test=".='string'">CHAR *</xsl:when>
    1453                 <xsl:when test=".='wchar'">OLECHAR</xsl:when>
    1454                 <xsl:when test=".='wstring'">BSTR</xsl:when>
    1455                 <!-- UUID type -->
    1456                 <xsl:when test=".='uuid'">GUID</xsl:when>
    1457                 <!-- system interface types -->
    1458                 <xsl:when test=".='$unknown'">IUnknown *</xsl:when>
    1459                 <xsl:otherwise>
    1460                     <xsl:choose>
    1461                         <!-- enum types -->
    1462                         <xsl:when test="
    1463                             (ancestor::library/enum[@name=current()]) or
    1464                             (ancestor::library/if[@target=$self_target]/enum[@name=current()])
    1465                         ">
    1466                             <xsl:value-of select="."/>
    1467                         </xsl:when>
    1468                         <!-- custom interface types -->
    1469                         <xsl:when test="
    1470                             (name(current())='enumerator' and
    1471                              ((ancestor::library/enumerator[@name=current()]) or
    1472                               (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
    1473                             ) or
    1474                             ((ancestor::library/interface[@name=current()]) or
    1475                              (ancestor::library/if[@target=$self_target]/interface[@name=current()])
    1476                             ) or
    1477                             ((ancestor::library/collection[@name=current()]) or
    1478                              (ancestor::library/if[@target=$self_target]/collection[@name=current()])
    1479                             )
    1480                         ">
    1481                             <xsl:value-of select="."/><xsl:text> *</xsl:text>
    1482                         </xsl:when>
    1483                         <!-- other types -->
    1484                         <xsl:otherwise>
    1485                             <xsl:message terminate="yes">
    1486                                 <xsl:text>Unknown parameter type: </xsl:text>
    1487                                 <xsl:value-of select="."/>
    1488                             </xsl:message>
    1489                         </xsl:otherwise>
    1490                     </xsl:choose>
    1491                 </xsl:otherwise>
    1492             </xsl:choose>
     1430          <xsl:message terminate="yes">
     1431            <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
     1432            <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
     1433            <xsl:text>of attribute 'mod' is invalid!</xsl:text>
     1434          </xsl:message>
    14931435        </xsl:otherwise>
    1494     </xsl:choose>
     1436      </xsl:choose>
     1437    </xsl:when>
     1438    <!-- no modifiers -->
     1439    <xsl:otherwise>
     1440      <xsl:choose>
     1441        <!-- standard types -->
     1442        <xsl:when test=".='result'">HRESULT</xsl:when>
     1443        <xsl:when test=".='boolean'">BOOL</xsl:when>
     1444        <xsl:when test=".='octet'">BYTE</xsl:when>
     1445        <xsl:when test=".='short'">SHORT</xsl:when>
     1446        <xsl:when test=".='unsigned short'">USHORT</xsl:when>
     1447        <xsl:when test=".='long'">LONG</xsl:when>
     1448        <xsl:when test=".='long long'">LONG64</xsl:when>
     1449        <xsl:when test=".='unsigned long'">ULONG</xsl:when>
     1450        <xsl:when test=".='unsigned long long'">ULONG64</xsl:when>
     1451        <xsl:when test=".='char'">CHAR</xsl:when>
     1452        <xsl:when test=".='string'">CHAR *</xsl:when>
     1453        <xsl:when test=".='wchar'">OLECHAR</xsl:when>
     1454        <xsl:when test=".='wstring'">BSTR</xsl:when>
     1455        <!-- UUID type -->
     1456        <xsl:when test=".='uuid'">GUID</xsl:when>
     1457        <!-- system interface types -->
     1458        <xsl:when test=".='$unknown'">IUnknown *</xsl:when>
     1459        <xsl:otherwise>
     1460          <xsl:choose>
     1461            <!-- enum types -->
     1462            <xsl:when test="
     1463              (ancestor::library/enum[@name=current()]) or
     1464              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
     1465            ">
     1466              <xsl:value-of select="."/>
     1467            </xsl:when>
     1468            <!-- custom interface types -->
     1469            <xsl:when test="
     1470              (name(current())='enumerator' and
     1471               ((ancestor::library/enumerator[@name=current()]) or
     1472                (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))
     1473              ) or
     1474              ((ancestor::library/interface[@name=current()]) or
     1475               (ancestor::library/if[@target=$self_target]/interface[@name=current()])
     1476              ) or
     1477              ((ancestor::library/collection[@name=current()]) or
     1478               (ancestor::library/if[@target=$self_target]/collection[@name=current()])
     1479              )
     1480            ">
     1481              <xsl:value-of select="."/><xsl:text> *</xsl:text>
     1482            </xsl:when>
     1483            <!-- other types -->
     1484            <xsl:otherwise>
     1485              <xsl:message terminate="yes">
     1486                <xsl:text>Unknown parameter type: </xsl:text>
     1487                <xsl:value-of select="."/>
     1488              </xsl:message>
     1489            </xsl:otherwise>
     1490          </xsl:choose>
     1491        </xsl:otherwise>
     1492      </xsl:choose>
     1493    </xsl:otherwise>
     1494  </xsl:choose>
    14951495</xsl:template>
    14961496
     
    15091509<xsl:template name="hooks">
    15101510
    1511     <xsl:param name="when" select="''"/>
    1512     <xsl:param name="isSetter" select="''"/>
    1513 
    1514     <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
    1515 
    1516     <xsl:variable name="is_iface" select="(
    1517       ((ancestor::library/enumerator[@name=current()/@type]) or
    1518        (ancestor::library/if[@target=$self_target]/enumerator[@name=current()/@type])
    1519       ) or
    1520       ((ancestor::library/interface[@name=current()/@type]) or
    1521        (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
    1522       ) or
    1523       ((ancestor::library/collection[@name=current()/@type]) or
    1524        (ancestor::library/if[@target=$self_target]/collection[@name=current()/@type])
    1525       )
    1526     )"/>
    1527 
    1528     <xsl:choose>
    1529         <xsl:when test="$when='pre-call'">
     1511  <xsl:param name="when" select="''"/>
     1512  <xsl:param name="isSetter" select="''"/>
     1513
     1514  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
     1515
     1516  <xsl:variable name="is_iface" select="(
     1517    ((ancestor::library/enumerator[@name=current()/@type]) or
     1518     (ancestor::library/if[@target=$self_target]/enumerator[@name=current()/@type])
     1519    ) or
     1520    ((ancestor::library/interface[@name=current()/@type]) or
     1521     (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
     1522    ) or
     1523    ((ancestor::library/collection[@name=current()/@type]) or
     1524     (ancestor::library/if[@target=$self_target]/collection[@name=current()/@type])
     1525    )
     1526  )"/>
     1527
     1528  <xsl:choose>
     1529    <xsl:when test="$when='pre-call'">
     1530      <xsl:choose>
     1531        <xsl:when test="@safearray='yes'">
     1532          <!-- declare a SafeArray variable -->
     1533          <xsl:choose>
     1534            <!-- interface types need special treatment here -->
     1535            <xsl:when test="@type='$unknown'">
     1536              <xsl:text>    com::SafeIfaceArray &lt;IUnknown&gt; </xsl:text>
     1537            </xsl:when>
     1538            <xsl:when test="$is_iface">
     1539              <xsl:text>    com::SafeIfaceArray &lt;</xsl:text>
     1540              <xsl:value-of select="@type"/>
     1541              <xsl:text>&gt; </xsl:text>
     1542            </xsl:when>
     1543            <xsl:otherwise>
     1544              <xsl:text>    com::SafeArray &lt;</xsl:text>
     1545              <xsl:apply-templates select="@type" mode="com"/>
     1546              <xsl:text>&gt; </xsl:text>
     1547            </xsl:otherwise>
     1548          </xsl:choose>
     1549          <xsl:value-of select="@name"/>
     1550          <xsl:text>;&#x0A;</xsl:text>
     1551          <xsl:if test="(name()='attribute' and $isSetter) or
     1552                        (name()='param' and @dir='in')">
     1553            <!-- convert QValueVector to SafeArray -->
    15301554            <xsl:choose>
    1531                 <xsl:when test="@safearray='yes'">
    1532                     <!-- declare a SafeArray variable -->
    1533                     <xsl:choose>
    1534                         <!-- interface types need special treatment here -->
    1535                         <xsl:when test="@type='$unknown'">
    1536                             <xsl:text>    com::SafeIfaceArray &lt;IUnknown&gt; </xsl:text>
    1537                         </xsl:when>
    1538                         <xsl:when test="$is_iface">
    1539                             <xsl:text>    com::SafeIfaceArray &lt;</xsl:text>
    1540                             <xsl:value-of select="@type"/>
    1541                             <xsl:text>&gt; </xsl:text>
    1542                         </xsl:when>
    1543                         <xsl:otherwise>
    1544                             <xsl:text>    com::SafeArray &lt;</xsl:text>
    1545                             <xsl:apply-templates select="@type" mode="com"/>
    1546                             <xsl:text>&gt; </xsl:text>
    1547                         </xsl:otherwise>
    1548                     </xsl:choose>
    1549                     <xsl:value-of select="@name"/>
    1550                     <xsl:text>;&#x0A;</xsl:text>
    1551                     <xsl:if test="(name()='attribute' and $isSetter) or
    1552                                   (name()='param' and @dir='in')">
    1553                         <!-- convert QValueVector to SafeArray -->
    1554                         <xsl:choose>
    1555                             <!-- interface types need special treatment here -->
    1556                             <xsl:when test="@type='$unknown' or $is_iface">
    1557                                 <xsl:text>    ToSafeIfaceArray (</xsl:text>
    1558                             </xsl:when>
    1559                             <xsl:otherwise>
    1560                                 <xsl:text>    ToSafeArray (</xsl:text>
    1561                             </xsl:otherwise>
    1562                         </xsl:choose>
    1563                         <xsl:text>a</xsl:text>
    1564                         <xsl:call-template name="capitalize">
    1565                             <xsl:with-param name="str" select="@name"/>
    1566                         </xsl:call-template>
    1567                         <xsl:text>, </xsl:text>
    1568                         <xsl:value-of select="@name"/>
    1569                         <xsl:text>);&#x0A;</xsl:text>
    1570                     </xsl:if>
    1571                 </xsl:when>
     1555              <!-- interface types need special treatment here -->
     1556              <xsl:when test="@type='$unknown' or $is_iface">
     1557                <xsl:text>    ToSafeIfaceArray (</xsl:text>
     1558              </xsl:when>
     1559              <xsl:otherwise>
     1560                <xsl:text>    ToSafeArray (</xsl:text>
     1561              </xsl:otherwise>
    15721562            </xsl:choose>
    1573         </xsl:when>
    1574         <xsl:when test="$when='post-call'">
     1563            <xsl:text>a</xsl:text>
     1564            <xsl:call-template name="capitalize">
     1565              <xsl:with-param name="str" select="@name"/>
     1566            </xsl:call-template>
     1567            <xsl:text>, </xsl:text>
     1568            <xsl:value-of select="@name"/>
     1569            <xsl:text>);&#x0A;</xsl:text>
     1570          </xsl:if>
     1571        </xsl:when>
     1572      </xsl:choose>
     1573    </xsl:when>
     1574    <xsl:when test="$when='post-call'">
     1575      <xsl:choose>
     1576        <xsl:when test="@safearray='yes'">
     1577          <xsl:if test="(name()='attribute' and not($isSetter)) or
     1578                        (name()='param' and (@dir='out' or @dir='return'))">
     1579            <!-- convert SafeArray to QValueVector -->
    15751580            <xsl:choose>
    1576                 <xsl:when test="@safearray='yes'">
    1577                     <xsl:if test="(name()='attribute' and not($isSetter)) or
    1578                                   (name()='param' and (@dir='out' or @dir='return'))">
    1579                         <!-- convert SafeArray to QValueVector -->
    1580                         <xsl:choose>
    1581                             <!-- interface types need special treatment here -->
    1582                             <xsl:when test="@type='$unknown' or $is_iface">
    1583                                 <xsl:text>    FromSafeIfaceArray (</xsl:text>
    1584                             </xsl:when>
    1585                             <xsl:otherwise>
    1586                                 <xsl:text>    FromSafeArray (</xsl:text>
    1587                             </xsl:otherwise>
    1588                         </xsl:choose>
    1589                         <xsl:value-of select="@name"/>
    1590                         <xsl:text>, </xsl:text>
    1591                         <xsl:text>a</xsl:text>
    1592                         <xsl:call-template name="capitalize">
    1593                             <xsl:with-param name="str" select="@name"/>
    1594                         </xsl:call-template>
    1595                         <xsl:text>);&#x0A;</xsl:text>
    1596                     </xsl:if>
    1597                 </xsl:when>
     1581              <!-- interface types need special treatment here -->
     1582              <xsl:when test="@type='$unknown' or $is_iface">
     1583                <xsl:text>    FromSafeIfaceArray (</xsl:text>
     1584              </xsl:when>
     1585              <xsl:otherwise>
     1586                <xsl:text>    FromSafeArray (</xsl:text>
     1587              </xsl:otherwise>
    15981588            </xsl:choose>
    1599         </xsl:when>
    1600       <xsl:otherwise>
    1601           <xsl:message terminate="yes">
    1602               <xsl:text>Invalid when value: </xsl:text>
    1603               <xsl:value-of select="$when"/>
    1604           </xsl:message>
    1605       </xsl:otherwise>
    1606     </xsl:choose>
     1589            <xsl:value-of select="@name"/>
     1590            <xsl:text>, </xsl:text>
     1591            <xsl:text>a</xsl:text>
     1592            <xsl:call-template name="capitalize">
     1593              <xsl:with-param name="str" select="@name"/>
     1594            </xsl:call-template>
     1595            <xsl:text>);&#x0A;</xsl:text>
     1596          </xsl:if>
     1597        </xsl:when>
     1598      </xsl:choose>
     1599    </xsl:when>
     1600    <xsl:otherwise>
     1601      <xsl:message terminate="yes">
     1602        <xsl:text>Invalid when value: </xsl:text>
     1603        <xsl:value-of select="$when"/>
     1604      </xsl:message>
     1605    </xsl:otherwise>
     1606  </xsl:choose>
    16071607
    16081608</xsl:template>
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