Changeset 7216 in vbox
- Timestamp:
- Feb 29, 2008 11:36:31 AM (17 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl
r7207 r7216 38 38 --> 39 39 <xsl:template name="capitalize"> 40 41 42 43 44 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 "/> 47 47 </xsl:template> 48 48 … … 52 52 --> 53 53 <xsl:template name="uncapitalize"> 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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> 68 68 </xsl:template> 69 69 … … 72 72 --> 73 73 <xsl:template name="uppercase"> 74 75 76 77 74 <xsl:param name="str" select="."/> 75 <xsl:value-of select=" 76 translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ') 77 "/> 78 78 </xsl:template> 79 79 … … 119 119 120 120 </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>
{
</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>,
</xsl:text> 131 </xsl:for-each> 132 <xsl:text> </xsl:text> 133 <xsl:value-of select="concat('K',@name,'_COUNT')"/> 134 <xsl:text>
};

</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>
{
</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>,
</xsl:text> 135 131 </xsl:for-each> 136 <xsl:text>

</xsl:text> 137 138 <xsl:apply-templates/> 132 <xsl:text> </xsl:text> 133 <xsl:value-of select="concat('K',@name,'_COUNT')"/> 134 <xsl:text>
};

</xsl:text> 135 </xsl:for-each> 136 <xsl:text>

</xsl:text> 137 138 <xsl:apply-templates/> 139 139 140 140 </xsl:template> … … 181 181 --> 182 182 <xsl:template match="if" mode="begin"> 183 184 185 186 187 188 183 <xsl:if test="@target='xpidl'"> 184 <xsl:text>#if !defined (Q_WS_WIN32)
</xsl:text> 185 </xsl:if> 186 <xsl:if test="@target='midl'"> 187 <xsl:text>#if defined (Q_WS_WIN32)
</xsl:text> 188 </xsl:if> 189 189 </xsl:template> 190 190 <xsl:template match="if" mode="end"> … … 205 205 --> 206 206 <xsl:template match="@if" mode="begin"> 207 208 209 207 <xsl:text>#if </xsl:text> 208 <xsl:value-of select="."/> 209 <xsl:text>
</xsl:text> 210 210 </xsl:template> 211 211 <xsl:template match="@if" mode="end"> 212 212 <xsl:text>#endif
</xsl:text> 213 213 </xsl:template> 214 214 … … 218 218 --> 219 219 <xsl:template match="library"> 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 220 <!-- forward declarations --> 221 <xsl:text>// forward declarations

</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>;
</xsl:text> 226 </xsl:for-each> 227 <xsl:text>
</xsl:text> 228 <!-- array typedefs --> 229 <xsl:text>// array typedefs

</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 <C</xsl:text> 237 <xsl:value-of select="substring(@name,2)"/> 238 <xsl:text>> C</xsl:text> 239 <xsl:value-of select="substring(@name,2)"/> 240 <xsl:text>Vector;
</xsl:text> 241 </xsl:if> 242 </xsl:for-each> 243 <xsl:text>
</xsl:text> 244 <!-- wrapper declarations --> 245 <xsl:text>// wrapper declarations

</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

</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 /> 264 264 </xsl:template> 265 265 … … 270 270 <xsl:template match="interface | collection | enumerator" mode="declare"> 271 271 272 <xsl:text>// </xsl:text> 273 <xsl:value-of select="@name"/> 274 <xsl:text> wrapper

class C</xsl:text> 275 <xsl:value-of select="substring(@name,2)"/> 276 <xsl:text> : public CInterface <</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>>
{
public:

</xsl:text> 283 284 <!-- generate the Base typedef--> 285 <xsl:text> typedef CInterface <</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>> Base;

</xsl:text> 292 293 <xsl:if test="name()='collection'"> 294 <xsl:text> // collection stuff

</xsl:text> 295 <xsl:text> ULONG GetCount () const;
</xsl:text> 296 <xsl:text> </xsl:text> 297 <xsl:apply-templates select="@type"/> 298 <xsl:text> GetItemAt (ULONG index) const;
</xsl:text> 299 <xsl:text> </xsl:text> 300 <xsl:apply-templates select="@enumerator"/> 301 <xsl:text> Enumerate () const;

</xsl:text> 302 </xsl:if> 303 304 <xsl:if test="name()='enumerator'"> 305 <xsl:text> // enumerator stuff

</xsl:text> 306 <xsl:text> BOOL HasMore () const;
</xsl:text> 307 <xsl:text> </xsl:text> 308 <xsl:apply-templates select="@type"/> 309 <xsl:text> GetNext () const;

</xsl:text> 310 <xsl:text> // friend wrappers

</xsl:text> 311 <xsl:text> friend class CUnknown;
</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>;
</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>;
</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>};

</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

</xsl:text> 354 <!-- default constructor --> 355 <xsl:text> C</xsl:text> 356 <xsl:value-of select="substring(@name,2)"/> 357 <xsl:text> () : Base () {}
</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 & that) : Base (that) {}
</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) {}
</xsl:text> 368 <!-- assignment taking CUnknown --> 369 <xsl:text> C</xsl:text> 370 <xsl:value-of select="substring(@name,2)"/> 371 <xsl:text> & operator = (const CUnknown & that)
 {
 return (C</xsl:text> 372 <xsl:value-of select="substring(@name,2)"/> 373 <xsl:text> &) Base::operator = (that);
 }

</xsl:text> 374 375 <xsl:text> // attributes (properties)

</xsl:text> 376 <xsl:apply-templates select=".//attribute[not(@internal='yes')]" mode="declare"/> 377 <xsl:if test=".//attribute[not(@internal='yes')]"> 378 <xsl:text>
</xsl:text> 379 </xsl:if> 380 381 <xsl:text> // methods

</xsl:text> 382 <xsl:apply-templates select=".//method[not(@internal='yes')]" mode="declare"/> 383 <xsl:if test=".//method[not(@internal='yes')]"> 384 <xsl:text>
</xsl:text> 385 </xsl:if> 386 272 <xsl:text>// </xsl:text> 273 <xsl:value-of select="@name"/> 274 <xsl:text> wrapper

class C</xsl:text> 275 <xsl:value-of select="substring(@name,2)"/> 276 <xsl:text> : public CInterface <</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>>
{
public:

</xsl:text> 283 284 <!-- generate the Base typedef--> 285 <xsl:text> typedef CInterface <</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>> Base;

</xsl:text> 292 293 <xsl:if test="name()='collection'"> 294 <xsl:text> // collection stuff

</xsl:text> 295 <xsl:text> ULONG GetCount () const;
</xsl:text> 296 <xsl:text> </xsl:text> 297 <xsl:apply-templates select="@type"/> 298 <xsl:text> GetItemAt (ULONG index) const;
</xsl:text> 299 <xsl:text> </xsl:text> 300 <xsl:apply-templates select="@enumerator"/> 301 <xsl:text> Enumerate () const;

</xsl:text> 302 </xsl:if> 303 304 <xsl:if test="name()='enumerator'"> 305 <xsl:text> // enumerator stuff

</xsl:text> 306 <xsl:text> BOOL HasMore () const;
</xsl:text> 307 <xsl:text> </xsl:text> 308 <xsl:apply-templates select="@type"/> 309 <xsl:text> GetNext () const;

</xsl:text> 387 310 <xsl:text> // friend wrappers

</xsl:text> 388 311 <xsl:text> friend class CUnknown;
</xsl:text> … … 391 314 <!-- for definitions inside <if> --> 392 315 <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>;
</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>;
</xsl:text> 325 </xsl:if> 326 </xsl:for-each> 417 327 </xsl:if> 418 328 <!-- for definitions outside <if> (i.e. inside <library>) --> 419 329 <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>;
</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>;
</xsl:text> 337 </xsl:if> 338 </xsl:for-each> 438 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>};

</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

</xsl:text> 354 <!-- default constructor --> 355 <xsl:text> C</xsl:text> 356 <xsl:value-of select="substring(@name,2)"/> 357 <xsl:text> () : Base () {}
</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 & that) : Base (that) {}
</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) {}
</xsl:text> 368 <!-- assignment taking CUnknown --> 369 <xsl:text> C</xsl:text> 370 <xsl:value-of select="substring(@name,2)"/> 371 <xsl:text> & operator = (const CUnknown & that)
 {
 return (C</xsl:text> 372 <xsl:value-of select="substring(@name,2)"/> 373 <xsl:text> &) Base::operator = (that);
 }

</xsl:text> 374 375 <xsl:text> // attributes (properties)

</xsl:text> 376 <xsl:apply-templates select=".//attribute[not(@internal='yes')]" mode="declare"/> 377 <xsl:if test=".//attribute[not(@internal='yes')]"> 378 <xsl:text>
</xsl:text> 379 </xsl:if> 380 381 <xsl:text> // methods

</xsl:text> 382 <xsl:apply-templates select=".//method[not(@internal='yes')]" mode="declare"/> 383 <xsl:if test=".//method[not(@internal='yes')]"> 384 <xsl:text>
</xsl:text> 385 </xsl:if> 386 387 <xsl:text> // friend wrappers

</xsl:text> 388 <xsl:text> friend class CUnknown;
</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>;
</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>;
</xsl:text> 436 </xsl:if> 437 </xsl:for-each> 438 </xsl:if> 439 439 440 440 </xsl:template> … … 442 442 <!-- attribute declarations --> 443 443 <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')"> 452 456 <xsl:call-template name="composeMethod"> 453 <xsl:with-param name="return" select="."/>457 <xsl:with-param name="return" select="''"/> 454 458 </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"/> 462 462 </xsl:template> 463 463 464 464 <!-- method declarations --> 465 465 <xsl:template match="interface//method | collection//method" mode="declare"> 466 467 468 469 470 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"/> 471 471 </xsl:template> 472 472 … … 477 477 <xsl:template match="interface | collection | enumerator" mode="define"> 478 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 479 <xsl:text>// </xsl:text> 480 <xsl:value-of select="@name"/> 481 <xsl:text> wrapper

</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
{
</xsl:text> 488 <xsl:text> ULONG count = 0;
</xsl:text> 489 <xsl:text> Assert (mIface);
</xsl:text> 490 <xsl:text> if (!mIface)
 return count;
</xsl:text> 491 <xsl:text> mRC = mIface->COMGETTER(Count) (&count);
</xsl:text> 492 <xsl:call-template name="tryComposeFetchErrorInfo"/> 493 <xsl:text> return count;
</xsl:text> 494 <xsl:text>}

</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
{
</xsl:text> 501 <xsl:text> </xsl:text><xsl:apply-templates select="@type"/> 502 <xsl:text> item;
</xsl:text> 503 <xsl:text> Assert (mIface);
</xsl:text> 504 <xsl:text> if (!mIface)
 return item;
</xsl:text> 505 <xsl:text> mRC = mIface->GetItemAt (index, &item.mIface);
</xsl:text> 506 <xsl:call-template name="tryComposeFetchErrorInfo"/> 507 <xsl:text> return item;
</xsl:text> 508 <xsl:text>}

</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
{
</xsl:text> 515 <xsl:text> </xsl:text><xsl:apply-templates select="@enumerator"/> 516 <xsl:text> enumerator;
</xsl:text> 517 <xsl:text> Assert (mIface);
</xsl:text> 518 <xsl:text> if (!mIface)
 return enumerator;
</xsl:text> 519 <xsl:text> mRC = mIface->Enumerate (&enumerator.mIface);
</xsl:text> 520 <xsl:call-template name="tryComposeFetchErrorInfo"/> 521 <xsl:text> return enumerator;
</xsl:text> 522 <xsl:text>}

</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
{
</xsl:text> 530 <xsl:text> BOOL more = FALSE;
</xsl:text> 531 <xsl:text> Assert (mIface);
</xsl:text> 532 <xsl:text> if (!mIface)
 return more;
</xsl:text> 533 <xsl:text> mRC = mIface->HasMore (&more);
</xsl:text> 534 <xsl:call-template name="tryComposeFetchErrorInfo"/> 535 <xsl:text> return more;
</xsl:text> 536 <xsl:text>}

</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
{
</xsl:text> 543 <xsl:text> </xsl:text><xsl:apply-templates select="@type"/> 544 <xsl:text> next;
</xsl:text> 545 <xsl:text> Assert (mIface);
</xsl:text> 546 <xsl:text> if (!mIface)
 return next;
</xsl:text> 547 <xsl:text> mRC = mIface->GetNext (&next.mIface);
</xsl:text> 548 <xsl:call-template name="tryComposeFetchErrorInfo"/> 549 <xsl:text> return next;
</xsl:text> 550 <xsl:text>}

