Changeset 85286 in vbox for trunk/src/VBox/Main/idl/comimpl.xsl
- Timestamp:
- Jul 12, 2020 11:08:50 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139263
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/comimpl.xsl
r82972 r85286 127 127 <xsl:choose> 128 128 <xsl:when test="$mod='ptr'"> 129 <xsl:value-of select="'BYTE *'" />129 <xsl:value-of select="'BYTE *'" /> 130 130 </xsl:when> 131 131 <xsl:when test="(($type='wstring') or ($type='uuid'))"> … … 148 148 <xsl:choose> 149 149 <xsl:when test="$param"> 150 <xsl:value-of select="concat($type,' *')"/>150 <xsl:value-of select="concat($type,' *')"/> 151 151 </xsl:when> 152 152 <xsl:otherwise> … … 186 186 </xsl:choose> 187 187 <xsl:if test="$dir='out'"> 188 <xsl:value-of select="' *'"/>188 <xsl:value-of select="' *'"/> 189 189 </xsl:if> 190 190 <xsl:if test="$param and not($param='_')"> … … 258 258 <xsl:param name="name" /> 259 259 <xsl:param name="obj" /> 260 <xsl:param name="va" select="true" /> 260 261 <xsl:variable name="extends"> 261 262 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" /> … … 271 272 <xsl:with-param name="name" select="$extends" /> 272 273 <xsl:with-param name="obj" select="$obj" /> 274 <xsl:with-param name="va" select="$va" /> 273 275 </xsl:call-template> 274 276 </xsl:when> … … 310 312 </xsl:call-template> 311 313 </xsl:variable> 312 <xsl:value-of select=" '#ifdef RT_OS_WINDOWS '"/> 313 <xsl:value-of select="concat(' SAFEARRAY *aPtr_', @name, ' = va_arg(args, SAFEARRAY *); ')"/> 314 <xsl:value-of select="concat(' com::SafeArray<', $elemtype,'> aArr_', @name, '(aPtr_', @name, '); ')"/> 315 <xsl:value-of select=" '#else '"/> 316 <xsl:value-of select="concat(' PRUint32 aArrSize_', @name, ' = va_arg(args, PRUint32); ')"/> 317 <xsl:value-of select="concat(' void* aPtr_', @name, ' = va_arg(args, void*); ')"/> 318 <xsl:value-of select="concat(' com::SafeArray<', $elemtype,'> aArr_', @name, '(aArrSize_', @name, ', (', $elemtype,'*)aPtr_', @name, '); ')"/> 319 <xsl:value-of select=" '#endif '"/> 320 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(ComSafeArrayAsInParam(aArr_', @name, ')); ')"/> 314 <xsl:if test="$va"> 315 <xsl:value-of select=" '#ifdef RT_OS_WINDOWS '"/> 316 <xsl:value-of select="concat(' SAFEARRAY *aPtr_', @name, ' = va_arg(args, SAFEARRAY *); ')"/> 317 <xsl:value-of select="concat(' com::SafeArray<', $elemtype,'> aArr_', @name, '(aPtr_', @name, '); ')"/> 318 <xsl:value-of select=" '#else '"/> 319 <xsl:value-of select="concat(' PRUint32 aArrSize_', @name, ' = va_arg(args, PRUint32); ')"/> 320 <xsl:value-of select="concat(' void* aPtr_', @name, ' = va_arg(args, void*); ')"/> 321 <xsl:value-of select="concat(' com::SafeArray<', $elemtype,'> aArr_', @name, '(aArrSize_', @name, ', (', $elemtype,'*)aPtr_', @name, '); ')"/> 322 <xsl:value-of select=" '#endif '"/> 323 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(ComSafeArrayAsInParam(aArr_', @name, ')); ')"/> 324 </xsl:if> 325 <xsl:if test="not($va)"> 326 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(ComSafeArrayInArg(a_', @name, ')); ')"/> 327 </xsl:if> 321 328 </xsl:when> 322 329 <xsl:when test="substring($aType, string-length($aType) - 1) = '_T'"> <!-- To avoid pedantic gcc warnings/errors. --> 323 <xsl:value-of select=" '#ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK '"/> 324 <xsl:value-of select="concat(' ',$aTypeName, ' = (',$aType,')va_arg(args, int); ')"/> 325 <xsl:value-of select=" '#else '"/> 326 <xsl:value-of select="concat(' ',$aTypeName, ' = va_arg(args, ',$aType,'); ')"/> 327 <xsl:value-of select=" '#endif '"/> 328 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(',$aName, '); ')"/> 330 <xsl:if test="$va"> 331 <xsl:value-of select=" '#ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK '"/> 332 <xsl:value-of select="concat(' ',$aTypeName, ' = (',$aType,')va_arg(args, int); ')"/> 333 <xsl:value-of select=" '#else '"/> 334 <xsl:value-of select="concat(' ',$aTypeName, ' = va_arg(args, ',$aType,'); ')"/> 335 <xsl:value-of select=" '#endif '"/> 336 </xsl:if> 337 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(',$aName, '); ')"/> 329 338 </xsl:when> 330 339 <xsl:otherwise> 331 <xsl:value-of select="concat(' ',$aTypeName, ' = va_arg(args, ',$aType,'); ')"/> 332 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(',$aName, '); ')"/> 340 <xsl:if test="$va"> 341 <xsl:value-of select="concat(' ',$aTypeName, ' = va_arg(args, ',$aType,'); ')"/> 342 </xsl:if> 343 <xsl:value-of select="concat(' ',$obj, '->set_', @name, '(',$aName, '); ')"/> 333 344 </xsl:otherwise> 334 345 </xsl:choose> … … 489 500 490 501 <xsl:value-of select="concat('class ATL_NO_VTABLE ',$implName, 491 ' : public VirtualBoxBase , VBOX_SCRIPTABLE_IMPL(',502 ' : public VirtualBoxBase , VBOX_SCRIPTABLE_IMPL(', 492 503 @name, ') { ')" /> 493 504 <xsl:value-of select="'public: '" /> … … 550 561 <xsl:when test="$isVeto='yes'"> 551 562 <xsl:text><![CDATA[ 552 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable = TRUE)563 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable = TRUE) 553 564 { 554 565 NOREF(aWaitable); … … 586 597 <xsl:text> 587 598 <![CDATA[ 588 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable = FALSE)599 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable = FALSE) 589 600 { 590 601 mGeneration = 1; … … 593 604 STDMETHOD(COMGETTER(Generation))(ULONG *aGeneration) 594 605 { 595 *aGeneration = mGeneration;596 return S_OK;606 *aGeneration = mGeneration; 607 return S_OK; 597 608 } 598 609 STDMETHOD(Reuse)() 599 610 { 600 ASMAtomicIncU32((volatile uint32_t*)&mGeneration);601 return S_OK;611 ASMAtomicIncU32((volatile uint32_t *)&mGeneration); 612 return S_OK; 602 613 } 603 614 private: … … 608 619 <xsl:otherwise> 609 620 <xsl:text><![CDATA[ 610 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable)621 HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable) 611 622 { 612 623 return mEvent->init(aSource, aType, aWaitable); … … 637 648 <xsl:with-param name="parents" select="''" /> 638 649 </xsl:call-template> 650 651 <!-- Split off the remainer into separate template? --> 652 <xsl:variable name="evname"> 653 <xsl:value-of select="substring(@name, 2)" /> 654 </xsl:variable> 655 <xsl:variable name="evid"> 656 <xsl:value-of select="concat('On', substring(@name, 2, string-length(@name)-6))" /> 657 </xsl:variable> 658 <xsl:variable name="ifname"> 659 <xsl:value-of select="@name" /> 660 </xsl:variable> 661 <xsl:variable name="waitable"> 662 <xsl:choose> 663 <xsl:when test="@waitable='yes'"> 664 <xsl:value-of select="'TRUE'"/> 665 </xsl:when> 666 <xsl:otherwise> 667 <xsl:value-of select="'FALSE'"/> 668 </xsl:otherwise> 669 </xsl:choose> 670 </xsl:variable> 671 672 <!-- Generate ReinitXxxxEvent functions if reusable. --> 673 <xsl:if test="$isReusable='yes'"> 674 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/> 675 <xsl:call-template name="genFormalParams"> 676 <xsl:with-param name="name" select="$ifname" /> 677 </xsl:call-template> 678 <xsl:text>) </xsl:text> 679 <xsl:text>{ </xsl:text> 680 <xsl:text> </xsl:text><xsl:value-of select="$implName"/><xsl:text> *pEvtImpl = dynamic_cast<</xsl:text> 681 <xsl:value-of select="$implName"/><xsl:text> *>(aEvent); </xsl:text> 682 <xsl:text> if (pEvtImpl) </xsl:text> 683 <xsl:text> { </xsl:text> 684 <xsl:text> pEvtImpl->Reuse(); </xsl:text> 685 <xsl:text> { </xsl:text> 686 <xsl:call-template name="genAttrInitCode"> 687 <xsl:with-param name="name" select="@name" /> 688 <xsl:with-param name="obj" select="'pEvtImpl'" /> 689 <xsl:with-param name="va" select="false" /> 690 </xsl:call-template> 691 <xsl:text> } </xsl:text> 692 <xsl:text> return S_OK; </xsl:text> 693 <xsl:text> } </xsl:text> 694 <xsl:text> return E_INVALIDARG; </xsl:text> 695 <xsl:text>} </xsl:text> 696 <xsl:text> </xsl:text> 697 </xsl:if> 698 699 <!-- Generate the CreateXxxxEvent function. --> 700 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/> 701 <xsl:call-template name="genFormalParams"> 702 <xsl:with-param name="name" select="$ifname" /> 703 </xsl:call-template> 704 <xsl:text>) </xsl:text> 705 <xsl:text>{ </xsl:text> 706 <xsl:text> ComObjPtr<</xsl:text><xsl:value-of select="$implName"/><xsl:text>> EvtObj; </xsl:text> 707 <xsl:text> HRESULT hrc = EvtObj.createObject(); </xsl:text> 708 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 709 <xsl:text> { </xsl:text> 710 <xsl:text> hrc = EvtObj->init(aSource, VBoxEventType_</xsl:text><xsl:value-of select="$evid"/> 711 <xsl:text>, </xsl:text><xsl:value-of select="$waitable" /><xsl:text> /*waitable*/); </xsl:text> 712 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 713 <xsl:text> { </xsl:text> 714 <xsl:call-template name="genAttrInitCode"> 715 <xsl:with-param name="name" select="@name" /> 716 <xsl:with-param name="obj" select="'EvtObj'" /> 717 <xsl:with-param name="va" select="false" /> 718 </xsl:call-template> 719 <xsl:text> hrc = EvtObj.queryInterfaceTo(aEvent); </xsl:text> 720 <xsl:text> } </xsl:text> 721 <xsl:text> } </xsl:text> 722 <xsl:text> return hrc; </xsl:text> 723 <xsl:text>} </xsl:text> 724 <xsl:text> </xsl:text> 725 726 <!-- Generate the fireXxxxEvent function. --> 727 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) fire', $evname, '(IEventSource *aSource')"/> 728 <xsl:call-template name="genFormalParams"> 729 <xsl:with-param name="name" select="$ifname" /> 730 </xsl:call-template> 731 <xsl:text>) </xsl:text> 732 <xsl:text>{ </xsl:text> 733 <xsl:text> ComPtr<IEvent> ptrEvent; </xsl:text> 734 <xsl:text> HRESULT hrc = </xsl:text> 735 <xsl:value-of select="concat('Create', $evname, '(ptrEvent.asOutParam(), aSource')"/> 736 <xsl:call-template name="genFactParams"> 737 <xsl:with-param name="name" select="$ifname" /> 738 </xsl:call-template> 739 <xsl:text>); </xsl:text> 740 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 741 <xsl:text> { </xsl:text> 742 <xsl:text> VBoxEventDesc EvtDesc(ptrEvent, aSource); </xsl:text> 743 <xsl:text> EvtDesc.fire(/* do not wait for delivery */ 0); </xsl:text> 744 <xsl:text> } </xsl:text> 745 <xsl:text> return hrc; </xsl:text> 746 <xsl:text>} </xsl:text> 747 <xsl:text> </xsl:text> 639 748 640 749 </xsl:template> … … 691 800 #include <iprt/asm.h> 692 801 #include "EventImpl.h" 802 #include "VBoxEvents.h" 693 803 ]]></xsl:text> 694 804 … … 723 833 724 834 <xsl:text><![CDATA[ 835 #if 0 725 836 HRESULT VBoxEventDesc::init(IEventSource *aSource, VBoxEventType_T aType, ...) 726 837 { … … 752 863 return S_OK; 753 864 } 865 #endif 754 866 ]]></xsl:text> 755 867 756 868 <xsl:text><![CDATA[ 869 #if 0 757 870 HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...) 758 871 { … … 783 896 return S_OK; 784 897 } 898 #endif 785 899 ]]></xsl:text> 786 900 … … 868 982 <xsl:text><![CDATA[ 869 983 #include "EventImpl.h" 984 870 985 ]]></xsl:text> 871 986 872 <!-- Interfaces --> 987 <!-- Simple methods for firing off events. --> 988 <xsl:text>/** @name Fire off events </xsl:text> 989 <xsl:text> * @{ */ </xsl:text> 873 990 <xsl:for-each select="//interface[@autogen='VBoxEvent']"> 874 <xsl:value-of select="concat('/ / ', @name, ' generation routine ')" />991 <xsl:value-of select="concat('/** Fire an ', @name, ' event. */ ')" /> 875 992 <xsl:variable name="evname"> 876 993 <xsl:value-of select="substring(@name, 2)" /> … … 884 1001 </xsl:variable> 885 1002 886 <xsl:value-of select="concat('DECLINLINE(void) fire', $evname, '(IEventSource* aSource')"/> 1003 <!-- 1004 OLD: 1005 <xsl:value-of select="concat('DECLINLINE(void) fire', $evname, '(IEventSource *aSource')"/> 887 1006 <xsl:call-template name="genFormalParams"> 888 1007 <xsl:with-param name="name" select="$ifname" /> … … 898 1017 <xsl:value-of select=" ' evDesc.fire(/* do not wait for delivery */ 0); '"/> 899 1018 <xsl:value-of select=" '} '"/> 1019 1020 NEW: 1021 --> 1022 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) fire', $evname, '(IEventSource *aSource')"/> 1023 <xsl:call-template name="genFormalParams"> 1024 <xsl:with-param name="name" select="$ifname" /> 1025 </xsl:call-template> 1026 <xsl:text>); </xsl:text> 900 1027 </xsl:for-each> 1028 <xsl:text>/** @} */ </xsl:text> 1029 1030 <!-- Event instantiation methods. --> 1031 <xsl:text>/** @name Instantiate events </xsl:text> 1032 <xsl:text> * @{ */ </xsl:text> 1033 <xsl:for-each select="//interface[@autogen='VBoxEvent']"> 1034 <xsl:value-of select="concat('/** Create an ', @name, ' event. */ ')" /> 1035 <xsl:variable name="evname"> 1036 <xsl:value-of select="substring(@name, 2)" /> 1037 </xsl:variable> 1038 <xsl:variable name="evid"> 1039 <xsl:value-of select="concat('On', substring(@name, 2, string-length(@name)-6))" /> 1040 </xsl:variable> 1041 <xsl:variable name="ifname"> 1042 <xsl:value-of select="@name" /> 1043 </xsl:variable> 1044 1045 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/> 1046 <xsl:call-template name="genFormalParams"> 1047 <xsl:with-param name="name" select="$ifname" /> 1048 </xsl:call-template> 1049 <xsl:text>); </xsl:text> 1050 </xsl:for-each> 1051 <xsl:text>/** @} */ </xsl:text> 1052 <xsl:text> </xsl:text> 1053 1054 <!-- Reinitialization methods for reusable events. --> 1055 <xsl:text>/** @name Re-init reusable events </xsl:text> 1056 <xsl:text> * @{ */ </xsl:text> 1057 <xsl:for-each select="//interface[@autogen='VBoxEvent']"> 1058 <xsl:if test="@extends='IReusableEvent'"> 1059 <xsl:value-of select="concat('/** Re-init an ', @name, ' event. */ ')" /> 1060 <xsl:variable name="evname"> 1061 <xsl:value-of select="substring(@name, 2)" /> 1062 </xsl:variable> 1063 <xsl:variable name="ifname"> 1064 <xsl:value-of select="@name" /> 1065 </xsl:variable> 1066 1067 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/> 1068 <xsl:call-template name="genFormalParams"> 1069 <xsl:with-param name="name" select="$ifname" /> 1070 </xsl:call-template> 1071 <xsl:text>); </xsl:text> 1072 </xsl:if> 1073 </xsl:for-each> 1074 <xsl:text>/** @} */ </xsl:text> 1075 901 1076 </xsl:template> 902 1077
Note:
See TracChangeset
for help on using the changeset viewer.