VirtualBox

Changeset 85293 in vbox for trunk


Ignore:
Timestamp:
Jul 13, 2020 8:55:08 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139271
Message:

Main/comimpl.xsl,EventImpl.h,Makefile.kmk: Some event cleanups. bugref:9790

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Makefile.kmk

    r85143 r85293  
    805805# Generate some event stuff for VBoxSVC and VBoxC.
    806806#
    807 $(VBOX_AUTOGEN_EVENT_H): $(VBOX_PATH_MAIN_SRC)/idl/comimpl.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
     807$(call KB_FN_AUTO_CMD_DEPS,$(VBOX_AUTOGEN_EVENT_H).ts)
     808$(VBOX_AUTOGEN_EVENT_H).ts +| $(VBOX_AUTOGEN_EVENT_H): $(VBOX_PATH_MAIN_SRC)/idl/comimpl.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
     809        $(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
    808810        $(call MSG_TOOL,xsltproc,autogen events,$<,$@)
    809         $(QUIET)$(VBOX_XSLTPROC) --stringparam G_kind VBoxEventHeader -o $@ $< $(VBOX_XIDL_FILE)
    810 
    811 $(VBOX_AUTOGEN_EVENT_CPP): $(VBOX_PATH_MAIN_SRC)/idl/comimpl.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
     811        $(QUIET)$(VBOX_XSLTPROC) --stringparam G_kind VBoxEventHeader -o "$@" "$(VBOX_PATH_MAIN_SRC)/idl/comimpl.xsl" "$(VBOX_XIDL_FILE)"
     812        $(QUIET)$(CP) --changed -fv -- "$@" "$(VBOX_AUTOGEN_EVENT_H)"
     813
     814$(call KB_FN_AUTO_CMD_DEPS,$(VBOX_AUTOGEN_EVENT_CPP).ts)
     815$(VBOX_AUTOGEN_EVENT_CPP).ts +| $(VBOX_AUTOGEN_EVENT_CPP): $(VBOX_PATH_MAIN_SRC)/idl/comimpl.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
     816        $(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
    812817        $(call MSG_TOOL,xsltproc,autogen events,$<,$@)
    813         $(QUIET)$(VBOX_XSLTPROC) --stringparam G_kind VBoxEvent -o $@ $< $(VBOX_XIDL_FILE)
    814 
    815 OTHER_CLEAN += $(VBOX_AUTOGEN_EVENT_H) $(VBOX_AUTOGEN_EVENT_CPP)
     818        $(QUIET)$(VBOX_XSLTPROC) --stringparam G_kind VBoxEvent -o "$@" "$(VBOX_PATH_MAIN_SRC)/idl/comimpl.xsl" "$(VBOX_XIDL_FILE)"
     819        $(QUIET)$(CP) --changed -fv -- "$@" "$(VBOX_AUTOGEN_EVENT_CPP)"
     820
     821OTHER_CLEAN += $(VBOX_AUTOGEN_EVENT_H).ts $(VBOX_AUTOGEN_EVENT_H) $(VBOX_AUTOGEN_EVENT_CPP).ts $(VBOX_AUTOGEN_EVENT_CPP)
    816822
    817823ifdef VBOX_WITH_XPCOM
  • trunk/src/VBox/Main/idl/comimpl.xsl

    r85290 r85293  
    5454 * DO NOT EDIT! This is a generated file.
    5555 * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
    56  * Generator: src/VBox/Main/idl/comimpl.xsl
     56 * Generator:      src/VBox/Main/idl/comimpl.xsl
    5757 */
    5858
     
    262262  <xsl:param name="name" />
    263263  <xsl:param name="obj" />
    264   <xsl:param name="va" select="true" />
    265264  <xsl:variable name="extends">
    266265    <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
     
    276275        <xsl:with-param name="name" select="$extends" />
    277276        <xsl:with-param name="obj" select="$obj" />
    278         <xsl:with-param name="va" select="$va" />
    279277      </xsl:call-template>
    280278    </xsl:when>
     
    316314          </xsl:call-template>
    317315        </xsl:variable>
    318         <xsl:if test="$va">
    319           <xsl:value-of select="       '#ifdef RT_OS_WINDOWS&#10;'"/>
    320           <xsl:value-of select="concat('            SAFEARRAY *aPtr_', @name, ' = va_arg(args, SAFEARRAY *);&#10;')"/>
    321           <xsl:value-of select="concat('            com::SafeArray&lt;', $elemtype,'&gt;   aArr_', @name, '(aPtr_', @name, ');&#10;')"/>
    322           <xsl:value-of select="       '#else&#10;'"/>
    323           <xsl:value-of select="concat('            PRUint32 aArrSize_', @name, ' = va_arg(args, PRUint32);&#10;')"/>
    324           <xsl:value-of select="concat('            void*    aPtr_', @name, ' = va_arg(args, void*);&#10;')"/>
    325           <xsl:value-of select="concat('            com::SafeArray&lt;', $elemtype,'&gt;   aArr_', @name, '(aArrSize_', @name, ', (', $elemtype,'*)aPtr_', @name, ');&#10;')"/>
    326           <xsl:value-of select="       '#endif&#10;'"/>
    327           <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(ComSafeArrayAsInParam(aArr_', @name, '));&#10;')"/>
    328         </xsl:if>
    329         <xsl:if test="not($va)">
    330           <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(ComSafeArrayInArg(a_', @name, '));&#10;')"/>
    331         </xsl:if>
     316        <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(ComSafeArrayInArg(a_', @name, '));&#10;')"/>
    332317      </xsl:when>
    333318      <xsl:when test="substring($aType, string-length($aType) - 1) = '_T'"> <!-- To avoid pedantic gcc warnings/errors. -->
    334         <xsl:if test="$va">
    335           <xsl:value-of select="       '#ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK&#10;'"/>
    336           <xsl:value-of select="concat('            ',$aTypeName, ' = (',$aType,')va_arg(args, int);&#10;')"/>
    337           <xsl:value-of select="       '#else&#10;'"/>
    338           <xsl:value-of select="concat('            ',$aTypeName, ' = va_arg(args, ',$aType,');&#10;')"/>
    339           <xsl:value-of select="       '#endif&#10;'"/>
    340         </xsl:if>
    341319        <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
    342320      </xsl:when>
    343321      <xsl:otherwise>
    344         <xsl:if test="$va">
    345           <xsl:value-of select="concat('            ',$aTypeName, ' = va_arg(args, ',$aType,');&#10;')"/>
    346         </xsl:if>
    347322        <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
    348323      </xsl:otherwise>
     
    689664      <xsl:with-param name="name" select="@name" />
    690665      <xsl:with-param name="obj" select="'pEvtImpl'" />
    691       <xsl:with-param name="va" select="false" />
    692666    </xsl:call-template>
    693667    <xsl:text>        }&#10;</xsl:text>
     
    717691    <xsl:with-param name="name" select="@name" />
    718692    <xsl:with-param name="obj" select="'EvtObj'" />
    719     <xsl:with-param name="va" select="false" />
    720693  </xsl:call-template>
    721694  <xsl:text>            hrc = EvtObj.queryInterfaceTo(aEvent);&#10;</xsl:text>
     
    752725
    753726
    754 <xsl:template name="genSwitchCase">
    755   <xsl:param name="ifaceName" />
    756   <xsl:param name="implName" />
    757   <xsl:param name="reinit" />
    758   <xsl:variable name="waitable">
    759     <xsl:choose>
    760       <xsl:when test="@waitable='yes'">
    761         <xsl:value-of select="'TRUE'"/>
    762       </xsl:when>
    763       <xsl:otherwise>
    764         <xsl:value-of select="'FALSE'"/>
    765       </xsl:otherwise>
    766     </xsl:choose>
    767   </xsl:variable>
    768   <xsl:value-of select="concat('         case VBoxEventType_', @id, ':&#10;')"/>
    769   <xsl:value-of select="       '         {&#10;'"/>
    770   <xsl:choose>
    771     <xsl:when test="$reinit='yes'">
    772       <xsl:value-of select="concat('              ComPtr&lt;', $ifaceName, '&gt; iobj;&#10;')"/>
    773       <xsl:value-of select="       '              iobj = mEvent;&#10;'"/>
    774       <xsl:value-of select="       '              Assert(!iobj.isNull());&#10;'"/>
    775       <xsl:value-of select="concat('              ',$implName, '* obj = (', $implName, '*)(', $ifaceName, '*)iobj;&#10;')"/>
    776       <xsl:value-of select="       '              obj->Reuse();&#10;'"/>
    777     </xsl:when>
    778     <xsl:otherwise>
    779       <xsl:value-of select="concat('              ComObjPtr&lt;', $implName, '&gt; obj;&#10;')"/>
    780       <xsl:value-of select="       '              obj.createObject();&#10;'"/>
    781       <xsl:value-of select="concat('              obj->init(aSource, aType, ', $waitable, ');&#10;')"/>
    782     </xsl:otherwise>
    783   </xsl:choose>
    784   <xsl:call-template name="genAttrInitCode">
    785     <xsl:with-param name="name" select="@name" />
    786     <xsl:with-param name="obj" select="'obj'" />
    787   </xsl:call-template>
    788   <xsl:if test="not($reinit='yes')">
    789     <xsl:value-of select="       '              obj.queryInterfaceTo(mEvent.asOutParam());&#10;'"/>
    790   </xsl:if>
    791   <xsl:value-of select="       '              break;&#10;'"/>
    792   <xsl:value-of select="       '         }&#10;'"/>
    793 </xsl:template>
    794 
     727<!--
     728 Produces VBoxEvents.cpp
     729 -->
    795730<xsl:template name="genCommonEventCode">
    796731  <xsl:call-template name="fileheader">
     
    834769  </xsl:for-each>
    835770
    836   <xsl:text><![CDATA[
    837 #if 0
    838 HRESULT VBoxEventDesc::init(IEventSource *aSource, VBoxEventType_T aType, ...)
    839 {
    840     va_list args;
    841 
    842     mEventSource = aSource;
    843     va_start(args, aType);
    844     switch (aType)
    845     {
    846 ]]></xsl:text>
    847 
    848   <xsl:for-each select="//interface[@autogen=$G_kind]">
    849     <xsl:variable name="implName">
    850       <xsl:value-of select="substring(@name, 2)" />
    851     </xsl:variable>
    852     <xsl:call-template name="genSwitchCase">
    853       <xsl:with-param name="ifaceName" select="@name" />
    854       <xsl:with-param name="implName" select="$implName" />
    855       <xsl:with-param name="reinit" select="'no'" />
    856     </xsl:call-template>
    857   </xsl:for-each>
    858 
    859   <xsl:text><![CDATA[
    860          default:
    861             AssertFailed();
    862     }
    863     va_end(args);
    864 
    865     return S_OK;
    866 }
    867 #endif
    868 ]]></xsl:text>
    869 
    870  <xsl:text><![CDATA[
    871 #if 0
    872 HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
    873 {
    874     va_list args;
    875 
    876     va_start(args, aType);
    877     switch (aType)
    878     {
    879 ]]></xsl:text>
    880 
    881   <xsl:for-each select="//interface[@autogen=$G_kind and @extends='IReusableEvent']">
    882     <xsl:variable name="implName">
    883       <xsl:value-of select="substring(@name, 2)" />
    884     </xsl:variable>
    885     <xsl:call-template name="genSwitchCase">
    886       <xsl:with-param name="ifaceName" select="@name" />
    887       <xsl:with-param name="implName" select="$implName" />
    888       <xsl:with-param name="reinit" select="'yes'" />
    889     </xsl:call-template>
    890   </xsl:for-each>
    891 
    892   <xsl:text><![CDATA[
    893          default:
    894             AssertFailed();
    895     }
    896     va_end(args);
    897 
    898     return S_OK;
    899 }
    900 #endif
    901 ]]></xsl:text>
    902 
    903771</xsl:template>
    904772
     
    977845</xsl:template>
    978846
     847
     848<!--
     849 Produces VBoxEvents.h
     850 -->
    979851<xsl:template name="genCommonEventHeader">
    980852  <xsl:call-template name="fileheader">
     
    982854  </xsl:call-template>
    983855
    984 <xsl:text><![CDATA[
     856  <xsl:text><![CDATA[
    985857#include "EventImpl.h"
    986858
     
    995867      <xsl:value-of select="substring(@name, 2)" />
    996868    </xsl:variable>
    997     <xsl:variable name="evid">
    998       <xsl:value-of select="concat('On', substring(@name, 2, string-length(@name)-6))" />
    999     </xsl:variable>
    1000 
    1001869    <xsl:variable name="ifname">
    1002870      <xsl:value-of select="@name" />
    1003871    </xsl:variable>
    1004872
    1005     <!--
    1006     OLD:
    1007     <xsl:value-of select="concat('DECLINLINE(void) fire', $evname, '(IEventSource *aSource')"/>
    1008     <xsl:call-template name="genFormalParams">
    1009       <xsl:with-param name="name" select="$ifname" />
    1010     </xsl:call-template>
    1011     <xsl:value-of select="       ')&#10;{&#10;'"/>
    1012 
    1013     <xsl:value-of select="       '    VBoxEventDesc evDesc;&#10;'"/>
    1014     <xsl:value-of select="concat('    evDesc.init(aSource, VBoxEventType_',$evid)"/>
    1015     <xsl:call-template name="genFactParams">
    1016       <xsl:with-param name="name" select="$ifname" />
    1017     </xsl:call-template>
    1018     <xsl:value-of select="');&#10;'"/>
    1019     <xsl:value-of select="       '    evDesc.fire(/* do not wait for delivery */ 0);&#10;'"/>
    1020     <xsl:value-of select="       '}&#10;'"/>
    1021 
    1022     NEW:
    1023     -->
    1024873    <xsl:value-of select="concat('DECLHIDDEN(HRESULT) fire', $evname, '(IEventSource *aSource')"/>
    1025874    <xsl:call-template name="genFormalParams">
     
    1037886    <xsl:variable name="evname">
    1038887      <xsl:value-of select="substring(@name, 2)" />
    1039     </xsl:variable>
    1040     <xsl:variable name="evid">
    1041       <xsl:value-of select="concat('On', substring(@name, 2, string-length(@name)-6))" />
    1042888    </xsl:variable>
    1043889    <xsl:variable name="ifname">
  • trunk/src/VBox/Main/include/EventImpl.h

    r85286 r85293  
    141141    {}
    142142
    143 
    144 #if 0
    145     /**
    146      * This function to be used with some care, as arguments order must match
    147      * attribute declaration order event class and its superclasses up to
    148      * IEvent. If unsure, consult implementation in generated VBoxEvents.cpp.
    149      */
    150     HRESULT init(IEventSource* aSource, VBoxEventType_T aType, ...);
    151 
    152     /**
    153     * Function similar to the above, but assumes that init() for this type
    154     * already called once, so no need to allocate memory, and only reinit
    155     * fields. Assumes event is subtype of IReusableEvent, asserts otherwise.
    156     */
    157     HRESULT reinit(VBoxEventType_T aType, ...);
    158 #endif
    159 
    160143    void init(IEvent *aEvent, IEventSource *aSource)
    161144    {
Note: See TracChangeset for help on using the changeset viewer.

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