</xsl:text> 551 </xsl:if> 552 553 <xsl:if test="name()='interface' or name()='collection'"> 554 <xsl:call-template name="defineMembers"/> 555 </xsl:if> 556 556 557 557 </xsl:template> … … 564 564 <!-- attribute definitions --> 565 565 <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')"> 568 573 <xsl:call-template name="composeMethod"> 569 <xsl:with-param name="return" select="."/>570 574 <xsl:with-param name="return" select="''"/> 575 <xsl:with-param name="define" select="'yes'"/> 571 576 </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>
</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>
</xsl:text> 581 581 </xsl:template> 582 582 583 583 <!-- method definitions --> 584 584 <xsl:template match="interface//method | collection//method" mode="define"> 585 586 587 588 589 590 591 592 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>
</xsl:text> 593 593 </xsl:template> 594 594 … … 620 620 --> 621 621 <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>
{
</xsl:text> 647 <!-- iface assertion --> 648 <xsl:text> Assert (mIface);
</xsl:text> 649 <xsl:text> if (!mIface)
 return;
</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>}
</xsl:text> 655 </xsl:if> 656 <xsl:if test="not($define)"> 657 <xsl:text>;
</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>
{
 </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>;
</xsl:text> 687 <!-- iface assertion --> 688 <xsl:text> Assert (mIface);
</xsl:text> 689 <xsl:text> if (!mIface)
 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>;
</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>;
}
</xsl:text> 702 </xsl:if> 703 <xsl:if test="not($define)"> 704 <xsl:text>;
</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> 708 632 <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> 715 634 </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>
{
</xsl:text> 647 <!-- iface assertion --> 648 <xsl:text> Assert (mIface);
</xsl:text> 649 <xsl:text> if (!mIface)
 return;
</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>}
</xsl:text> 655 </xsl:if> 656 <xsl:if test="not($define)"> 657 <xsl:text>;
</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>
{
 </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>;
</xsl:text> 687 <!-- iface assertion --> 688 <xsl:text> Assert (mIface);
</xsl:text> 689 <xsl:text> if (!mIface)
 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>;
</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>;
}
</xsl:text> 702 </xsl:if> 703 <xsl:if test="not($define)"> 704 <xsl:text>;
</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> 717 717 </xsl:template> 718 718 719 719 <xsl:template name="composeMethodDecl"> 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 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> 775 775 </xsl:template> 776 776 777 777 <xsl:template name="composeMethodCall"> 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 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>);
</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"/> 854 854 </xsl:template> 855 855 … … 865 865 --> 866 866 <xsl:template name="tryComposeFetchErrorInfo"> 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 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> 888 888 </xsl:template> 889 889 890 890 <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)
 {
</xsl:text> 902 <xsl:text> fetchErrorInfo (mIface, &COM_IIDOF (Base::Iface));
</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));
</xsl:text> 906 </xsl:if> 907 <xsl:text> }
</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 <K</xsl:text> 990 <xsl:value-of select="@type"/> 991 <xsl:text>, </xsl:text> 992 <xsl:value-of select="@type"/> 993 <xsl:text>_T> (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>&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>&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('"',../@mod,'"')"/> 1134 <xsl:text>' cannot be used with type </xsl:text> 1135 <xsl:value-of select="concat('"',current(),'"!')"/> 1136 </xsl:message> 1137 </xsl:otherwise> 1138 </xsl:choose> 898 1139 </xsl:when> 899 1140 <xsl:otherwise> 900 <xsl:if test="$supports='strict' or $supports='yes'"> 901 <xsl:text> if (mRC != S_OK)
 {
</xsl:text> 902 <xsl:text> fetchErrorInfo (mIface, &COM_IIDOF (Base::Iface));
</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));
</xsl:text> 906 </xsl:if> 907 <xsl:text> }
</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 "',../@mod,'" ')"/> 1144 <xsl:text>of attribute 'mod' is invalid!</xsl:text> 1145 </xsl:message> 909 1146 </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 <K</xsl:text> 990 <xsl:value-of select="@type"/> 991 <xsl:text>, </xsl:text> 992 <xsl:value-of select="@type"/> 993 <xsl:text>_T> (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>&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 <</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> 1054 1173 <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>&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> 1069 1205 </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('"',../@mod,'"')"/> 1134 <xsl:text>' cannot be used with type </xsl:text> 1135 <xsl:value-of select="concat('"',current(),'"!')"/> 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 "',../@mod,'" ')"/> 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 <</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>></xsl:text> 1209 </xsl:if> 1210 </xsl:otherwise> 1211 </xsl:choose> 1206 </xsl:choose> 1207 <xsl:if test="../@safearray"> 1208 <xsl:text>></xsl:text> 1209 </xsl:if> 1210 </xsl:otherwise> 1211 </xsl:choose> 1212 1212 </xsl:template> 1213 1213 … … 1219 1219 --> 1220 1220 <xsl:template match=" 1221 1222 1221 attribute/@type | param/@type | 1222 enumerator/@type | collection/@type | collection/@enumerator 1223 1223 " mode="initializer"> 1224 1224 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('"',../@mod,'"')"/> 1255 <xsl:text>' cannot be used with type </xsl:text> 1256 <xsl:value-of select="concat('"',current(),'"!')"/> 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 "',../@mod,'" ')"/> 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('"',../@mod,'"')"/> 1255 <xsl:text>' cannot be used with type </xsl:text> 1256 <xsl:value-of select="concat('"',current(),'"!')"/> 1257 </xsl:message> 1258 </xsl:otherwise> 1259 </xsl:choose> 1260 </xsl:when> 1271 1261 <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 "',../@mod,'" ')"/> 1265 <xsl:text>of attribute 'mod' is invalid!</xsl:text> 1266 </xsl:message> 1298 1267 </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> 1300 1300 </xsl:template> 1301 1301 … … 1306 1306 <xsl:template match="attribute/@type | param/@type" mode="param"> 1307 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 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> &</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> &</xsl:text> 1344 </xsl:when> 1345 <xsl:when test="../@dir='out'"> 1346 <xsl:apply-templates select="."/> 1347 <xsl:text> &</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> &</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> &</xsl:text> 1377 </xsl:if> 1378 </xsl:otherwise> 1379 </xsl:choose> 1380 </xsl:when> 1381 </xsl:choose> 1382 </xsl:otherwise> 1383 </xsl:choose> 1384 1384 </xsl:template> 1385 1385 … … 1390 1390 --> 1391 1391 <xsl:template match=" 1392 1393 1392 attribute/@type | param/@type | 1393 enumerator/@type | collection/@type | collection/@enumerator 1394 1394 " mode="com"> 1395 1395 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('"',../@mod,'"')"/> 1423 <xsl:text>' cannot be used with type </xsl:text> 1424 <xsl:value-of select="concat('"',current(),'"!')"/> 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 "',../@mod,'" ')"/> 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('"',../@mod,'"')"/> 1423 <xsl:text>' cannot be used with type </xsl:text> 1424 <xsl:value-of select="concat('"',current(),'"!')"/> 1425 </xsl:message> 1426 </xsl:otherwise> 1427 </xsl:choose> 1428 </xsl:when> 1439 1429 <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 "',../@mod,'" ')"/> 1433 <xsl:text>of attribute 'mod' is invalid!</xsl:text> 1434 </xsl:message> 1493 1435 </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> 1495 1495 </xsl:template> 1496 1496 … … 1509 1509 <xsl:template name="hooks"> 1510 1510 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 <IUnknown> </xsl:text> 1537 </xsl:when> 1538 <xsl:when test="$is_iface"> 1539 <xsl:text> com::SafeIfaceArray <</xsl:text> 1540 <xsl:value-of select="@type"/> 1541 <xsl:text>> </xsl:text> 1542 </xsl:when> 1543 <xsl:otherwise> 1544 <xsl:text> com::SafeArray <</xsl:text> 1545 <xsl:apply-templates select="@type" mode="com"/> 1546 <xsl:text>> </xsl:text> 1547 </xsl:otherwise> 1548 </xsl:choose> 1549 <xsl:value-of select="@name"/> 1550 <xsl:text>;
</xsl:text> 1551 <xsl:if test="(name()='attribute' and $isSetter) or 1552 (name()='param' and @dir='in')"> 1553 <!-- convert QValueVector to SafeArray --> 1530 1554 <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 <IUnknown> </xsl:text> 1537 </xsl:when> 1538 <xsl:when test="$is_iface"> 1539 <xsl:text> com::SafeIfaceArray <</xsl:text> 1540 <xsl:value-of select="@type"/> 1541 <xsl:text>> </xsl:text> 1542 </xsl:when> 1543 <xsl:otherwise> 1544 <xsl:text> com::SafeArray <</xsl:text> 1545 <xsl:apply-templates select="@type" mode="com"/> 1546 <xsl:text>> </xsl:text> 1547 </xsl:otherwise> 1548 </xsl:choose> 1549 <xsl:value-of select="@name"/> 1550 <xsl:text>;
</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>);
</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> 1572 1562 </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>);
</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 --> 1575 1580 <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>);
</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> 1598 1588 </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>);
</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> 1607 1607 1608 1608 </xsl:template> -
trunk/src/VBox/Main/idl/doxygen.xsl
r6875 r7216 33 33 --> 34 34 <xsl:template name="uncapitalize"> 35 36 37 38 39 40 41 42 43 44 45 46 47 48 35 <xsl:param name="str" select="."/> 36 <xsl:choose> 37 <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))"> 38 <xsl:value-of select=" 39 concat( 40 translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), 41 substring($str,2) 42 ) 43 "/> 44 </xsl:when> 45 <xsl:otherwise> 46 <xsl:value-of select="string($str)"/> 47 </xsl:otherwise> 48 </xsl:choose> 49 49 </xsl:template> 50 50 … … 53 53 --> 54 54 <xsl:template name="uppercase"> 55 56 57 58 55 <xsl:param name="str" select="."/> 56 <xsl:value-of select=" 57 translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ') 58 "/> 59 59 </xsl:template> 60 60 … … 78 78 --> 79 79 <xsl:template match="desc//*"> 80 81 82 80 <xsl:copy> 81 <xsl:apply-templates/> 82 </xsl:copy> 83 83 </xsl:template> 84 84 … … 87 87 --> 88 88 <xsl:template match="desc//p"> 89 90 91 89 <xsl:text>
</xsl:text> 90 <xsl:apply-templates/> 91 <xsl:text>
</xsl:text> 92 92 </xsl:template> 93 93 … … 96 96 --> 97 97 <xsl:template match="desc//link"> 98 <xsl:text>@link </xsl:text> 99 <!-- 100 * sometimes Doxygen is stupid and cannot resolve global enums properly, 101 * thinking they are members of the current class. Fix it by adding :: 102 * in front of any @to value that doesn't start with #. 103 --> 104 <xsl:choose> 105 <xsl:when test="not(starts-with(@to, '#')) and not(contains(@to, '::'))"> 106 <xsl:text>::</xsl:text> 98 <xsl:text>@link </xsl:text> 99 <!-- 100 * sometimes Doxygen is stupid and cannot resolve global enums properly, 101 * thinking they are members of the current class. Fix it by adding :: 102 * in front of any @to value that doesn't start with #. 103 --> 104 <xsl:choose> 105 <xsl:when test="not(starts-with(@to, '#')) and not(contains(@to, '::'))"> 106 <xsl:text>::</xsl:text> 107 </xsl:when> 108 </xsl:choose> 109 <!-- 110 * Doxygen doesn't understand autolinks like Class::func() if Class 111 * doesn't actually contain a func with no arguments. Fix it. 112 --> 113 <xsl:choose> 114 <xsl:when test="substring(@to, string-length(@to)-1)='()'"> 115 <xsl:value-of select="substring-before(@to, '()')"/> 116 </xsl:when> 117 <xsl:otherwise> 118 <xsl:value-of select="@to"/> 119 </xsl:otherwise> 120 </xsl:choose> 121 <xsl:text> </xsl:text> 122 <xsl:choose> 123 <xsl:when test="normalize-space(text())"> 124 <xsl:value-of select="normalize-space(text())"/> 125 </xsl:when> 126 <xsl:otherwise> 127 <xsl:choose> 128 <xsl:when test="starts-with(@to, '#')"> 129 <xsl:value-of select="substring-after(@to, '#')"/> 107 130 </xsl:when> 108 </xsl:choose> 109 <!-- 110 * Doxygen doesn't understand autolinks like Class::func() if Class 111 * doesn't actually contain a func with no arguments. Fix it. 112 --> 113 <xsl:choose> 114 <xsl:when test="substring(@to, string-length(@to)-1)='()'"> 115 <xsl:value-of select="substring-before(@to, '()')"/> 131 <xsl:when test="starts-with(@to, '::')"> 132 <xsl:value-of select="substring-after(@to, '::')"/> 116 133 </xsl:when> 117 134 <xsl:otherwise> 118 135 <xsl:value-of select="@to"/> 119 136 </xsl:otherwise> 120 </xsl:choose> 121 <xsl:text> </xsl:text> 122 <xsl:choose> 123 <xsl:when test="normalize-space(text())"> 124 <xsl:value-of select="normalize-space(text())"/> 125 </xsl:when> 126 <xsl:otherwise> 127 <xsl:choose> 128 <xsl:when test="starts-with(@to, '#')"> 129 <xsl:value-of select="substring-after(@to, '#')"/> 130 </xsl:when> 131 <xsl:when test="starts-with(@to, '::')"> 132 <xsl:value-of select="substring-after(@to, '::')"/> 133 </xsl:when> 134 <xsl:otherwise> 135 <xsl:value-of select="@to"/> 136 </xsl:otherwise> 137 </xsl:choose> 138 </xsl:otherwise> 139 </xsl:choose> 140 <xsl:text>@endlink</xsl:text> 141 <!-- 142 * insert a dummy empty B element to distinctly separate @endlink 143 * from the following text 144 --> 145 <xsl:element name="b"/> 137 </xsl:choose> 138 </xsl:otherwise> 139 </xsl:choose> 140 <xsl:text>@endlink</xsl:text> 141 <!-- 142 * insert a dummy empty B element to distinctly separate @endlink 143 * from the following text 144 --> 145 <xsl:element name="b"/> 146 146 </xsl:template> 147 147 … … 150 150 --> 151 151 <xsl:template match="desc/note"> 152 153 154 152 <xsl:text>
@note </xsl:text> 153 <xsl:apply-templates/> 154 <xsl:text>
</xsl:text> 155 155 </xsl:template> 156 156 … … 159 159 --> 160 160 <xsl:template match="desc/see"> 161 162 163 161 <xsl:text>
@see </xsl:text> 162 <xsl:apply-templates/> 163 <xsl:text>
</xsl:text> 164 164 </xsl:template> 165 165 … … 168 168 --> 169 169 <xsl:template match="interface/desc"> 170 171 172 173 170 <xsl:text>/**
</xsl:text> 171 <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/> 172 <xsl:apply-templates select="note"/> 173 <xsl:apply-templates select="see"/> 174 174 @par Interface ID: 175 175 <tt>{<xsl:call-template name="uppercase"> 176 177 178 176 <xsl:with-param name="str" select="../@uuid"/> 177 </xsl:call-template>}</tt> 178 <xsl:text>
*/
</xsl:text> 179 179 </xsl:template> 180 180 … … 183 183 --> 184 184 <xsl:template match="attribute/desc"> 185 186 187 188 189 185 <xsl:text>/**
</xsl:text> 186 <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/> 187 <xsl:apply-templates select="note"/> 188 <xsl:if test="../@mod='ptr'"> 189 <xsl:text> 190 190 191 191 @warning This attribute is non-scriptable. In particular, this also means that an … … 193 193 owns the object will most likely fail or crash your application. 194 194 </xsl:text> 195 196 197 195 </xsl:if> 196 <xsl:apply-templates select="see"/> 197 <xsl:text>
*/
</xsl:text> 198 198 </xsl:template> 199 199 … … 202 202 --> 203 203 <xsl:template match="method/desc"> 204 205 206 207 208 209 210 211 212 204 <xsl:text>/**
</xsl:text> 205 <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/> 206 <xsl:for-each select="../param"> 207 <xsl:apply-templates select="desc"/> 208 </xsl:for-each> 209 <xsl:apply-templates select="note"/> 210 <xsl:apply-templates select="../param/desc/note"/> 211 <xsl:if test="../param/@mod='ptr'"> 212 <xsl:text> 213 213 214 214 @warning This method is non-scriptable. In particluar, this also means that an … … 216 216 owns the object will most likely fail or crash your application. 217 217 </xsl:text> 218 219 220 218 </xsl:if> 219 <xsl:apply-templates select="see"/> 220 <xsl:text>
*/
</xsl:text> 221 221 </xsl:template> 222 222 … … 225 225 --> 226 226 <xsl:template match="method/param/desc"> 227 228 229 230 231 227 <xsl:text>
@param </xsl:text> 228 <xsl:value-of select="../@name"/> 229 <xsl:text> </xsl:text> 230 <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/> 231 <xsl:text>
</xsl:text> 232 232 </xsl:template> 233 233 … … 236 236 --> 237 237 <xsl:template match="enum/desc"> 238 239 240 241 238 <xsl:text>/**
</xsl:text> 239 <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/> 240 <xsl:apply-templates select="note"/> 241 <xsl:apply-templates select="see"/> 242 242 @par Interface ID: 243 243 <tt>{<xsl:call-template name="uppercase"> 244 245 246 244 <xsl:with-param name="str" select="../@uuid"/> 245 </xsl:call-template>}</tt> 246 <xsl:text>
*/
</xsl:text> 247 247 </xsl:template> 248 248 … … 251 251 --> 252 252 <xsl:template match="enum/const/desc"> 253 254 255 256 257 253 <xsl:text>/** @brief </xsl:text> 254 <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/> 255 <xsl:apply-templates select="note"/> 256 <xsl:apply-templates select="see"/> 257 <xsl:text>
*/
</xsl:text> 258 258 </xsl:template> 259 259 … … 322 322 * <i>must not</i> be used for programming. 323 323 */ 324 325 324 <xsl:text>
</xsl:text> 325 <xsl:apply-templates/> 326 326 </xsl:template> 327 327 … … 331 331 --> 332 332 <xsl:template match="if"> 333 333 <xsl:apply-templates/> 334 334 </xsl:template> 335 335 … … 346 346 --> 347 347 <xsl:template match="@if" mode="begin"> 348 349 350 348 <xsl:text>#if </xsl:text> 349 <xsl:value-of select="."/> 350 <xsl:text>
</xsl:text> 351 351 </xsl:template> 352 352 <xsl:template match="@if" mode="end"> 353 353 <xsl:text>#endif
</xsl:text> 354 354 </xsl:template> 355 355 … … 359 359 --> 360 360 <xsl:template match="library"> 361 362 363 364 361 <!-- all enums go first --> 362 <xsl:apply-templates select="enum | if/enum"/> 363 <!-- everything else but enums --> 364 <xsl:apply-templates select="*[not(self::enum) and not(self::if[enum])]"/> 365 365 </xsl:template> 366 366 … … 370 370 --> 371 371 <xsl:template match="interface"> 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 372 <xsl:apply-templates select="desc"/> 373 <xsl:text>interface </xsl:text> 374 <xsl:value-of select="@name"/> 375 <xsl:text> : </xsl:text> 376 <xsl:value-of select="@extends"/> 377 <xsl:text>
{
</xsl:text> 378 <!-- attributes (properties) --> 379 <xsl:apply-templates select="attribute"/> 380 <!-- methods --> 381 <xsl:apply-templates select="method"/> 382 <!-- 'if' enclosed elements, unsorted --> 383 <xsl:apply-templates select="if"/> 384 <!-- --> 385 <xsl:text>}; /* interface </xsl:text> 386 <xsl:value-of select="@name"/> 387 <xsl:text> */

