Changeset 7216 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 29, 2008 11:36:31 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28535
- Location:
- trunk/src/VBox/Main/idl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.