</xsl:text> 388 388 </xsl:template> 389 389 … … 394 394 <xsl:template match="interface//attribute | collection//attribute"> 395 395 <xsl:if test="@array"> 396 <xsl:message terminate="yes"> 397 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 398 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text> 399 </xsl:message> 400 </xsl:if> 401 <xsl:apply-templates select="@if" mode="begin"/> 396 <xsl:message terminate="yes"> 397 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 398 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text> 399 </xsl:message> 400 </xsl:if> 401 <xsl:apply-templates select="@if" mode="begin"/> 402 <xsl:apply-templates select="desc"/> 403 <xsl:text> </xsl:text> 404 <xsl:if test="@readonly='yes'"> 405 <xsl:text>readonly </xsl:text> 406 </xsl:if> 407 <xsl:text>attribute </xsl:text> 408 <xsl:apply-templates select="@type"/> 409 <xsl:text> </xsl:text> 410 <xsl:value-of select="@name"/> 411 <xsl:text>;
</xsl:text> 412 <xsl:apply-templates select="@if" mode="end"/> 413 <xsl:text>
</xsl:text> 414 </xsl:template> 415 416 <!-- 417 * methods 418 --> 419 <xsl:template match="interface//method | collection//method"> 420 <xsl:apply-templates select="@if" mode="begin"/> 421 <xsl:apply-templates select="desc"/> 422 <xsl:text> void </xsl:text> 423 <xsl:value-of select="@name"/> 424 <xsl:if test="param"> 425 <xsl:text> (
</xsl:text> 426 <xsl:for-each select="param [position() != last()]"> 427 <xsl:text> </xsl:text> 428 <xsl:apply-templates select="."/> 429 <xsl:text>,
</xsl:text> 430 </xsl:for-each> 431 <xsl:text> </xsl:text> 432 <xsl:apply-templates select="param [last()]"/> 433 <xsl:text>
 );
</xsl:text> 434 </xsl:if> 435 <xsl:if test="not(param)"> 436 <xsl:text>();
</xsl:text> 437 </xsl:if> 438 <xsl:apply-templates select="@if" mode="end"/> 439 <xsl:text>
</xsl:text> 440 </xsl:template> 441 442 443 <!-- 444 * co-classes 445 --> 446 <xsl:template match="module/class"> 447 <!-- class and contract id: later --> 448 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32: later --> 449 </xsl:template> 450 451 452 <!-- 453 * enumerators 454 --> 455 <xsl:template match="enumerator"> 456 <xsl:text>interface </xsl:text> 457 <xsl:value-of select="@name"/> 458 <xsl:text> : $unknown
{
</xsl:text> 459 <!-- HasMore --> 460 <xsl:text> void hasMore ([retval] out boolean more);

</xsl:text> 461 <!-- GetNext --> 462 <xsl:text> void getNext ([retval] out </xsl:text> 463 <xsl:apply-templates select="@type"/> 464 <xsl:text> next);

</xsl:text> 465 <!-- --> 466 <xsl:text>}; /* interface </xsl:text> 467 <xsl:value-of select="@name"/> 468 <xsl:text> */

</xsl:text> 469 </xsl:template> 470 471 472 <!-- 473 * collections 474 --> 475 <xsl:template match="collection"> 476 <xsl:if test="not(@readonly='yes')"> 477 <xsl:message terminate="yes"> 478 <xsl:value-of select="concat(@name,': ')"/> 479 <xsl:text>non-readonly collections are not currently supported</xsl:text> 480 </xsl:message> 481 </xsl:if> 482 <xsl:text>interface </xsl:text> 483 <xsl:value-of select="@name"/> 484 <xsl:text> : $unknown
{
</xsl:text> 485 <!-- Count --> 486 <xsl:text> readonly attribute unsigned long count;

</xsl:text> 487 <!-- GetItemAt --> 488 <xsl:text> void getItemAt (in unsigned long index, [retval] out </xsl:text> 489 <xsl:apply-templates select="@type"/> 490 <xsl:text> item);

</xsl:text> 491 <!-- Enumerate --> 492 <xsl:text> void enumerate ([retval] out </xsl:text> 493 <xsl:apply-templates select="@enumerator"/> 494 <xsl:text> enumerator);

</xsl:text> 495 <!-- other extra attributes (properties) --> 496 <xsl:apply-templates select="attribute"/> 497 <!-- other extra methods --> 498 <xsl:apply-templates select="method"/> 499 <!-- 'if' enclosed elements, unsorted --> 500 <xsl:apply-templates select="if"/> 501 <!-- --> 502 <xsl:text>}; /* interface </xsl:text> 503 <xsl:value-of select="@name"/> 504 <xsl:text> */

</xsl:text> 505 </xsl:template> 506 507 508 <!-- 509 * enums 510 --> 511 <xsl:template match="enum"> 512 <xsl:apply-templates select="desc"/> 513 <xsl:text>enum </xsl:text> 514 <xsl:value-of select="@name"/> 515 <xsl:text>
{
</xsl:text> 516 <xsl:for-each select="const"> 402 517 <xsl:apply-templates select="desc"/> 403 518 <xsl:text> </xsl:text> 404 <xsl:if test="@readonly='yes'"> 405 <xsl:text>readonly </xsl:text> 519 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/> 520 <xsl:text>,
</xsl:text> 521 </xsl:for-each> 522 <xsl:text>};

</xsl:text> 523 </xsl:template> 524 525 526 <!-- 527 * method parameters 528 --> 529 <xsl:template match="method/param"> 530 <xsl:if test="@array"> 531 <xsl:if test="@dir='return'"> 532 <xsl:message terminate="yes"> 533 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 534 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text> 535 </xsl:message> 406 536 </xsl:if> 407 <xsl:text>attribute </xsl:text> 408 <xsl:apply-templates select="@type"/> 409 <xsl:text> </xsl:text> 410 <xsl:value-of select="@name"/> 411 <xsl:text>;
</xsl:text> 412 <xsl:apply-templates select="@if" mode="end"/> 413 <xsl:text>
</xsl:text> 414 </xsl:template> 415 416 <!-- 417 * methods 418 --> 419 <xsl:template match="interface//method | collection//method"> 420 <xsl:apply-templates select="@if" mode="begin"/> 421 <xsl:apply-templates select="desc"/> 422 <xsl:text> void </xsl:text> 423 <xsl:value-of select="@name"/> 424 <xsl:if test="param"> 425 <xsl:text> (
</xsl:text> 426 <xsl:for-each select="param [position() != last()]"> 427 <xsl:text> </xsl:text> 428 <xsl:apply-templates select="."/> 429 <xsl:text>,
</xsl:text> 430 </xsl:for-each> 431 <xsl:text> </xsl:text> 432 <xsl:apply-templates select="param [last()]"/> 433 <xsl:text>
 );
</xsl:text> 434 </xsl:if> 435 <xsl:if test="not(param)"> 436 <xsl:text>();
</xsl:text> 437 </xsl:if> 438 <xsl:apply-templates select="@if" mode="end"/> 439 <xsl:text>
</xsl:text> 440 </xsl:template> 441 442 443 <!-- 444 * co-classes 445 --> 446 <xsl:template match="module/class"> 447 <!-- class and contract id: later --> 448 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32: later --> 449 </xsl:template> 450 451 452 <!-- 453 * enumerators 454 --> 455 <xsl:template match="enumerator"> 456 <xsl:text>interface </xsl:text> 457 <xsl:value-of select="@name"/> 458 <xsl:text> : $unknown
{
</xsl:text> 459 <!-- HasMore --> 460 <xsl:text> void hasMore ([retval] out boolean more);

</xsl:text> 461 <!-- GetNext --> 462 <xsl:text> void getNext ([retval] out </xsl:text> 463 <xsl:apply-templates select="@type"/> 464 <xsl:text> next);

</xsl:text> 465 <!-- --> 466 <xsl:text>}; /* interface </xsl:text> 467 <xsl:value-of select="@name"/> 468 <xsl:text> */

</xsl:text> 469 </xsl:template> 470 471 472 <!-- 473 * collections 474 --> 475 <xsl:template match="collection"> 476 <xsl:if test="not(@readonly='yes')"> 537 <xsl:text>[array, </xsl:text> 538 <xsl:choose> 539 <xsl:when test="../param[@name=current()/@array]"> 540 <xsl:if test="../param[@name=current()/@array]/@dir != @dir"> 541 <xsl:message terminate="yes"> 542 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/> 543 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/> 544 <xsl:text> must have the same direction</xsl:text> 545 </xsl:message> 546 </xsl:if> 547 <xsl:text>size_is(</xsl:text> 548 <xsl:if test="@dir='out'"> 549 <xsl:text>, </xsl:text> 550 </xsl:if> 551 <xsl:if test="../param[@name=current()/@array]/@dir='out'"> 552 <xsl:text>*</xsl:text> 553 </xsl:if> 554 <xsl:value-of select="@array"/> 555 <xsl:text>)</xsl:text> 556 </xsl:when> 557 <xsl:otherwise> 477 558 <xsl:message terminate="yes"> 478 <xsl:value-of select="concat(@name,': ')"/> 479 <xsl:text>non-readonly collections are not currently supported</xsl:text> 559 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 560 <xsl:text>array attribute refers to non-existent param: </xsl:text> 561 <xsl:value-of select="@array"/> 480 562 </xsl:message> 481 </xsl:if> 482 <xsl:text>interface </xsl:text> 483 <xsl:value-of select="@name"/> 484 <xsl:text> : $unknown
{
</xsl:text> 485 <!-- Count --> 486 <xsl:text> readonly attribute unsigned long count;

</xsl:text> 487 <!-- GetItemAt --> 488 <xsl:text> void getItemAt (in unsigned long index, [retval] out </xsl:text> 489 <xsl:apply-templates select="@type"/> 490 <xsl:text> item);

</xsl:text> 491 <!-- Enumerate --> 492 <xsl:text> void enumerate ([retval] out </xsl:text> 493 <xsl:apply-templates select="@enumerator"/> 494 <xsl:text> enumerator);

</xsl:text> 495 <!-- other extra attributes (properties) --> 496 <xsl:apply-templates select="attribute"/> 497 <!-- other extra methods --> 498 <xsl:apply-templates select="method"/> 499 <!-- 'if' enclosed elements, unsorted --> 500 <xsl:apply-templates select="if"/> 501 <!-- --> 502 <xsl:text>}; /* interface </xsl:text> 503 <xsl:value-of select="@name"/> 504 <xsl:text> */

</xsl:text> 505 </xsl:template> 506 507 508 <!-- 509 * enums 510 --> 511 <xsl:template match="enum"> 512 <xsl:apply-templates select="desc"/> 513 <xsl:text>enum </xsl:text> 514 <xsl:value-of select="@name"/> 515 <xsl:text>
{
</xsl:text> 516 <xsl:for-each select="const"> 517 <xsl:apply-templates select="desc"/> 518 <xsl:text> </xsl:text> 519 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/> 520 <xsl:text>,
</xsl:text> 521 </xsl:for-each> 522 <xsl:text>};

</xsl:text> 523 </xsl:template> 524 525 526 <!-- 527 * method parameters 528 --> 529 <xsl:template match="method/param"> 530 <xsl:if test="@array"> 531 <xsl:if test="@dir='return'"> 532 <xsl:message terminate="yes"> 533 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 534 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text> 535 </xsl:message> 536 </xsl:if> 537 <xsl:text>[array, </xsl:text> 538 <xsl:choose> 539 <xsl:when test="../param[@name=current()/@array]"> 540 <xsl:if test="../param[@name=current()/@array]/@dir != @dir"> 541 <xsl:message terminate="yes"> 542 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/> 543 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/> 544 <xsl:text> must have the same direction</xsl:text> 545 </xsl:message> 546 </xsl:if> 547 <xsl:text>size_is(</xsl:text> 548 <xsl:if test="@dir='out'"> 549 <xsl:text>, </xsl:text> 550 </xsl:if> 551 <xsl:if test="../param[@name=current()/@array]/@dir='out'"> 552 <xsl:text>*</xsl:text> 553 </xsl:if> 554 <xsl:value-of select="@array"/> 555 <xsl:text>)</xsl:text> 563 </xsl:otherwise> 564 </xsl:choose> 565 <xsl:text>] </xsl:text> 566 </xsl:if> 567 <xsl:choose> 568 <xsl:when test="@dir='in'">in </xsl:when> 569 <xsl:when test="@dir='out'">out </xsl:when> 570 <xsl:when test="@dir='return'">[retval] out </xsl:when> 571 <xsl:otherwise>in</xsl:otherwise> 572 </xsl:choose> 573 <xsl:apply-templates select="@type"/> 574 <xsl:text> </xsl:text> 575 <xsl:value-of select="@name"/> 576 </xsl:template> 577 578 579 <!-- 580 * attribute/parameter type conversion 581 --> 582 <xsl:template match=" 583 attribute/@type | param/@type | 584 enumerator/@type | collection/@type | collection/@enumerator 585 "> 586 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 587 588 <xsl:if test="../@array and ../@safearray='yes'"> 589 <xsl:message terminate="yes"> 590 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 591 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text> 592 </xsl:message> 593 </xsl:if> 594 595 <xsl:choose> 596 <!-- modifiers (ignored for 'enumeration' attributes)--> 597 <xsl:when test="name(current())='type' and ../@mod"> 598 <xsl:choose> 599 <xsl:when test="../@mod='ptr'"> 600 <xsl:choose> 601 <!-- standard types --> 602 <!--xsl:when test=".='result'">??</xsl:when--> 603 <xsl:when test=".='boolean'">booeanPtr</xsl:when> 604 <xsl:when test=".='octet'">octetPtr</xsl:when> 605 <xsl:when test=".='short'">shortPtr</xsl:when> 606 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when> 607 <xsl:when test=".='long'">longPtr</xsl:when> 608 <xsl:when test=".='long long'">llongPtr</xsl:when> 609 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when> 610 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when> 611 <xsl:when test=".='char'">charPtr</xsl:when> 612 <!--xsl:when test=".='string'">??</xsl:when--> 613 <xsl:when test=".='wchar'">wcharPtr</xsl:when> 614 <!--xsl:when test=".='wstring'">??</xsl:when--> 615 <xsl:otherwise> 616 <xsl:message terminate="yes"> 617 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 618 <xsl:text>attribute 'mod=</xsl:text> 619 <xsl:value-of select="concat('"',../@mod,'"')"/> 620 <xsl:text>' cannot be used with type </xsl:text> 621 <xsl:value-of select="concat('"',current(),'"!')"/> 622 </xsl:message> 623 </xsl:otherwise> 624 </xsl:choose> 625 </xsl:when> 626 <xsl:otherwise> 627 <xsl:message terminate="yes"> 628 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 629 <xsl:value-of select="concat('value "',../@mod,'" ')"/> 630 <xsl:text>of attibute 'mod' is invalid!</xsl:text> 631 </xsl:message> 632 </xsl:otherwise> 633 </xsl:choose> 634 </xsl:when> 635 <!-- no modifiers --> 636 <xsl:otherwise> 637 <xsl:choose> 638 <!-- standard types --> 639 <xsl:when test=".='result'">result</xsl:when> 640 <xsl:when test=".='boolean'">boolean</xsl:when> 641 <xsl:when test=".='octet'">octet</xsl:when> 642 <xsl:when test=".='short'">short</xsl:when> 643 <xsl:when test=".='unsigned short'">unsigned short</xsl:when> 644 <xsl:when test=".='long'">long</xsl:when> 645 <xsl:when test=".='long long'">long long</xsl:when> 646 <xsl:when test=".='unsigned long'">unsigned long</xsl:when> 647 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when> 648 <xsl:when test=".='char'">char</xsl:when> 649 <xsl:when test=".='wchar'">wchar</xsl:when> 650 <xsl:when test=".='string'">string</xsl:when> 651 <xsl:when test=".='wstring'">wstring</xsl:when> 652 <!-- UUID type --> 653 <xsl:when test=".='uuid'">uuid</xsl:when> 654 <!-- system interface types --> 655 <xsl:when test=".='$unknown'">$unknown</xsl:when> 656 <xsl:otherwise> 657 <xsl:choose> 658 <!-- enum types --> 659 <xsl:when test=" 660 (ancestor::library/enum[@name=current()]) or 661 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 662 "> 663 <xsl:value-of select="."/> 556 664 </xsl:when> 665 <!-- custom interface types --> 666 <xsl:when test=" 667 (name(current())='enumerator' and 668 ((ancestor::library/enumerator[@name=current()]) or 669 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])) 670 ) or 671 ((ancestor::library/interface[@name=current()]) or 672 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 673 ) or 674 ((ancestor::library/collection[@name=current()]) or 675 (ancestor::library/if[@target=$self_target]/collection[@name=current()]) 676 ) 677 "> 678 <xsl:value-of select="."/> 679 </xsl:when> 680 <!-- other types --> 557 681 <xsl:otherwise> 558 <xsl:message terminate="yes"> 559 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 560 <xsl:text>array attribute refers to non-existent param: </xsl:text> 561 <xsl:value-of select="@array"/> 562 </xsl:message> 682 <xsl:message terminate="yes"> 683 <xsl:text>Unknown parameter type: </xsl:text> 684 <xsl:value-of select="."/> 685 </xsl:message> 563 686 </xsl:otherwise> 564 </xsl:choose> 565 <xsl:text>] </xsl:text> 566 </xsl:if> 567 <xsl:choose> 568 <xsl:when test="@dir='in'">in </xsl:when> 569 <xsl:when test="@dir='out'">out </xsl:when> 570 <xsl:when test="@dir='return'">[retval] out </xsl:when> 571 <xsl:otherwise>in</xsl:otherwise> 572 </xsl:choose> 573 <xsl:apply-templates select="@type"/> 574 <xsl:text> </xsl:text> 575 <xsl:value-of select="@name"/> 576 </xsl:template> 577 578 579 <!-- 580 * attribute/parameter type conversion 581 --> 582 <xsl:template match=" 583 attribute/@type | param/@type | 584 enumerator/@type | collection/@type | collection/@enumerator 585 "> 586 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 587 588 <xsl:if test="../@array and ../@safearray='yes'"> 589 <xsl:message terminate="yes"> 590 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 591 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text> 592 </xsl:message> 593 </xsl:if> 594 595 <xsl:choose> 596 <!-- modifiers (ignored for 'enumeration' attributes)--> 597 <xsl:when test="name(current())='type' and ../@mod"> 598 <xsl:choose> 599 <xsl:when test="../@mod='ptr'"> 600 <xsl:choose> 601 <!-- standard types --> 602 <!--xsl:when test=".='result'">??</xsl:when--> 603 <xsl:when test=".='boolean'">booeanPtr</xsl:when> 604 <xsl:when test=".='octet'">octetPtr</xsl:when> 605 <xsl:when test=".='short'">shortPtr</xsl:when> 606 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when> 607 <xsl:when test=".='long'">longPtr</xsl:when> 608 <xsl:when test=".='long long'">llongPtr</xsl:when> 609 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when> 610 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when> 611 <xsl:when test=".='char'">charPtr</xsl:when> 612 <!--xsl:when test=".='string'">??</xsl:when--> 613 <xsl:when test=".='wchar'">wcharPtr</xsl:when> 614 <!--xsl:when test=".='wstring'">??</xsl:when--> 615 <xsl:otherwise> 616 <xsl:message terminate="yes"> 617 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 618 <xsl:text>attribute 'mod=</xsl:text> 619 <xsl:value-of select="concat('"',../@mod,'"')"/> 620 <xsl:text>' cannot be used with type </xsl:text> 621 <xsl:value-of select="concat('"',current(),'"!')"/> 622 </xsl:message> 623 </xsl:otherwise> 624 </xsl:choose> 625 </xsl:when> 626 <xsl:otherwise> 627 <xsl:message terminate="yes"> 628 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 629 <xsl:value-of select="concat('value "',../@mod,'" ')"/> 630 <xsl:text>of attibute 'mod' is invalid!</xsl:text> 631 </xsl:message> 632 </xsl:otherwise> 633 </xsl:choose> 634 </xsl:when> 635 <!-- no modifiers --> 636 <xsl:otherwise> 637 <xsl:choose> 638 <!-- standard types --> 639 <xsl:when test=".='result'">result</xsl:when> 640 <xsl:when test=".='boolean'">boolean</xsl:when> 641 <xsl:when test=".='octet'">octet</xsl:when> 642 <xsl:when test=".='short'">short</xsl:when> 643 <xsl:when test=".='unsigned short'">unsigned short</xsl:when> 644 <xsl:when test=".='long'">long</xsl:when> 645 <xsl:when test=".='long long'">long long</xsl:when> 646 <xsl:when test=".='unsigned long'">unsigned long</xsl:when> 647 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when> 648 <xsl:when test=".='char'">char</xsl:when> 649 <xsl:when test=".='wchar'">wchar</xsl:when> 650 <xsl:when test=".='string'">string</xsl:when> 651 <xsl:when test=".='wstring'">wstring</xsl:when> 652 <!-- UUID type --> 653 <xsl:when test=".='uuid'">uuid</xsl:when> 654 <!-- system interface types --> 655 <xsl:when test=".='$unknown'">$unknown</xsl:when> 656 <xsl:otherwise> 657 <xsl:choose> 658 <!-- enum types --> 659 <xsl:when test=" 660 (ancestor::library/enum[@name=current()]) or 661 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 662 "> 663 <xsl:value-of select="."/> 664 </xsl:when> 665 <!-- custom interface types --> 666 <xsl:when test=" 667 (name(current())='enumerator' and 668 ((ancestor::library/enumerator[@name=current()]) or 669 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])) 670 ) or 671 ((ancestor::library/interface[@name=current()]) or 672 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 673 ) or 674 ((ancestor::library/collection[@name=current()]) or 675 (ancestor::library/if[@target=$self_target]/collection[@name=current()]) 676 ) 677 "> 678 <xsl:value-of select="."/> 679 </xsl:when> 680 <!-- other types --> 681 <xsl:otherwise> 682 <xsl:message terminate="yes"> 683 <xsl:text>Unknown parameter type: </xsl:text> 684 <xsl:value-of select="."/> 685 </xsl:message> 686 </xsl:otherwise> 687 </xsl:choose> 688 </xsl:otherwise> 689 </xsl:choose> 687 </xsl:choose> 690 688 </xsl:otherwise> 691 </xsl:choose> 689 </xsl:choose> 690 </xsl:otherwise> 691 </xsl:choose> 692 692 <xsl:if test="../@safearray='yes'"> 693 693 <xsl:text>[]</xsl:text> -
trunk/src/VBox/Main/idl/midl.xsl
r7207 r7216 31 31 --> 32 32 <xsl:template name="capitalize"> 33 34 35 36 37 38 39 33 <xsl:param name="str" select="."/> 34 <xsl:value-of select=" 35 concat( 36 translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 37 substring($str,2) 38 ) 39 "/> 40 40 </xsl:template> 41 41 … … 45 45 --> 46 46 <xsl:template name="uncapitalize"> 47 48 49 50 51 52 53 54 55 56 57 58 59 60 47 <xsl:param name="str" select="."/> 48 <xsl:choose> 49 <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))"> 50 <xsl:value-of select=" 51 concat( 52 translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), 53 substring($str,2) 54 ) 55 "/> 56 </xsl:when> 57 <xsl:otherwise> 58 <xsl:value-of select="string($str)"/> 59 </xsl:otherwise> 60 </xsl:choose> 61 61 </xsl:template> 62 62 … … 72 72 --> 73 73 <xsl:template match="/idl"> 74 74 <xsl:text> 75 75 /* 76 76 * DO NOT EDIT! This is a generated file. … … 82 82 * Generator : src/VBox/Main/idl/midl.xsl 83 83 */ 84 </xsl:text> 85 <xsl:text>
</xsl:text> 86 <xsl:text>import "unknwn.idl";

</xsl:text> 84 </xsl:text> 85 <xsl:text>
</xsl:text> 86 <xsl:text>import "unknwn.idl";

</xsl:text> 87 <xsl:apply-templates/> 88 </xsl:template> 89 90 91 <!-- 92 * ignore all |if|s except those for MIDL target 93 --> 94 <xsl:template match="if"> 95 <xsl:if test="@target='midl'"> 87 96 <xsl:apply-templates/> 88 </xsl:template> 89 90 91 <!-- 92 * ignore all |if|s except those for MIDL target 93 --> 94 <xsl:template match="if"> 95 <xsl:if test="@target='midl'"> 96 <xsl:apply-templates/> 97 </xsl:if> 97 </xsl:if> 98 98 </xsl:template> 99 99 <xsl:template match="if" mode="forward"> 100 101 102 100 <xsl:if test="@target='midl'"> 101 <xsl:apply-templates mode="forward"/> 102 </xsl:if> 103 103 </xsl:template> 104 104 … … 108 108 --> 109 109 <xsl:template match="cpp"> 110 111 112 110 <xsl:text>cpp_quote("</xsl:text> 111 <xsl:value-of select="@line"/> 112 <xsl:text>")

</xsl:text> 113 113 </xsl:template> 114 114 … … 118 118 --> 119 119 <xsl:template match="@if" mode="begin"> 120 121 122 120 <xsl:text>#if </xsl:text> 121 <xsl:value-of select="."/> 122 <xsl:text>
</xsl:text> 123 123 </xsl:template> 124 124 <xsl:template match="@if" mode="end"> 125 125 <xsl:text>#endif
</xsl:text> 126 126 </xsl:template> 127 127 … … 136 136 ] 137 137 <xsl:text>library </xsl:text> 138 139 140 141 142 143 144 145 146 147 148 149 150 151 138 <xsl:value-of select="@name"/> 139 <xsl:text>
{
</xsl:text> 140 <xsl:text>
importlib("stdole2.tlb");

</xsl:text> 141 <!-- forward declarations --> 142 <xsl:apply-templates select="if | interface | collection | enumerator" mode="forward"/> 143 <xsl:text>
</xsl:text> 144 <!-- all enums go first --> 145 <xsl:apply-templates select="enum | if/enum"/> 146 <!-- everything else but enums --> 147 <xsl:apply-templates select="*[not(self::enum) and not(self::if[enum])]"/> 148 <!-- --> 149 <xsl:text>}; /* library </xsl:text> 150 <xsl:value-of select="@name"/> 151 <xsl:text> */

</xsl:text> 152 152 </xsl:template> 153 153 … … 157 157 --> 158 158 <xsl:template match="interface | collection | enumerator" mode="forward"> 159 160 161 159 <xsl:text>interface </xsl:text> 160 <xsl:value-of select="@name"/> 161 <xsl:text>;
</xsl:text> 162 162 </xsl:template> 163 163 … … 172 172 ] 173 173 <xsl:text>interface </xsl:text> 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 174 <xsl:value-of select="@name"/> 175 <xsl:text> : </xsl:text> 176 <xsl:choose> 177 <xsl:when test="@extends='$unknown'">IUnknown</xsl:when> 178 <xsl:when test="@extends='$dispatched'">IDispatch</xsl:when> 179 <xsl:when test="@extends='$errorinfo'">IErrorInfo</xsl:when> 180 <xsl:otherwise><xsl:value-of select="@extends"/></xsl:otherwise> 181 </xsl:choose> 182 <xsl:text>
{
</xsl:text> 183 <!-- attributes (properties) --> 184 <xsl:apply-templates select="attribute"/> 185 <!-- methods --> 186 <xsl:apply-templates select="method"/> 187 <!-- 'if' enclosed elements, unsorted --> 188 <xsl:apply-templates select="if"/> 189 <!-- --> 190 <xsl:text>}; /* interface </xsl:text> 191 <xsl:value-of select="@name"/> 192 <xsl:text> */

</xsl:text> 193 193 </xsl:template> 194 194 … … 198 198 --> 199 199 <xsl:template match="interface//attribute | collection//attribute"> 200 <xsl:apply-templates select="@if" mode="begin"/> 201 <xsl:if test="@array"> 202 <xsl:message terminate="yes"> 203 <xsl:value-of select="concat(../@name,'::',@name,': ')"/> 204 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text> 205 </xsl:message> 200 <xsl:apply-templates select="@if" mode="begin"/> 201 <xsl:if test="@array"> 202 <xsl:message terminate="yes"> 203 <xsl:value-of select="concat(../@name,'::',@name,': ')"/> 204 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text> 205 </xsl:message> 206 </xsl:if> 207 <!-- getter --> 208 <xsl:text> [propget] HRESULT </xsl:text> 209 <xsl:call-template name="capitalize"> 210 <xsl:with-param name="str" select="@name"/> 211 </xsl:call-template> 212 <xsl:text> ([out, retval] </xsl:text> 213 <xsl:if test="@safearray='yes'"> 214 <xsl:text>SAFEARRAY(</xsl:text> 215 </xsl:if> 216 <xsl:apply-templates select="@type"/> 217 <xsl:if test="@safearray='yes'"> 218 <xsl:text>)</xsl:text> 219 </xsl:if> 220 <xsl:text> * a</xsl:text> 221 <xsl:call-template name="capitalize"> 222 <xsl:with-param name="str" select="@name"/> 223 </xsl:call-template> 224 <xsl:text>);
</xsl:text> 225 <!-- setter --> 226 <xsl:if test="not(@readonly='yes')"> 227 <xsl:text> [propput] HRESULT </xsl:text> 228 <xsl:call-template name="capitalize"> 229 <xsl:with-param name="str" select="@name"/> 230 </xsl:call-template> 231 <xsl:text> ([in</xsl:text> 232 <xsl:if test="@safearray='yes'"> 233 <!-- VB supports only [in, out], [out] and [out, retval] arrays --> 234 <xsl:text>, out</xsl:text> 206 235 </xsl:if> 207 <!-- getter --> 208 <xsl:text> [propget] HRESULT </xsl:text> 209 <xsl:call-template name="capitalize"> 210 <xsl:with-param name="str" select="@name"/> 211 </xsl:call-template> 212 <xsl:text> ([out, retval] </xsl:text> 236 <xsl:text>] </xsl:text> 213 237 <xsl:if test="@safearray='yes'"> 214 238 <xsl:text>SAFEARRAY(</xsl:text> 215 239 </xsl:if> 216 240 <xsl:apply-templates select="@type"/> 217 241 <xsl:if test="@safearray='yes'"> 218 <xsl:text>)</xsl:text>242 <xsl:text>) *</xsl:text> 219 243 </xsl:if> 220 <xsl:text> *a</xsl:text>244 <xsl:text> a</xsl:text> 221 245 <xsl:call-template name="capitalize"> 222 246 <xsl:with-param name="str" select="@name"/> 223 247 </xsl:call-template> 224 248 <xsl:text>);
</xsl:text> 225 <!-- setter --> 226 <xsl:if test="not(@readonly='yes')"> 227 <xsl:text> [propput] HRESULT </xsl:text> 228 <xsl:call-template name="capitalize"> 229 <xsl:with-param name="str" select="@name"/> 230 </xsl:call-template> 231 <xsl:text> ([in</xsl:text> 232 <xsl:if test="@safearray='yes'"> 233 <!-- VB supports only [in, out], [out] and [out, retval] arrays --> 234 <xsl:text>, out</xsl:text> 235 </xsl:if> 236 <xsl:text>] </xsl:text> 237 <xsl:if test="@safearray='yes'"> 238 <xsl:text>SAFEARRAY(</xsl:text> 239 </xsl:if> 240 <xsl:apply-templates select="@type"/> 241 <xsl:if test="@safearray='yes'"> 242 <xsl:text>) *</xsl:text> 243 </xsl:if> 244 <xsl:text> a</xsl:text> 245 <xsl:call-template name="capitalize"> 246 <xsl:with-param name="str" select="@name"/> 247 </xsl:call-template> 248 <xsl:text>);
</xsl:text> 249 </xsl:if> 250 <xsl:apply-templates select="@if" mode="end"/> 251 <xsl:text>
</xsl:text> 249 </xsl:if> 250 <xsl:apply-templates select="@if" mode="end"/> 251 <xsl:text>
</xsl:text> 252 252 </xsl:template> 253 253 … … 257 257 --> 258 258 <xsl:template match="interface//method | collection//method"> 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 259 <xsl:apply-templates select="@if" mode="begin"/> 260 <xsl:text> HRESULT </xsl:text> 261 <xsl:call-template name="capitalize"> 262 <xsl:with-param name="str" select="@name"/> 263 </xsl:call-template> 264 <xsl:if test="param"> 265 <xsl:text> (
</xsl:text> 266 <xsl:for-each select="param [position() != last()]"> 267 <xsl:text> </xsl:text> 268 <xsl:apply-templates select="."/> 269 <xsl:text>,
</xsl:text> 270 </xsl:for-each> 271 <xsl:text> </xsl:text> 272 <xsl:apply-templates select="param [last()]"/> 273 <xsl:text>
 );
</xsl:text> 274 </xsl:if> 275 <xsl:if test="not(param)"> 276 <xsl:text>();
</xsl:text> 277 </xsl:if> 278 <xsl:apply-templates select="@if" mode="end"/> 279 <xsl:text>
</xsl:text> 280 280 </xsl:template> 281 281 … … 288 288 ] 289 289 <xsl:text>coclass </xsl:text> 290 <xsl:value-of select="@name"/> 291 <xsl:text>
{
</xsl:text> 292 <xsl:for-each select="interface"> 293 <xsl:text> </xsl:text> 294 <xsl:if test="@default='yes'"> 295 <xsl:text>[default] </xsl:text> 296 </xsl:if> 297 <xsl:text>interface </xsl:text> 290 298 <xsl:value-of select="@name"/> 291 <xsl:text>
{
</xsl:text> 292 <xsl:for-each select="interface"> 293 <xsl:text> </xsl:text> 294 <xsl:if test="@default='yes'"> 295 <xsl:text>[default] </xsl:text> 296 </xsl:if> 297 <xsl:text>interface </xsl:text> 298 <xsl:value-of select="@name"/> 299 <xsl:text>;
</xsl:text> 300 </xsl:for-each> 301 <xsl:text>
}; /* coclass </xsl:text> 302 <xsl:value-of select="@name"/> 303 <xsl:text> */

</xsl:text> 299 <xsl:text>;
</xsl:text> 300 </xsl:for-each> 301 <xsl:text>
}; /* coclass </xsl:text> 302 <xsl:value-of select="@name"/> 303 <xsl:text> */

</xsl:text> 304 304 </xsl:template> 305 305 … … 314 314 ] 315 315 <xsl:text>interface </xsl:text> 316 317 318 319 320 321 322 323 324 325 326 327 316 <xsl:value-of select="@name"/> 317 <xsl:text> : IUnknown
{
</xsl:text> 318 <!-- HasMore --> 319 <xsl:text> HRESULT HasMore ([out, retval] BOOL * more);

</xsl:text> 320 <!-- GetNext --> 321 <xsl:text> HRESULT GetNext ([out, retval] </xsl:text> 322 <xsl:apply-templates select="@type"/> 323 <xsl:text> * next);

</xsl:text> 324 <!-- --> 325 <xsl:text>
}; /* interface </xsl:text> 326 <xsl:value-of select="@name"/> 327 <xsl:text> */

</xsl:text> 328 328 </xsl:template> 329 329 … … 333 333 --> 334 334 <xsl:template match="collection"> 335 336 337 338 339 340 335 <xsl:if test="not(@readonly='yes')"> 336 <xsl:message terminate="yes"> 337 <xsl:value-of select="concat(@name,': ')"/> 338 <xsl:text>non-readonly collections are not currently supported</xsl:text> 339 </xsl:message> 340 </xsl:if>[ 341 341 uuid(<xsl:value-of select="@uuid"/>), 342 342 object, … … 344 344 ] 345 345 <xsl:text>interface </xsl:text> 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 346 <xsl:value-of select="@name"/> 347 <xsl:text> : IUnknown
{
</xsl:text> 348 <!-- Count --> 349 <xsl:text> [propget] HRESULT Count ([out, retval] ULONG * count);

</xsl:text> 350 <!-- GetItemAt --> 351 <xsl:text> HRESULT GetItemAt ([in] ULONG index, [out, retval] </xsl:text> 352 <xsl:apply-templates select="@type"/> 353 <xsl:text> * item);

</xsl:text> 354 <!-- Enumerate --> 355 <xsl:text> HRESULT Enumerate ([out, retval] </xsl:text> 356 <xsl:apply-templates select="@enumerator"/> 357 <xsl:text> * enumerator);

</xsl:text> 358 <!-- other extra attributes (properties) --> 359 <xsl:apply-templates select="attribute"/> 360 <!-- other extra methods --> 361 <xsl:apply-templates select="method"/> 362 <!-- 'if' enclosed elements, unsorted --> 363 <xsl:apply-templates select="if"/> 364 <!-- --> 365 <xsl:text>
}; /* interface </xsl:text> 366 <xsl:value-of select="@name"/> 367 <xsl:text> */

</xsl:text> 368 368 </xsl:template> 369 369 … … 377 377 ] 378 378 <xsl:text>typedef enum 
{
</xsl:text> 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 379 <xsl:for-each select="const"> 380 <xsl:text> </xsl:text> 381 <xsl:value-of select="concat(../@name,'_',@name)"/> = <xsl:value-of select="@value"/> 382 <xsl:choose> 383 <xsl:when test="position()!=last()"><xsl:text>,
</xsl:text></xsl:when> 384 <xsl:otherwise><xsl:text>
</xsl:text></xsl:otherwise> 385 </xsl:choose> 386 </xsl:for-each> 387 <xsl:text>} </xsl:text> 388 <xsl:value-of select="@name"/> 389 <xsl:text>;

</xsl:text> 390 <!-- --> 391 <xsl:value-of select="concat('/* cross-platform type name for ', @name, ' */
')"/> 392 <xsl:value-of select="concat('cpp_quote("#define ', @name, '_T', ' ', 393 @name, '")

')"/> 394 <xsl:text>

</xsl:text> 395 395 </xsl:template> 396 396 … … 400 400 --> 401 401 <xsl:template match="method/param"> 402 <xsl:text>[</xsl:text> 402 <xsl:text>[</xsl:text> 403 <xsl:choose> 404 <xsl:when test="@dir='in'">in</xsl:when> 405 <xsl:when test="@dir='out'">out</xsl:when> 406 <xsl:when test="@dir='return'">out, retval</xsl:when> 407 <xsl:otherwise>in</xsl:otherwise> 408 </xsl:choose> 409 <xsl:if test="@safearray='yes'"> 410 <!-- VB supports only [in, out], [out] and [out, retval] arrays --> 411 <xsl:if test="@dir='in'">, out</xsl:if> 412 </xsl:if> 413 <xsl:if test="@array"> 414 <xsl:if test="@dir='return'"> 415 <xsl:message terminate="yes"> 416 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 417 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text> 418 </xsl:message> 419 </xsl:if> 403 420 <xsl:choose> 404 <xsl:when test="@dir='in'">in</xsl:when> 405 <xsl:when test="@dir='out'">out</xsl:when> 406 <xsl:when test="@dir='return'">out, retval</xsl:when> 407 <xsl:otherwise>in</xsl:otherwise> 421 <xsl:when test="../param[@name=current()/@array]"> 422 <xsl:if test="../param[@name=current()/@array]/@dir != @dir"> 423 <xsl:message terminate="yes"> 424 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/> 425 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/> 426 <xsl:text> must have the same direction</xsl:text> 427 </xsl:message> 428 </xsl:if> 429 <xsl:text>, size_is(</xsl:text> 430 <xsl:if test="@dir='out'"> 431 <xsl:text>, *</xsl:text> 432 </xsl:if> 433 <xsl:text>a</xsl:text> 434 <xsl:call-template name="capitalize"> 435 <xsl:with-param name="str" select="@array"/> 436 </xsl:call-template> 437 <xsl:text>)</xsl:text> 438 </xsl:when> 439 <xsl:otherwise> 440 <xsl:message terminate="yes"> 441 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 442 <xsl:text>array attribute refers to non-existent param: </xsl:text> 443 <xsl:value-of select="@array"/> 444 </xsl:message> 445 </xsl:otherwise> 408 446 </xsl:choose> 409 <xsl:if test="@safearray='yes'"> 410 <!-- VB supports only [in, out], [out] and [out, retval] arrays --> 411 <xsl:if test="@dir='in'">, out</xsl:if> 412 </xsl:if> 413 <xsl:if test="@array"> 414 <xsl:if test="@dir='return'"> 415 <xsl:message terminate="yes"> 416 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 417 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text> 418 </xsl:message> 419 </xsl:if> 420 <xsl:choose> 421 <xsl:when test="../param[@name=current()/@array]"> 422 <xsl:if test="../param[@name=current()/@array]/@dir != @dir"> 423 <xsl:message terminate="yes"> 424 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/> 425 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/> 426 <xsl:text> must have the same direction</xsl:text> 427 </xsl:message> 428 </xsl:if> 429 <xsl:text>, size_is(</xsl:text> 430 <xsl:if test="@dir='out'"> 431 <xsl:text>, *</xsl:text> 432 </xsl:if> 433 <xsl:text>a</xsl:text> 434 <xsl:call-template name="capitalize"> 435 <xsl:with-param name="str" select="@array"/> 436 </xsl:call-template> 437 <xsl:text>)</xsl:text> 447 </xsl:if> 448 <xsl:text>] </xsl:text> 449 <xsl:if test="@safearray='yes'"> 450 <xsl:text>SAFEARRAY(</xsl:text> 451 </xsl:if> 452 <xsl:apply-templates select="@type"/> 453 <xsl:if test="@safearray='yes'"> 454 <xsl:text>)</xsl:text> 455 </xsl:if> 456 <xsl:if test="@array"> 457 <xsl:text> *</xsl:text> 458 </xsl:if> 459 <xsl:if test="@dir='out' or @dir='return' or @safearray='yes'"> 460 <xsl:text> *</xsl:text> 461 </xsl:if> 462 <xsl:text> a</xsl:text> 463 <xsl:call-template name="capitalize"> 464 <xsl:with-param name="str" select="@name"/> 465 </xsl:call-template> 466 </xsl:template> 467 468 469 <!-- 470 * attribute/parameter type conversion 471 --> 472 <xsl:template match=" 473 attribute/@type | param/@type | 474 enumerator/@type | collection/@type | collection/@enumerator 475 "> 476 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 477 478 <xsl:if test="../@array and ../@safearray='yes'"> 479 <xsl:message terminate="yes"> 480 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 481 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text> 482 </xsl:message> 483 </xsl:if> 484 485 <xsl:choose> 486 <!-- modifiers (ignored for 'enumeration' attributes)--> 487 <xsl:when test="name(current())='type' and ../@mod"> 488 <xsl:choose> 489 <xsl:when test="../@mod='ptr'"> 490 <xsl:choose> 491 <!-- standard types --> 492 <!--xsl:when test=".='result'">??</xsl:when--> 493 <xsl:when test=".='boolean'">BOOL *</xsl:when> 494 <xsl:when test=".='octet'">BYTE *</xsl:when> 495 <xsl:when test=".='short'">SHORT *</xsl:when> 496 <xsl:when test=".='unsigned short'">USHORT *</xsl:when> 497 <xsl:when test=".='long'">LONG *</xsl:when> 498 <xsl:when test=".='long long'">LONG64 *</xsl:when> 499 <xsl:when test=".='unsigned long'">ULONG *</xsl:when> 500 <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when> 501 <xsl:when test=".='char'">CHAR *</xsl:when> 502 <!--xsl:when test=".='string'">??</xsl:when--> 503 <xsl:when test=".='wchar'">OLECHAR *</xsl:when> 504 <!--xsl:when test=".='wstring'">??</xsl:when--> 505 <xsl:otherwise> 506 <xsl:message terminate="yes"> 507 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 508 <xsl:text>attribute 'mod=</xsl:text> 509 <xsl:value-of select="concat('"',../@mod,'"')"/> 510 <xsl:text>' cannot be used with type </xsl:text> 511 <xsl:value-of select="concat('"',current(),'"!')"/> 512 </xsl:message> 513 </xsl:otherwise> 514 </xsl:choose> 515 </xsl:when> 516 <xsl:otherwise> 517 <xsl:message terminate="yes"> 518 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 519 <xsl:value-of select="concat('value "',../@mod,'" ')"/> 520 <xsl:text>of attribute 'mod' is invalid!</xsl:text> 521 </xsl:message> 522 </xsl:otherwise> 523 </xsl:choose> 524 </xsl:when> 525 <!-- no modifiers --> 526 <xsl:otherwise> 527 <xsl:choose> 528 <!-- standard types --> 529 <xsl:when test=".='result'">HRESULT</xsl:when> 530 <xsl:when test=".='boolean'">BOOL</xsl:when> 531 <xsl:when test=".='octet'">BYTE</xsl:when> 532 <xsl:when test=".='short'">SHORT</xsl:when> 533 <xsl:when test=".='unsigned short'">USHORT</xsl:when> 534 <xsl:when test=".='long'">LONG</xsl:when> 535 <xsl:when test=".='long long'">LONG64</xsl:when> 536 <xsl:when test=".='unsigned long'">ULONG</xsl:when> 537 <xsl:when test=".='unsigned long long'">ULONG64</xsl:when> 538 <xsl:when test=".='char'">CHAR</xsl:when> 539 <xsl:when test=".='string'">CHAR *</xsl:when> 540 <xsl:when test=".='wchar'">OLECHAR</xsl:when> 541 <xsl:when test=".='wstring'">BSTR</xsl:when> 542 <!-- UUID type --> 543 <xsl:when test=".='uuid'">GUID</xsl:when> 544 <!-- system interface types --> 545 <xsl:when test=".='$unknown'">IUnknown *</xsl:when> 546 <xsl:otherwise> 547 <xsl:choose> 548 <!-- enum types --> 549 <xsl:when test=" 550 (ancestor::library/enum[@name=current()]) or 551 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 552 "> 553 <xsl:value-of select="."/> 438 554 </xsl:when> 555 <!-- custom interface types --> 556 <xsl:when test=" 557 (name(current())='enumerator' and 558 ((ancestor::library/enumerator[@name=current()]) or 559 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])) 560 ) or 561 ((ancestor::library/interface[@name=current()]) or 562 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 563 ) or 564 ((ancestor::library/collection[@name=current()]) or 565 (ancestor::library/if[@target=$self_target]/collection[@name=current()]) 566 ) 567 "> 568 <xsl:value-of select="."/><xsl:text> *</xsl:text> 569 </xsl:when> 570 <!-- other types --> 439 571 <xsl:otherwise> 440 <xsl:message terminate="yes"> 441 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 442 <xsl:text>array attribute refers to non-existent param: </xsl:text> 443 <xsl:value-of select="@array"/> 444 </xsl:message> 572 <xsl:message terminate="yes"> 573 <xsl:text>Unknown parameter type: </xsl:text> 574 <xsl:value-of select="."/> 575 </xsl:message> 445 576 </xsl:otherwise> 446 </xsl:choose> 447 </xsl:if> 448 <xsl:text>] </xsl:text> 449 <xsl:if test="@safearray='yes'"> 450 <xsl:text>SAFEARRAY(</xsl:text> 451 </xsl:if> 452 <xsl:apply-templates select="@type"/> 453 <xsl:if test="@safearray='yes'"> 454 <xsl:text>)</xsl:text> 455 </xsl:if> 456 <xsl:if test="@array"> 457 <xsl:text> *</xsl:text> 458 </xsl:if> 459 <xsl:if test="@dir='out' or @dir='return' or @safearray='yes'"> 460 <xsl:text> *</xsl:text> 461 </xsl:if> 462 <xsl:text> a</xsl:text> 463 <xsl:call-template name="capitalize"> 464 <xsl:with-param name="str" select="@name"/> 465 </xsl:call-template> 466 </xsl:template> 467 468 469 <!-- 470 * attribute/parameter type conversion 471 --> 472 <xsl:template match=" 473 attribute/@type | param/@type | 474 enumerator/@type | collection/@type | collection/@enumerator 475 "> 476 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 477 478 <xsl:if test="../@array and ../@safearray='yes'"> 479 <xsl:message terminate="yes"> 480 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 481 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text> 482 </xsl:message> 483 </xsl:if> 484 485 <xsl:choose> 486 <!-- modifiers (ignored for 'enumeration' attributes)--> 487 <xsl:when test="name(current())='type' and ../@mod"> 488 <xsl:choose> 489 <xsl:when test="../@mod='ptr'"> 490 <xsl:choose> 491 <!-- standard types --> 492 <!--xsl:when test=".='result'">??</xsl:when--> 493 <xsl:when test=".='boolean'">BOOL *</xsl:when> 494 <xsl:when test=".='octet'">BYTE *</xsl:when> 495 <xsl:when test=".='short'">SHORT *</xsl:when> 496 <xsl:when test=".='unsigned short'">USHORT *</xsl:when> 497 <xsl:when test=".='long'">LONG *</xsl:when> 498 <xsl:when test=".='long long'">LONG64 *</xsl:when> 499 <xsl:when test=".='unsigned long'">ULONG *</xsl:when> 500 <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when> 501 <xsl:when test=".='char'">CHAR *</xsl:when> 502 <!--xsl:when test=".='string'">??</xsl:when--> 503 <xsl:when test=".='wchar'">OLECHAR *</xsl:when> 504 <!--xsl:when test=".='wstring'">??</xsl:when--> 505 <xsl:otherwise> 506 <xsl:message terminate="yes"> 507 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 508 <xsl:text>attribute 'mod=</xsl:text> 509 <xsl:value-of select="concat('"',../@mod,'"')"/> 510 <xsl:text>' cannot be used with type </xsl:text> 511 <xsl:value-of select="concat('"',current(),'"!')"/> 512 </xsl:message> 513 </xsl:otherwise> 514 </xsl:choose> 515 </xsl:when> 516 <xsl:otherwise> 517 <xsl:message terminate="yes"> 518 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 519 <xsl:value-of select="concat('value "',../@mod,'" ')"/> 520 <xsl:text>of attribute 'mod' is invalid!</xsl:text> 521 </xsl:message> 522 </xsl:otherwise> 523 </xsl:choose> 524 </xsl:when> 525 <!-- no modifiers --> 526 <xsl:otherwise> 527 <xsl:choose> 528 <!-- standard types --> 529 <xsl:when test=".='result'">HRESULT</xsl:when> 530 <xsl:when test=".='boolean'">BOOL</xsl:when> 531 <xsl:when test=".='octet'">BYTE</xsl:when> 532 <xsl:when test=".='short'">SHORT</xsl:when> 533 <xsl:when test=".='unsigned short'">USHORT</xsl:when> 534 <xsl:when test=".='long'">LONG</xsl:when> 535 <xsl:when test=".='long long'">LONG64</xsl:when> 536 <xsl:when test=".='unsigned long'">ULONG</xsl:when> 537 <xsl:when test=".='unsigned long long'">ULONG64</xsl:when> 538 <xsl:when test=".='char'">CHAR</xsl:when> 539 <xsl:when test=".='string'">CHAR *</xsl:when> 540 <xsl:when test=".='wchar'">OLECHAR</xsl:when> 541 <xsl:when test=".='wstring'">BSTR</xsl:when> 542 <!-- UUID type --> 543 <xsl:when test=".='uuid'">GUID</xsl:when> 544 <!-- system interface types --> 545 <xsl:when test=".='$unknown'">IUnknown *</xsl:when> 546 <xsl:otherwise> 547 <xsl:choose> 548 <!-- enum types --> 549 <xsl:when test=" 550 (ancestor::library/enum[@name=current()]) or 551 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 552 "> 553 <xsl:value-of select="."/> 554 </xsl:when> 555 <!-- custom interface types --> 556 <xsl:when test=" 557 (name(current())='enumerator' and 558 ((ancestor::library/enumerator[@name=current()]) or 559 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])) 560 ) or 561 ((ancestor::library/interface[@name=current()]) or 562 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 563 ) or 564 ((ancestor::library/collection[@name=current()]) or 565 (ancestor::library/if[@target=$self_target]/collection[@name=current()]) 566 ) 567 "> 568 <xsl:value-of select="."/><xsl:text> *</xsl:text> 569 </xsl:when> 570 <!-- other types --> 571 <xsl:otherwise> 572 <xsl:message terminate="yes"> 573 <xsl:text>Unknown parameter type: </xsl:text> 574 <xsl:value-of select="."/> 575 </xsl:message> 576 </xsl:otherwise> 577 </xsl:choose> 578 </xsl:otherwise> 579 </xsl:choose> 577 </xsl:choose> 580 578 </xsl:otherwise> 581 </xsl:choose> 579 </xsl:choose> 580 </xsl:otherwise> 581 </xsl:choose> 582 582 </xsl:template> 583 583 -
trunk/src/VBox/Main/idl/xpidl.xsl
r6851 r7216 6 6 7 7 Copyright (C) 2006-2007 innotek GmbH 8 8 9 9 This file is part of VirtualBox Open Source Edition (OSE), as 10 10 available from http://www.virtualbox.org. This file is free software; … … 31 31 --> 32 32 <xsl:template name="capitalize"> 33 34 35 36 37 38 39 33 <xsl:param name="str" select="."/> 34 <xsl:value-of select=" 35 concat( 36 translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 37 substring($str,2) 38 ) 39 "/> 40 40 </xsl:template> 41 41 … … 45 45 --> 46 46 <xsl:template name="uncapitalize"> 47 48 49 50 51 52 53 54 55 56 57 58 59 60 47 <xsl:param name="str" select="."/> 48 <xsl:choose> 49 <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))"> 50 <xsl:value-of select=" 51 concat( 52 translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), 53 substring($str,2) 54 ) 55 "/> 56 </xsl:when> 57 <xsl:otherwise> 58 <xsl:value-of select="string($str)"/> 59 </xsl:otherwise> 60 </xsl:choose> 61 61 </xsl:template> 62 62 … … 65 65 --> 66 66 <xsl:template name="uppercase"> 67 68 69 70 67 <xsl:param name="str" select="."/> 68 <xsl:value-of select=" 69 translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ') 70 "/> 71 71 </xsl:template> 72 72 … … 82 82 --> 83 83 <xsl:template match="/idl"> 84 84 <xsl:text> 85 85 /* 86 86 * DO NOT EDIT! This is a generated file. … … 96 96 #include "nsIException.idl" 97 97 </xsl:text> 98 99 98 <!-- native typedefs for the 'mod="ptr"' attribute --> 99 <xsl:text> 100 100 [ptr] native booeanPtr (PRBool); 101 101 [ptr] native octetPtr (PRUint8); … … 113 113 114 114 </xsl:text> 115 <xsl:apply-templates/> 116 </xsl:template> 117 118 119 <!-- 120 * ignore all |if|s except those for XPIDL target 121 --> 122 <xsl:template match="if"> 123 <xsl:if test="@target='xpidl'"> 115 124 <xsl:apply-templates/> 116 </xsl:template> 117 118 119 <!-- 120 * ignore all |if|s except those for XPIDL target 121 --> 122 <xsl:template match="if"> 123 <xsl:if test="@target='xpidl'"> 124 <xsl:apply-templates/> 125 </xsl:if> 125 </xsl:if> 126 126 </xsl:template> 127 127 <xsl:template match="if" mode="forward"> 128 129 130 128 <xsl:if test="@target='xpidl'"> 129 <xsl:apply-templates mode="forward"/> 130 </xsl:if> 131 131 </xsl:template> 132 132 … … 136 136 --> 137 137 <xsl:template match="cpp"> 138 139 140 141 142 143 144 145 146 147 138 <xsl:if test="text()"> 139 <xsl:text>%{C++</xsl:text> 140 <xsl:value-of select="text()"/> 141 <xsl:text>
%}

</xsl:text> 142 </xsl:if> 143 <xsl:if test="not(text()) and @line"> 144 <xsl:text>%{C++
</xsl:text> 145 <xsl:value-of select="@line"/> 146 <xsl:text>
%}

</xsl:text> 147 </xsl:if> 148 148 </xsl:template> 149 149 … … 157 157 --> 158 158 <xsl:template match="@if" mode="begin"> 159 160 161 162 163 164 165 159 <xsl:message terminate="yes"> 160 @if attributes are not currently allowed because xpidl lacks 161 support of #ifdef and stuff. 162 </xsl:message> 163 <xsl:text>#if </xsl:text> 164 <xsl:value-of select="."/> 165 <xsl:text>
</xsl:text> 166 166 </xsl:template> 167 167 <xsl:template match="@if" mode="end"> 168 168 <xsl:text>#endif
</xsl:text> 169 169 </xsl:template> 170 170 … … 174 174 --> 175 175 <xsl:template match="library"> 176 177 178 179 180 181 182 176 <!-- forward declarations --> 177 <xsl:apply-templates select="if | interface | collection | enumerator" mode="forward"/> 178 <xsl:text>
</xsl:text> 179 <!-- all enums go first --> 180 <xsl:apply-templates select="enum | if/enum"/> 181 <!-- everything else but enums --> 182 <xsl:apply-templates select="*[not(self::enum) and not(self::if[enum])]"/> 183 183 </xsl:template> 184 184 … … 188 188 --> 189 189 <xsl:template match="interface | collection | enumerator" mode="forward"> 190 191 192 190 <xsl:text>interface </xsl:text> 191 <xsl:value-of select="@name"/> 192 <xsl:text>;
</xsl:text> 193 193 </xsl:template> 194 194 … … 202 202 ] 203 203 <xsl:text>interface </xsl:text> 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 204 <xsl:value-of select="@name"/> 205 <xsl:text> : </xsl:text> 206 <xsl:choose> 207 <xsl:when test="@extends='$unknown'">nsISupports</xsl:when> 208 <xsl:when test="@extends='$dispatched'">nsISupports</xsl:when> 209 <xsl:when test="@extends='$errorinfo'">nsIException</xsl:when> 210 <xsl:otherwise><xsl:value-of select="@extends"/></xsl:otherwise> 211 </xsl:choose> 212 <xsl:text>
{
</xsl:text> 213 <!-- attributes (properties) --> 214 <xsl:apply-templates select="attribute"/> 215 <!-- methods --> 216 <xsl:apply-templates select="method"/> 217 <!-- 'if' enclosed elements, unsorted --> 218 <xsl:apply-templates select="if"/> 219 <!-- --> 220 <xsl:text>}; /* interface </xsl:text> 221 <xsl:value-of select="@name"/> 222 <xsl:text> */

</xsl:text> 223 223 </xsl:template> 224 224 … … 227 227 --> 228 228 <xsl:template match="interface//attribute | collection//attribute"> 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 229 <xsl:if test="@array"> 230 <xsl:message terminate="yes"> 231 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 232 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text> 233 </xsl:message> 234 </xsl:if> 235 <xsl:apply-templates select="@if" mode="begin"/> 236 <xsl:if test="@mod='ptr'"> 237 <!-- attributes using native types must be non-scriptable --> 238 <xsl:text> [noscript]
</xsl:text> 239 </xsl:if> 240 <xsl:choose> 241 <!-- safearray pseudo attribute --> 242 <xsl:when test="@safearray='yes'"> 243 <!-- getter --> 244 <xsl:text> void get</xsl:text> 245 <xsl:call-template name="capitalize"> 246 <xsl:with-param name="str" select="@name"/> 247 </xsl:call-template> 248 <xsl:text> (
</xsl:text> 249 <!-- array size --> 250 <xsl:text> out unsigned long </xsl:text> 251 <xsl:value-of select="@name"/> 252 <xsl:text>Size,
</xsl:text> 253 <!-- array pointer --> 254 <xsl:text> [array, size_is(</xsl:text> 255 <xsl:value-of select="@name"/> 256 <xsl:text>Size), retval] out </xsl:text> 257 <xsl:apply-templates select="@type"/> 258 <xsl:text> </xsl:text> 259 <xsl:value-of select="@name"/> 260 <xsl:text>
 );
</xsl:text> 261 <!-- setter --> 262 <xsl:if test="not(@readonly='yes')"> 263 <xsl:text> void set</xsl:text> 264 <xsl:call-template name="capitalize"> 265 <xsl:with-param name="str" select="@name"/> 266 </xsl:call-template> 267 <xsl:text> (
</xsl:text> 268 <!-- array size --> 269 <xsl:text> in unsigned long </xsl:text> 270 <xsl:value-of select="@name"/> 271 <xsl:text>Size,
</xsl:text> 272 <!-- array pointer --> 273 <xsl:text> [array, size_is(</xsl:text> 274 <xsl:value-of select="@name"/> 275 <xsl:text>Size)] in </xsl:text> 276 <xsl:apply-templates select="@type"/> 277 <xsl:text> </xsl:text> 278 <xsl:value-of select="@name"/> 279 <xsl:text>
 );
</xsl:text> 280 </xsl:if> 281 </xsl:when> 282 <!-- normal attribute --> 283 <xsl:otherwise> 284 <xsl:text> </xsl:text> 285 <xsl:if test="@readonly='yes'"> 286 <xsl:text>readonly </xsl:text> 287 </xsl:if> 288 <xsl:text>attribute </xsl:text> 289 <xsl:apply-templates select="@type"/> 290 <xsl:text> </xsl:text> 291 <xsl:value-of select="@name"/> 292 <xsl:text>;
</xsl:text> 293 </xsl:otherwise> 294 </xsl:choose> 295 <xsl:apply-templates select="@if" mode="end"/> 296 <xsl:text>
</xsl:text> 297 297 </xsl:template> 298 298 … … 301 301 --> 302 302 <xsl:template match="interface//method | collection//method"> 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 303 <xsl:apply-templates select="@if" mode="begin"/> 304 <xsl:if test="param/@mod='ptr'"> 305 <!-- methods using native types must be non-scriptable --> 306 <xsl:text> [noscript]
</xsl:text> 307 </xsl:if> 308 <xsl:text> void </xsl:text> 309 <xsl:value-of select="@name"/> 310 <xsl:if test="param"> 311 <xsl:text> (
</xsl:text> 312 <xsl:for-each select="param [position() != last()]"> 313 <xsl:text> </xsl:text> 314 <xsl:apply-templates select="."/> 315 <xsl:text>,
</xsl:text> 316 </xsl:for-each> 317 <xsl:text> </xsl:text> 318 <xsl:apply-templates select="param [last()]"/> 319 <xsl:text>
 );
</xsl:text> 320 </xsl:if> 321 <xsl:if test="not(param)"> 322 <xsl:text>();
</xsl:text> 323 </xsl:if> 324 <xsl:apply-templates select="@if" mode="end"/> 325 <xsl:text>
</xsl:text> 326 326 </xsl:template> 327 327 … … 331 331 --> 332 332 <xsl:template match="module/class"> 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 333 <!-- class and contract id --> 334 <xsl:text>%{C++
</xsl:text> 335 <xsl:text>#define NS_</xsl:text> 336 <xsl:call-template name="uppercase"> 337 <xsl:with-param name="str" select="@name"/> 338 </xsl:call-template> 339 <xsl:text>_CID { \
</xsl:text> 340 <xsl:text> 0x</xsl:text><xsl:value-of select="substring(@uuid,1,8)"/> 341 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,10,4)"/> 342 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,15,4)"/> 343 <xsl:text>, \
 </xsl:text> 344 <xsl:text>{ 0x</xsl:text><xsl:value-of select="substring(@uuid,20,2)"/> 345 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,22,2)"/> 346 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,25,2)"/> 347 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,27,2)"/> 348 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,29,2)"/> 349 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,31,2)"/> 350 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,33,2)"/> 351 <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/> 352 <xsl:text> } \
}
</xsl:text> 353 <xsl:text>#define NS_</xsl:text> 354 <xsl:call-template name="uppercase"> 355 <xsl:with-param name="str" select="@name"/> 356 </xsl:call-template> 357 <!-- Contract ID --> 358 <xsl:text>_CONTRACTID "@</xsl:text> 359 <xsl:value-of select="@namespace"/> 360 <xsl:text>/</xsl:text> 361 <xsl:value-of select="@name"/> 362 <xsl:text>;1"
</xsl:text> 363 <!-- CLSID_xxx declarations for XPCOM, for compatibility with Win32 --> 364 <xsl:text>// for compatibility with Win32
</xsl:text> 365 <xsl:text>#define CLSID_</xsl:text> 366 <xsl:value-of select="@name"/> 367 <xsl:text> (nsCID) NS_</xsl:text> 368 <xsl:call-template name="uppercase"> 369 <xsl:with-param name="str" select="@name"/> 370 </xsl:call-template> 371 <xsl:text>_CID
</xsl:text> 372 <xsl:text>%}

</xsl:text> 373 373 </xsl:template> 374 374 … … 382 382 ] 383 383 <xsl:text>interface </xsl:text> 384 385 386 387 388 389 390 391 392 393 394 395 384 <xsl:value-of select="@name"/> 385 <xsl:text> : nsISupports
{
</xsl:text> 386 <!-- HasMore --> 387 <xsl:text> void hasMore ([retval] out boolean more);

</xsl:text> 388 <!-- GetNext --> 389 <xsl:text> void getNext ([retval] out </xsl:text> 390 <xsl:apply-templates select="@type"/> 391 <xsl:text> next);

</xsl:text> 392 <!-- --> 393 <xsl:text>}; /* interface </xsl:text> 394 <xsl:value-of select="@name"/> 395 <xsl:text> */

</xsl:text> 396 396 </xsl:template> 397 397 … … 401 401 --> 402 402 <xsl:template match="collection"> 403 404 405 406 407 408 403 <xsl:if test="not(@readonly='yes')"> 404 <xsl:message terminate="yes"> 405 <xsl:value-of select="concat(@name,': ')"/> 406 <xsl:text>non-readonly collections are not currently supported</xsl:text> 407 </xsl:message> 408 </xsl:if>[ 409 409 uuid(<xsl:value-of select="@uuid"/>), 410 410 scriptable 411 411 ] 412 412 <xsl:text>interface </xsl:text> 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 413 <xsl:value-of select="@name"/> 414 <xsl:text> : nsISupports
{
</xsl:text> 415 <!-- Count --> 416 <xsl:text> readonly attribute unsigned long count;

</xsl:text> 417 <!-- GetItemAt --> 418 <xsl:text> void getItemAt (in unsigned long index, [retval] out </xsl:text> 419 <xsl:apply-templates select="@type"/> 420 <xsl:text> item);

</xsl:text> 421 <!-- Enumerate --> 422 <xsl:text> void enumerate ([retval] out </xsl:text> 423 <xsl:apply-templates select="@enumerator"/> 424 <xsl:text> enumerator);

</xsl:text> 425 <!-- other extra attributes (properties) --> 426 <xsl:apply-templates select="attribute"/> 427 <!-- other extra methods --> 428 <xsl:apply-templates select="method"/> 429 <!-- 'if' enclosed elements, unsorted --> 430 <xsl:apply-templates select="if"/> 431 <!-- --> 432 <xsl:text>}; /* interface </xsl:text> 433 <xsl:value-of select="@name"/> 434 <xsl:text> */

</xsl:text> 435 435 </xsl:template> 436 436 … … 444 444 ] 445 445 <xsl:text>interface </xsl:text> 446 447 448 446 <xsl:value-of select="@name"/> 447 <xsl:text>
{
</xsl:text> 448 <xsl:for-each select="const"> 449 449 <xsl:text> const PRUint32 </xsl:text> 450 450 <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/> 451 451 <xsl:text>;
</xsl:text> 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 452 </xsl:for-each> 453 <xsl:text>};

</xsl:text> 454 <!-- --> 455 <xsl:value-of select="concat('/* cross-platform type name for ', @name, ' */
')"/> 456 <xsl:text>%{C++
</xsl:text> 457 <xsl:value-of select="concat('#define ', @name, '_T', ' ', 458 'PRUint32
')"/> 459 <xsl:text>%}

</xsl:text> 460 <!-- --> 461 <xsl:value-of select="concat('/* cross-platform constants for ', @name, ' */
')"/> 462 <xsl:text>%{C++
</xsl:text> 463 <xsl:for-each select="const"> 464 <xsl:value-of select="concat('#define ', ../@name, '_', @name, ' ', 465 ../@name, '::', @name, '
')"/> 466 </xsl:for-each> 467 <xsl:text>%}

</xsl:text> 468 468 </xsl:template> 469 469 … … 473 473 --> 474 474 <xsl:template match="method/param"> 475 <xsl:choose> 476 <!-- safearray parameters --> 477 <xsl:when test="@safearray='yes'"> 478 <!-- array size --> 479 <xsl:choose> 480 <xsl:when test="@dir='in'">in </xsl:when> 481 <xsl:when test="@dir='out'">out </xsl:when> 482 <xsl:when test="@dir='return'">out </xsl:when> 483 <xsl:otherwise>in </xsl:otherwise> 484 </xsl:choose> 485 <xsl:text>unsigned long </xsl:text> 486 <xsl:value-of select="@name"/> 487 <xsl:text>Size,
</xsl:text> 488 <!-- array pointer --> 489 <xsl:text> [array, size_is(</xsl:text> 490 <xsl:value-of select="@name"/> 491 <xsl:text>Size)</xsl:text> 492 <xsl:choose> 493 <xsl:when test="@dir='in'">] in </xsl:when> 494 <xsl:when test="@dir='out'">] out </xsl:when> 495 <xsl:when test="@dir='return'"> , retval] out </xsl:when> 496 <xsl:otherwise>] in </xsl:otherwise> 497 </xsl:choose> 498 <xsl:apply-templates select="@type"/> 499 <xsl:text> </xsl:text> 500 <xsl:value-of select="@name"/> 475 <xsl:choose> 476 <!-- safearray parameters --> 477 <xsl:when test="@safearray='yes'"> 478 <!-- array size --> 479 <xsl:choose> 480 <xsl:when test="@dir='in'">in </xsl:when> 481 <xsl:when test="@dir='out'">out </xsl:when> 482 <xsl:when test="@dir='return'">out </xsl:when> 483 <xsl:otherwise>in </xsl:otherwise> 484 </xsl:choose> 485 <xsl:text>unsigned long </xsl:text> 486 <xsl:value-of select="@name"/> 487 <xsl:text>Size,
</xsl:text> 488 <!-- array pointer --> 489 <xsl:text> [array, size_is(</xsl:text> 490 <xsl:value-of select="@name"/> 491 <xsl:text>Size)</xsl:text> 492 <xsl:choose> 493 <xsl:when test="@dir='in'">] in </xsl:when> 494 <xsl:when test="@dir='out'">] out </xsl:when> 495 <xsl:when test="@dir='return'"> , retval] out </xsl:when> 496 <xsl:otherwise>] in </xsl:otherwise> 497 </xsl:choose> 498 <xsl:apply-templates select="@type"/> 499 <xsl:text> </xsl:text> 500 <xsl:value-of select="@name"/> 501 </xsl:when> 502 <!-- normal and array parameters --> 503 <xsl:otherwise> 504 <xsl:if test="@array"> 505 <xsl:if test="@dir='return'"> 506 <xsl:message terminate="yes"> 507 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 508 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text> 509 </xsl:message> 510 </xsl:if> 511 <xsl:text>[array, </xsl:text> 512 <xsl:choose> 513 <xsl:when test="../param[@name=current()/@array]"> 514 <xsl:if test="../param[@name=current()/@array]/@dir != @dir"> 515 <xsl:message terminate="yes"> 516 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/> 517 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/> 518 <xsl:text> must have the same direction</xsl:text> 519 </xsl:message> 520 </xsl:if> 521 <xsl:text>size_is(</xsl:text> 522 <xsl:value-of select="@array"/> 523 <xsl:text>)</xsl:text> 524 </xsl:when> 525 <xsl:otherwise> 526 <xsl:message terminate="yes"> 527 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 528 <xsl:text>array attribute refers to non-existent param: </xsl:text> 529 <xsl:value-of select="@array"/> 530 </xsl:message> 531 </xsl:otherwise> 532 </xsl:choose> 533 <xsl:text>] </xsl:text> 534 </xsl:if> 535 <xsl:choose> 536 <xsl:when test="@dir='in'">in </xsl:when> 537 <xsl:when test="@dir='out'">out </xsl:when> 538 <xsl:when test="@dir='return'">[retval] out </xsl:when> 539 <xsl:otherwise>in </xsl:otherwise> 540 </xsl:choose> 541 <xsl:apply-templates select="@type"/> 542 <xsl:text> </xsl:text> 543 <xsl:value-of select="@name"/> 544 </xsl:otherwise> 545 </xsl:choose> 546 </xsl:template> 547 548 549 <!-- 550 * attribute/parameter type conversion 551 --> 552 <xsl:template match=" 553 attribute/@type | param/@type | 554 enumerator/@type | collection/@type | collection/@enumerator 555 "> 556 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 557 558 <xsl:if test="../@array and ../@safearray='yes'"> 559 <xsl:message terminate="yes"> 560 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 561 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text> 562 </xsl:message> 563 </xsl:if> 564 565 <xsl:choose> 566 <!-- modifiers (ignored for 'enumeration' attributes)--> 567 <xsl:when test="name(current())='type' and ../@mod"> 568 <xsl:choose> 569 <xsl:when test="../@mod='ptr'"> 570 <xsl:choose> 571 <!-- standard types --> 572 <!--xsl:when test=".='result'">??</xsl:when--> 573 <xsl:when test=".='boolean'">booeanPtr</xsl:when> 574 <xsl:when test=".='octet'">octetPtr</xsl:when> 575 <xsl:when test=".='short'">shortPtr</xsl:when> 576 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when> 577 <xsl:when test=".='long'">longPtr</xsl:when> 578 <xsl:when test=".='long long'">llongPtr</xsl:when> 579 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when> 580 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when> 581 <xsl:when test=".='char'">charPtr</xsl:when> 582 <!--xsl:when test=".='string'">??</xsl:when--> 583 <xsl:when test=".='wchar'">wcharPtr</xsl:when> 584 <!--xsl:when test=".='wstring'">??</xsl:when--> 585 <xsl:otherwise> 586 <xsl:message terminate="yes"> 587 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 588 <xsl:text>attribute 'mod=</xsl:text> 589 <xsl:value-of select="concat('"',../@mod,'"')"/> 590 <xsl:text>' cannot be used with type </xsl:text> 591 <xsl:value-of select="concat('"',current(),'"!')"/> 592 </xsl:message> 593 </xsl:otherwise> 594 </xsl:choose> 501 595 </xsl:when> 502 <!-- normal and array parameters -->503 596 <xsl:otherwise> 504 <xsl:if test="@array"> 505 <xsl:if test="@dir='return'"> 506 <xsl:message terminate="yes"> 507 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 508 <xsl:text>return 'array' parameters are not supported, use 'safearray="yes"' instead.</xsl:text> 509 </xsl:message> 510 </xsl:if> 511 <xsl:text>[array, </xsl:text> 512 <xsl:choose> 513 <xsl:when test="../param[@name=current()/@array]"> 514 <xsl:if test="../param[@name=current()/@array]/@dir != @dir"> 515 <xsl:message terminate="yes"> 516 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/> 517 <xsl:value-of select="concat(@name,' and ',../param[@name=current()/@array]/@name)"/> 518 <xsl:text> must have the same direction</xsl:text> 519 </xsl:message> 520 </xsl:if> 521 <xsl:text>size_is(</xsl:text> 522 <xsl:value-of select="@array"/> 523 <xsl:text>)</xsl:text> 524 </xsl:when> 525 <xsl:otherwise> 526 <xsl:message terminate="yes"> 527 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 528 <xsl:text>array attribute refers to non-existent param: </xsl:text> 529 <xsl:value-of select="@array"/> 530 </xsl:message> 531 </xsl:otherwise> 532 </xsl:choose> 533 <xsl:text>] </xsl:text> 534 </xsl:if> 535 <xsl:choose> 536 <xsl:when test="@dir='in'">in </xsl:when> 537 <xsl:when test="@dir='out'">out </xsl:when> 538 <xsl:when test="@dir='return'">[retval] out </xsl:when> 539 <xsl:otherwise>in </xsl:otherwise> 540 </xsl:choose> 541 <xsl:apply-templates select="@type"/> 542 <xsl:text> </xsl:text> 543 <xsl:value-of select="@name"/> 597 <xsl:message terminate="yes"> 598 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 599 <xsl:value-of select="concat('value "',../@mod,'" ')"/> 600 <xsl:text>of attribute 'mod' is invalid!</xsl:text> 601 </xsl:message> 544 602 </xsl:otherwise> 545 </xsl:choose> 546 </xsl:template> 547 548 549 <!-- 550 * attribute/parameter type conversion 551 --> 552 <xsl:template match=" 553 attribute/@type | param/@type | 554 enumerator/@type | collection/@type | collection/@enumerator 555 "> 556 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 557 558 <xsl:if test="../@array and ../@safearray='yes'"> 559 <xsl:message terminate="yes"> 560 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 561 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text> 562 </xsl:message> 563 </xsl:if> 564 565 <xsl:choose> 566 <!-- modifiers (ignored for 'enumeration' attributes)--> 567 <xsl:when test="name(current())='type' and ../@mod"> 568 <xsl:choose> 569 <xsl:when test="../@mod='ptr'"> 570 <xsl:choose> 571 <!-- standard types --> 572 <!--xsl:when test=".='result'">??</xsl:when--> 573 <xsl:when test=".='boolean'">booeanPtr</xsl:when> 574 <xsl:when test=".='octet'">octetPtr</xsl:when> 575 <xsl:when test=".='short'">shortPtr</xsl:when> 576 <xsl:when test=".='unsigned short'">ushortPtr</xsl:when> 577 <xsl:when test=".='long'">longPtr</xsl:when> 578 <xsl:when test=".='long long'">llongPtr</xsl:when> 579 <xsl:when test=".='unsigned long'">ulongPtr</xsl:when> 580 <xsl:when test=".='unsigned long long'">ullongPtr</xsl:when> 581 <xsl:when test=".='char'">charPtr</xsl:when> 582 <!--xsl:when test=".='string'">??</xsl:when--> 583 <xsl:when test=".='wchar'">wcharPtr</xsl:when> 584 <!--xsl:when test=".='wstring'">??</xsl:when--> 585 <xsl:otherwise> 586 <xsl:message terminate="yes"> 587 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 588 <xsl:text>attribute 'mod=</xsl:text> 589 <xsl:value-of select="concat('"',../@mod,'"')"/> 590 <xsl:text>' cannot be used with type </xsl:text> 591 <xsl:value-of select="concat('"',current(),'"!')"/> 592 </xsl:message> 593 </xsl:otherwise> 594 </xsl:choose> 603 </xsl:choose> 604 </xsl:when> 605 <!-- no modifiers --> 606 <xsl:otherwise> 607 <xsl:choose> 608 <!-- standard types --> 609 <xsl:when test=".='result'">nsresult</xsl:when> 610 <xsl:when test=".='boolean'">boolean</xsl:when> 611 <xsl:when test=".='octet'">octet</xsl:when> 612 <xsl:when test=".='short'">short</xsl:when> 613 <xsl:when test=".='unsigned short'">unsigned short</xsl:when> 614 <xsl:when test=".='long'">long</xsl:when> 615 <xsl:when test=".='long long'">long long</xsl:when> 616 <xsl:when test=".='unsigned long'">unsigned long</xsl:when> 617 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when> 618 <xsl:when test=".='char'">char</xsl:when> 619 <xsl:when test=".='wchar'">wchar</xsl:when> 620 <xsl:when test=".='string'">string</xsl:when> 621 <xsl:when test=".='wstring'">wstring</xsl:when> 622 <!-- UUID type --> 623 <xsl:when test=".='uuid'"> 624 <xsl:choose> 625 <xsl:when test="name(..)='attribute'"> 626 <xsl:choose> 627 <xsl:when test="../@readonly='yes'"> 628 <xsl:text>nsIDPtr</xsl:text> 595 629 </xsl:when> 596 630 <xsl:otherwise> 597 <xsl:message terminate="yes"> 598 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 599 <xsl:value-of select="concat('value "',../@mod,'" ')"/> 600 <xsl:text>of attribute 'mod' is invalid!</xsl:text> 601 </xsl:message> 631 <xsl:message terminate="yes"> 632 <xsl:value-of select="../@name"/> 633 <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text> 634 </xsl:message> 602 635 </xsl:otherwise> 603 </xsl:choose> 636 </xsl:choose> 637 </xsl:when> 638 <xsl:when test="name(..)='param'"> 639 <xsl:choose> 640 <xsl:when test="../@dir='in'"> 641 <xsl:text>nsIDRef</xsl:text> 642 </xsl:when> 643 <xsl:otherwise> 644 <xsl:text>nsIDPtr</xsl:text> 645 </xsl:otherwise> 646 </xsl:choose> 647 </xsl:when> 648 </xsl:choose> 604 649 </xsl:when> 605 <!-- no modifiers --> 650 <!-- system interface types --> 651 <xsl:when test=".='$unknown'">nsISupports</xsl:when> 606 652 <xsl:otherwise> 607 <xsl:choose> 608 <!-- standard types --> 609 <xsl:when test=".='result'">nsresult</xsl:when> 610 <xsl:when test=".='boolean'">boolean</xsl:when> 611 <xsl:when test=".='octet'">octet</xsl:when> 612 <xsl:when test=".='short'">short</xsl:when> 613 <xsl:when test=".='unsigned short'">unsigned short</xsl:when> 614 <xsl:when test=".='long'">long</xsl:when> 615 <xsl:when test=".='long long'">long long</xsl:when> 616 <xsl:when test=".='unsigned long'">unsigned long</xsl:when> 617 <xsl:when test=".='unsigned long long'">unsigned long long</xsl:when> 618 <xsl:when test=".='char'">char</xsl:when> 619 <xsl:when test=".='wchar'">wchar</xsl:when> 620 <xsl:when test=".='string'">string</xsl:when> 621 <xsl:when test=".='wstring'">wstring</xsl:when> 622 <!-- UUID type --> 623 <xsl:when test=".='uuid'"> 624 <xsl:choose> 625 <xsl:when test="name(..)='attribute'"> 626 <xsl:choose> 627 <xsl:when test="../@readonly='yes'"> 628 <xsl:text>nsIDPtr</xsl:text> 629 </xsl:when> 630 <xsl:otherwise> 631 <xsl:message terminate="yes"> 632 <xsl:value-of select="../@name"/> 633 <xsl:text>: Non-readonly uuid attributes are not supported!</xsl:text> 634 </xsl:message> 635 </xsl:otherwise> 636 </xsl:choose> 637 </xsl:when> 638 <xsl:when test="name(..)='param'"> 639 <xsl:choose> 640 <xsl:when test="../@dir='in'"> 641 <xsl:text>nsIDRef</xsl:text> 642 </xsl:when> 643 <xsl:otherwise> 644 <xsl:text>nsIDPtr</xsl:text> 645 </xsl:otherwise> 646 </xsl:choose> 647 </xsl:when> 648 </xsl:choose> 649 </xsl:when> 650 <!-- system interface types --> 651 <xsl:when test=".='$unknown'">nsISupports</xsl:when> 652 <xsl:otherwise> 653 <xsl:choose> 654 <!-- enum types --> 655 <xsl:when test=" 656 (ancestor::library/enum[@name=current()]) or 657 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 658 "> 659 <xsl:text>PRUint32</xsl:text> 660 </xsl:when> 661 <!-- custom interface types --> 662 <xsl:when test=" 663 (name(current())='enumerator' and 664 ((ancestor::library/enumerator[@name=current()]) or 665 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])) 666 ) or 667 ((ancestor::library/interface[@name=current()]) or 668 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 669 ) or 670 ((ancestor::library/collection[@name=current()]) or 671 (ancestor::library/if[@target=$self_target]/collection[@name=current()]) 672 ) 673 "> 674 <xsl:value-of select="."/> 675 </xsl:when> 676 <!-- other types --> 677 <xsl:otherwise> 678 <xsl:message terminate="yes"> 679 <xsl:text>Unknown parameter type: </xsl:text> 680 <xsl:value-of select="."/> 681 </xsl:message> 682 </xsl:otherwise> 683 </xsl:choose> 684 </xsl:otherwise> 685 </xsl:choose> 653 <xsl:choose> 654 <!-- enum types --> 655 <xsl:when test=" 656 (ancestor::library/enum[@name=current()]) or 657 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 658 "> 659 <xsl:text>PRUint32</xsl:text> 660 </xsl:when> 661 <!-- custom interface types --> 662 <xsl:when test=" 663 (name(current())='enumerator' and 664 ((ancestor::library/enumerator[@name=current()]) or 665 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])) 666 ) or 667 ((ancestor::library/interface[@name=current()]) or 668 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 669 ) or 670 ((ancestor::library/collection[@name=current()]) or 671 (ancestor::library/if[@target=$self_target]/collection[@name=current()]) 672 ) 673 "> 674 <xsl:value-of select="."/> 675 </xsl:when> 676 <!-- other types --> 677 <xsl:otherwise> 678 <xsl:message terminate="yes"> 679 <xsl:text>Unknown parameter type: </xsl:text> 680 <xsl:value-of select="."/> 681 </xsl:message> 682 </xsl:otherwise> 683 </xsl:choose> 686 684 </xsl:otherwise> 687 </xsl:choose> 685 </xsl:choose> 686 </xsl:otherwise> 687 </xsl:choose> 688 688 </xsl:template> 689 689
Note:
See TracChangeset
for help on using the changeset viewer.