iэ,UdZddlmZddlZddlZGddeZGddeZdZdZ Gdd Z Gd d e Z Gd d e Z Gdde Z Gdde ZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGd d!eZGd"d#eZGd$d%eZGd&d'eZGd(d)eZGd*d+eZid,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBd=dCd=dDd=dEd=dFd=dGd=d=d=d=d=dHZGdIdJe ZidKeddLfdMeddLfdNeddLfdOedLdLfdPedLdLfdQedLdLfdRedLdLfdSedLdLfdTedLdLfdUedLdLfdVedfdWedLdfdXedfdYedfdZedfd[edfd\edfidXedfd]edfd^edfd_edfd`edfdaedfdbedLdLfdcedLdLfddedfdeedfdfedfdgedfdhedfdiedfdje dfdke dfdle dfidme dfdne dfdoe dLfdpe dLfdqe dLfdre dLfdse dLfdte dLfdue dLfdve dLfd.e dfdwe dfdxeddLfdyeddLfdzeddLfd{eddLfd|eddLfeddLfed}d}feddfeddLfeddLfeddLfedLfedfedfedLfedfedfed}fed}fd~eeedfZ de!d<dZ"GddZ#GddZ$GddZ%dZ&dZ'dZ(dZ)dS)aUtilities for makegw - Parse a header file to build an interface This module contains the core code for parsing a header file describing a COM interface, and building it into an "Interface" structure. Each Interface has methods, and each method has arguments. Each argument knows how to use Py_BuildValue or Py_ParseTuple to exchange itself with Python. See the @win32com.makegw@ module for information in building a COM interface ) annotationsNc eZdZdfd ZxZS)error_not_found%The requested item could not be foundcJt|dSNsuper__init__selfmsg __class__s IC:\PYTHON\_runtimes\venv\Lib\site-packages\win32com/makegw/makegwparse.pyr zerror_not_found.__init__! )r__name__ __module__ __qualname__r __classcell__rs@rrr=rrc eZdZdfd ZxZS)error_not_supported+The required functionality is not supportedcJt|dSrr r s rr zerror_not_supported.__init__rr)rrrs@rrrrrrceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdS) ArgFormatterzHAn instance for a specific type of argument. Knows how to convert itselfrc>||_||_||_d|_dSNr)argbuiltinIndirectiondeclaredIndirection gatewayModer r"r#r$s rr zArgFormatter.__init__*s'"4#6 rcH||z }|dkrdS|dkrdS|dkrdSd|fzS)aGiven the indirection level I was declared at (0=Normal, 1=*, 2=**) return a string prefix so I can pass to a function with the required indirection (where the default is the indirection of the method's param. eg, assuming my arg has indirection level of 2, if this function was passed 1 it would return "&", so that a variable declared with indirection of 1 can be prefixed with this to turn it into the indirection level required of 2 r&*z?? (%d))r)r indirectionFrom indirectionTodifs r_IndirectPrefixzArgFormatter._IndirectPrefix1sE - !882 BYY3 AXX3v% %rc|||jz}||||jjzSr)_GetDeclaredIndirectionr#r0r"name)r indirectFromr.s rGetIndirectedArgNamez!ArgFormatter.GetIndirectedArgNameEsD   7799Dprintr3r%r$r8s rr2z$ArgFormatter._GetDeclaredIndirections x((rc2trd|jjzSdS)zEDeclare the variable used as the PyArg_ParseTuple param for a gatewayz8/* Declare ParseArgTupleInputConverter goes here: %s */ r(rBr8s r"DeclareParseArgTupleInputConverterz/ArgFormatter.DeclareParseArgTupleInputConverters'  K(-   2rc2trd|jjzSdS)z_Get a string of C++ code to be executed after (ie, to finalise) the PyArg_ParseTuple conversionz*/* GetParsePostCode code goes here: %s */ r(rBr8s rGetParsePostCodezArgFormatter.GetParsePostCodes  @48=P P2rc2trd|jjzSdS)znGet a string of C++ code to be executed before (ie, to initialise) the Py_BuildValue conversion for Interfacesz0/* GetBuildForInterfacePreCode goes here: %s */ r(rBr8s rGetBuildForInterfacePreCodez(ArgFormatter.GetBuildForInterfacePreCodes  FV V2rcv|}tr|dddkrd|jjz}|S)zlGet a string of C++ code to be executed before (ie, to initialise) the Py_BuildValue conversion for GatewaysN/* Gz./* GetBuildForGatewayPreCode goes here: %s */ )rSrCr"r3r ss rGetBuildForGatewayPreCodez&ArgFormatter.GetBuildForGatewayPreCodes@  , , . .  V!uE Urc2trd|jjzSdS)zkGet a string of C++ code to be executed after (ie, to finalise) the Py_BuildValue conversion for Interfacesz1/* GetBuildForInterfacePostCode goes here: %s */ r(rBr8s rGetBuildForInterfacePostCodez)ArgFormatter.GetBuildForInterfacePostCodes  XG$(-W Wrrcv|}tr|dddkrd|jjz}|S)ziGet a string of C++ code to be executed after (ie, to finalise) the Py_BuildValue conversion for GatewaysNrUrVz//* GetBuildForGatewayPostCode goes here: %s */ )r[rCr"r3rWs rGetBuildForGatewayPostCodez'ArgFormatter.GetBuildForGatewayPostCodes@  - - / /  W!uFVrc|d||jj|jjS)Nz$// @pyparm {}|{}||Description for {})format_GetPythonTypeDescr"r3r8s rGetAutoduckStringzArgFormatter.GetAutoduckStrings75<<  # # % % HM HM   rcdS)zIReturns a string with the description of the type. Used for doco purposesNr8s rr`zArgFormatter._GetPythonTypeDescstrcdS)z5Determines if this arg forces a USES_CONVERSION macrorrcr8s rNeedUSES_CONVERSIONz ArgFormatter.NeedUSES_CONVERSIONsqrNr)rrr__doc__r r0r5r9r;r@rDrFr?rKr2rOrQrSrYr[r]rar`rercrrrr'sTRRUUU(QQQ"EEE   >   !!!,,,       rrc>eZdZdZdZdZdZdZdZdZ dZ d S) ArgFormatterFloatcdS)Nfrcr8s r GetFormatCharzArgFormatterFloat.GetFormatCharsrc d|jjzS)Nz double dbl%s; r7r8s rrOz4ArgFormatterFloat.DeclareParseArgTupleInputConverters"TX]22rc d|jjzSNz&dblr7r8s rr;z"ArgFormatterFloat.GetParseTupleArg %%rcdS)Nfloatrcr8s rr`z$ArgFormatterFloat._GetPythonTypeDescswrc d|jjzSrpr7r8s rr9z"ArgFormatterFloat.GetBuildValueArgrqrcFd|jjzdz|jjzdzS)Nz dbl = ; r7r8s rrSz-ArgFormatterFloat.GetBuildForInterfacePreCodes$&.>FFrcd|jjz||dz|jjzdzS)Nz dbl%s = rrwr"r3r0r2r8s rrYz+ArgFormatterFloat.GetBuildForGatewayPreCodesN 48= (""4#?#?#A#A1EE Fhm   rcd}|jr+|||dz }||jjz }|d|jjzz }|S)N rz = (float)dbl%s; r%r0r2r"r3rWs rrQz"ArgFormatterFloat.GetParsePostCodes`    I %%d&B&B&D&DaHH HA TX] !DHM 11rN rrrrlrOr;r`r9rSrYrQrcrrriris333&&&&&&GGG   rric>eZdZdZdZdZdZdZdZdZ dZ d S) ArgFormatterShortcdS)Nircr8s rrlzArgFormatterShort.GetFormatChar rmrc d|jjzS)Nz INT i%s; r7r8s rrOz4ArgFormatterShort.DeclareParseArgTupleInputConverters --rc d|jjzSNz&ir7r8s rr;z"ArgFormatterShort.GetParseTupleArgdhm##rcdS)Nintrcr8s rr`z$ArgFormatterShort._GetPythonTypeDescsurc d|jjzSrr7r8s rr9z"ArgFormatterShort.GetBuildValueArgrrcFd|jjzdz|jjzdzS)Nz irvrwr7r8s rrSz-ArgFormatterShort.GetBuildForInterfacePreCodes$tx}$u,tx}r"typer8s rr`z(ArgFormatterPythonCOM._GetPythonTypeDescbsDHM))rc d|jjzSrr7r8s rr9z&ArgFormatterPythonCOM.GetBuildValueArgerrc d|jjzSrr7r8s rr[z2ArgFormatterPythonCOM.GetBuildForInterfacePostCodehrrN) rrrrgrlrOr;r`r9r[rcrrrrRstDD 555%%%***$$$77777rrc,eZdZdZdZdZdZdZdS)ArgFormatterBSTRcdSNz rcr8s rr`z#ArgFormatterBSTR._GetPythonTypeDescm}rcjd|jj|ddSNzN if (bPythonIsHappy && !PyWinObject_AsBstr(ob{}, {})) bPythonIsHappy = FALSE; rrr8s rrQz!ArgFormatterBSTR.GetParsePostCodep3ahh HM444T1==   rcT|dd}d|jjd|dS)Nr+rz = MakeBstrToObj(rrrs rrSz,ArgFormatterBSTR.GetBuildForInterfacePreCodeus4//a88 GdhmGGkGGGGrcXd|jjdt|zS)Nz SysFreeString(rr"r3rr[r8s rr[z-ArgFormatterBSTR.GetBuildForInterfacePostCodeys0 2tx} 2 2 2#@@FF G rc d|jjzSrr7r8s rr]z+ArgFormatterBSTR.GetBuildForGatewayPostCoderrN)rrrr`rQrSr[r]rcrrrrlsb   HHH   77777rrc8eZdZdZdZdZdZdZdZdZ dS) ArgFormatterOLECHARcdSrrcr8s rr`z&ArgFormatterOLECHAR._GetPythonTypeDescrrc|jjdddkr)|jjdd|jjddzS|jjSNLPCrr"rrHr8s rr?z"ArgFormatterOLECHAR.GetUnconstTypeJ 8=!  % %8=!$tx}QRR'88 88$ $rcjd|jj|ddSrrr8s rrQz$ArgFormatterOLECHAR.GetParsePostCoderrc4d|ddzS)Nz SysFreeString(%s); r+r5r8s rrDz*ArgFormatterOLECHAR.GetInterfaceArgCleanups'$*C*CD!*L*LLLrc^||jd}d|jjd|dS)Nr+rz = MakeOLECHARToObj(rr5r#r"r3rs rrSz/ArgFormatterOLECHAR.GetBuildForInterfacePreCodes7//0GKK JdhmJJJJJJrcXd|jjdt|zS)Nz CoTaskMemFree(rrr8s rr[z0ArgFormatterOLECHAR.GetBuildForInterfacePostCodes2 3tx} 2 2 2#@@FF G rc d|jjzSrr7r8s rr]z.ArgFormatterOLECHAR.GetBuildForGatewayPostCoderrN rrrr`r?rQrDrSr[r]rcrrrrs%%%    MMMKKK    77777rrc8eZdZdZdZdZdZdZdZdZ dS) ArgFormatterTCHARcdS)Nzstring/rcr8s rr`z$ArgFormatterTCHAR._GetPythonTypeDescs##rc|jjdddkr)|jjdd|jjddzS|jjSrrr8s rr?z ArgFormatterTCHAR.GetUnconstTyperrcjd|jj|ddS)NzO if (bPythonIsHappy && !PyWinObject_AsTCHAR(ob{}, {})) bPythonIsHappy = FALSE; rrr8s rrQz"ArgFormatterTCHAR.GetParsePostCodes3bii HM444T1==   rc4d|ddzS)Nz PyWinObject_FreeTCHAR(%s); r+rr8s rrDz(ArgFormatterTCHAR.GetInterfaceArgCleanups/$2K2KDRS2T2TTTrc^||jd}d|jjd|dS)Nr+rz = PyWinObject_FromTCHAR(rrrs rrSz-ArgFormatterTCHAR.GetBuildForInterfacePreCodes7//0GKK OdhmOOkOOOOrcdS)Nz// ??? - TCHAR post code rcr8s rr[z.ArgFormatterTCHAR.GetBuildForInterfacePostCodes++rc d|jjzSrr7r8s rr]z,ArgFormatterTCHAR.GetBuildForGatewayPostCoderrNrrcrrrrs$$$%%%    UUUPPP ,,,77777rrc&eZdZdZdZdZdZdS)ArgFormatterIIDcdS)Nz rcr8s rr`z"ArgFormatterIID._GetPythonTypeDesc{rcVd|jj|jjS)Nz< if (!PyWinObject_AsIID(ob{}, &{})) bPythonIsHappy = FALSE; )r_r"r3r8s rrQz ArgFormatterIID.GetParsePostCodes(OVV HM HM   rcT|dd}d|jjd|dS)Nrrz = PyWinObject_FromIID(rrrs rrSz+ArgFormatterIID.GetBuildForInterfacePreCodes4//a88 MdhmMMKMMMMrc8|jjd|jjzfS)NzIID %sr7r8s rr@z)ArgFormatterIID.GetInterfaceCppObjectInfosx}h$(-888rN)rrrr`rQrSr@rcrrrrsS   NNN 99999rrc.eZdZddZdZdZdZdZdS) ArgFormatterTimerc|jdkr9|jdddkr&|jdd|_|xjdz c_d}t||||dS)NrrLPr+)r>rHrr r&s rr zArgFormatterTime.__init__s~  1 $ $bqb)9T)A)A<+CL  A % !" && #)+>     rcdS)Nzrcr8s rr`z#ArgFormatterTime._GetPythonTypeDescrcd|jj|jj||jdS)Nz if (!PyTime_Check(ob{})) {{ PyErr_SetString(PyExc_TypeError, "The argument must be a PyTime object"); bPythonIsHappy = FALSE; }} if (!((PyTime *)ob{})->GetTime({})) bPythonIsHappy = FALSE; r+)r_r"r3r5r#r8s rrQz!ArgFormatterTime.GetParsePostCodesGbii HM HM  % %d&=q A A   rc^||jd}d|jjd|dS)Nrrz = new PyTime(rrrs rrSz,ArgFormatterTime.GetBuildForInterfacePreCodes7//0GKK DdhmDD;DDDDrcd}|j|jjzdkrd|jjz}|t|zS)Nr(r+z CoTaskMemFree(%s); )r#r"r>r3rr[r rets rr[z-ArgFormatterTime.GetBuildForInterfacePostCodesG  "TX%> > B B*TX]:C*GGMMMMrNrf)rrrr r`rQrSr[rcrrrrsl           EEE NNNNNrrc eZdZdZdZdZdS)ArgFormatterSTATSTGcdS)Nz rcr8s rr`z&ArgFormatterSTATSTG._GetPythonTypeDescrrcjd|jj|ddS)NzM if (!PyCom_PyObjectAsSTATSTG(ob{}, {}, 0/*flags*/)) bPythonIsHappy = FALSE; r+rr8s rrQz$ArgFormatterSTATSTG.GetParsePostCodes3`gg HM444T1==   rc|dd}d|jj|dd||S)Nr+z ob{} = PyCom_PyObjectFromSTATSTG({}); // STATSTG doco says our responsibility to free if (({}).pwcsName) CoTaskMemFree(({}).pwcsName); r5r_r"r3rs rrSz/ArgFormatterSTATSTG.GetBuildForInterfacePreCodesX//a88 bii HM  % %dA . .      rNrrrr`rQrSrcrrrrsA        rrc&eZdZdZdZdZdZdS)ArgFormatterGenericc d|jjzSNzrr8s rr`z&ArgFormatterGeneric._GetPythonTypeDescs$(-''rcd|jj|jj|ddS)Nz7 if (!PyObject_As{}(ob{}, &{}) bPythonIsHappy = FALSE; r+)r_r"rr3r5r8s rrQz$ArgFormatterGeneric.GetParsePostCodes;JQQ HM HM  % %dA . .   rc<d|jjd|jjdS)Nz PyObject_Free(r)r"rr3r8s rrDz*ArgFormatterGeneric.GetInterfaceArgCleanups#DDDDDDDrc|dd}d|jj|jj|ddS)Nr+z ob{} = PyObject_From{}({}); )r5r_r"r3rrs rrSz/ArgFormatterGeneric.GetBuildForInterfacePreCodesP//a88 077 HM HM  % %dA . .   rNrrrr`rQrDrSrcrrrrsS(((   EEE     rrc&eZdZdZdZdZdZdS)ArgFormatterIDLISTcdS)Nz rcr8s rr`z%ArgFormatterIDLIST._GetPythonTypeDesc'rrcjd|jj|ddS)NzL if (bPythonIsHappy && !PyObject_AsPIDL(ob{}, &{})) bPythonIsHappy = FALSE; r+rr8s rrQz#ArgFormatterIDLIST.GetParsePostCode*s3_ff HM444T1==   rc"d|jjdS)Nz PyObject_FreePIDL(rr7r8s rrDz)ArgFormatterIDLIST.GetInterfaceArgCleanup/s9dhm9999rc|dd}d|jj|ddS)Nr+z ob{} = PyObject_FromPIDL({}); rrs rrSz.ArgFormatterIDLIST.GetBuildForInterfacePreCode2sI//a88 299 HM  % %dA . .   rNrrcrrrr&sP   :::     rrc eZdZdZdZdZdS)ArgFormatterHANDLEcdS)Nz rcr8s rr`z%ArgFormatterHANDLE._GetPythonTypeDesc;s~rcjd|jj|ddS)NzE if (!PyWinObject_AsHANDLE(ob{}, &{}, FALSE) bPythonIsHappy = FALSE; r+rr8s rrQz#ArgFormatterHANDLE.GetParsePostCode>s3X__ HM444T1==   rc|dd}d|jj|ddS)Nr+z$ ob{} = PyWinObject_FromHANDLE({}); rrrs rrSz.ArgFormatterHANDLE.GetBuildForInterfacePreCodeCsI//a88 7>> HM  % %dA . .   rNrrcrrrr:sA        rrc&eZdZdZdZdZdZdS)ArgFormatterLARGE_INTEGERcdS)N LARGE_INTEGERrcr8s r GetKeyNamez$ArgFormatterLARGE_INTEGER.GetKeyNameLsrc0d|zSr)r r8s rr`z,ArgFormatterLARGE_INTEGER._GetPythonTypeDescOs$//++++rcd||jj|ddS)Nz: if (!PyWinObject_As{}(ob{}, {})) bPythonIsHappy = FALSE; r+)r_r r"r3r5r8s rrQz*ArgFormatterLARGE_INTEGER.GetParsePostCodeRsAMTT OO   HM  % %dA . .   rc|dd}d|jj||S)Nrz ob{} = PyWinObject_From{}({}); )r5r_r"r3r rs rrSz5ArgFormatterLARGE_INTEGER.GetBuildForInterfacePreCodeYsF//a88 3:: HM OO      rN)rrrr r`rQrSrcrrrrKsP,,,        rrceZdZdZdS)ArgFormatterULARGE_INTEGERcdS)NULARGE_INTEGERrcr8s rr z%ArgFormatterULARGE_INTEGER.GetKeyNamecrrN)rrrr rcrrrrbs#     rrc,eZdZdZdZdZdZdZdS)ArgFormatterInterfacec|d|jjd||jjfS)Nr+z{} * {})r5r"r>r_r?r3r8s rr@z/ArgFormatterInterface.GetInterfaceCppObjectInfohsR(( tx(        ! ! HM    rc|jr|dd}n|dd}d|jj|jj|S)Nrr+z if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(ob{}, IID_{}, (void **){}, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; )r%r5r_r"r3r)r sArgs rrQz&ArgFormatterInterface.GetParsePostCodepsk   3,,T155DD,,Q22D`gg HM48=$   rcld|jj|jj|jjS)Nz7 ob{} = PyCom_PyObjectFromIUnknown({}, IID_{}, FALSE); )r_r"r3rr8s rrSz1ArgFormatterInterface.GetBuildForInterfacePreCode{s/JQQ HM HM HM   rc||d}d|jj||jj|jjS)Nr+z8 ob{} = PyCom_PyObjectFromIUnknown({}{}, IID_{}, TRUE); )r0r2r_r"r3r)r sPrefixs rrYz/ArgFormatterInterface.GetBuildForGatewayPreCodesS&&t'C'C'E'EqIIKRR HM  HM HM    rc<d|jjd|jjdS)Nz if (z) z ->Release(); r7r8s rrDz,ArgFormatterInterface.GetInterfaceArgCleanups#F FFFFFFrN)rrrr@rQrSrYrDrcrrrrgsd             GGGGGrrc eZdZdZdZdZdS)ArgFormatterVARIANTcjd|jj|ddS)NzG if ( !PyCom_VariantFromPyObject(ob{}, {}) ) bPythonIsHappy = FALSE; r+rr8s rrQz$ArgFormatterVARIANT.GetParsePostCodes3]dd HM444T1==   rcT|dd}d|jjd|dS)Nr+rz = PyCom_PyObjectFromVariant(rrrs rrYz-ArgFormatterVARIANT.GetBuildForGatewayPreCoderrc d|jjzSrr7r8s rr]z.ArgFormatterVARIANT.GetBuildForGatewayPostCoderrN)rrrrQrYr]rcrrrrsD   TTT77777rrBOOL)r rrUINT)r!rrBYTE)r"rrINT)r#rrDWORD)r$rlHRESULT)r&rr%ULONG)r'rr%LONG)r(rr%r)rrrlong)r)rr%DISPID)r*r)r% APPBREAKFLAGSBREAKRESUMEACTIONERRORRESUMEACTION BREAKREASONBREAKPOINT_STATEBREAKRESUME_ACTION)SOURCE_TEXT_ATTR TEXT_DOC_ATTR QUERYOPTION PARSEACTIONceZdZdZdZdZdS)ArgFormatterSimplez-An arg formatter for simple integer etc typesc<t|jjdS)NrConvertSimpleTypesr"rr8s rrlz ArgFormatterSimple.GetFormatChar!$(-033rc<t|jjdSrJr8r8s rr`z%ArgFormatterSimple._GetPythonTypeDescr:rN)rrrrgrlr`rcrrr6r6s87744444444rr6z const OLECHARr+WCHAROLECHAR LPCOLESTRLPOLESTRLPCWSTRLPWSTRLPCSTRLPTSTRLPCTSTRHANDLEBSTRz const IIDCLSIDIIDGUIDz const GUIDREFCLSIDREFIIDREFGUIDzconst FILETIMEzconst SYSTEMTIMEzconst LPSYSTEMTIME LPSYSTEMTIMEFILETIME SYSTEMTIMESTATSTGr rVARIANTrssingleshortWORD VARIANT_BOOLHWNDHMENUHOLEMENUHICONHDCLPARAMWPARAMLRESULTSVSIFControl DataObject _PropertyBag AsyncProp DataSourcer) DataFormatzvoid ** ITEMIDLIST LPITEMIDLIST LPCITEMIDLISTzconst ITEMIDLIST PITEMID_CHILDzconst PITEMID_CHILDPCITEMID_CHILDPUITEMID_CHILDPCUITEMID_CHILDzconst PUITEMID_CHILDPCUITEMID_CHILD_ARRAYzconst PCUITEMID_CHILD_ARRAYzOdict[str, tuple[type[ArgFormatter], int, int] | tuple[type[ArgFormatter], int]] AllConvertersc t|jd}t|jd}d}tt|jdkrt|jd}||||S#t$rE|jddkrt |ddcYSt d|jd|jdwxYw)Nrr+rIz The type 'z' (z ) is unknown.)rmrlenKeyErrorrrr3)r"clzbindecls rmake_arg_converterru s UCH%a(CH%a( }SX& ' '! + + *1-Ds3T""" UUU 8A;#  (a33 3 3 3!"Ssx"S"SCH"S"S"STTT UsA9A<<,C *!C c`eZdZdZejdZedZdZ dZ dZ dZ dS) ArgumentzA representation of an argument to a COM method This class contains information about a specific argument to a method. In addition, methods exist so that an argument knows how to convert itself to/from Python arguments. z6/\* \[([^\]]*.*?)] \*/[ \t](.*[* ]+)(\w+)(\[ *])?[\),]cfdd|dDS)Nr=c3DK|]}|d|VdS)__RPC_N) startswith).0es r z-Argument.drop_rpc_metadata..+s3RRa1<<;Q;QRRRRRRRr)joinsplit)clstype_s rdrop_rpc_metadatazArgument.drop_rpc_metadata)s/xxRR5;;s#3#3RRRRRRrc||_d|_d|_d|_d|_d|_d|_d|_d|_dSr!) good_interface_namesinoutr3rraw_typerHconst arrayDeclr>r rs rr zArgument.__init__-sI$8!       !rc|}|j|}|st|d|_|dd|_|d}||_ |dr2d|_ | |}||kr|xj dz c_ | |} | d}|xj dz c_ |d|}n#t$rYnwxYwT||_|jddd kr|jdd|_n |j|_t"r>t%d |j|jd|j z|jdSdS) zParse and build my data from a file Reads the next line in the file, and matches it as an argument description. If not a valid argument line, an error_not_found exception is raised. rr+z][rrUr,Nzconst z Arg {} of type {}{} ({}))readlineregexsearchrgroupr3rrstriprrrr>rindex ValueErrorrrHVERBOSErMr_)r filelinemotyp typ_no_rpcposs r BuildFromFilezArgument.BuildFromFile8s}} Z  t $ $ "! !HHQKK XXa[[&&t,, hhqkk!! 88A;; +DN//44Jj  %%*%%$$S))  jjoo%%*%%$3$ioo''       9RaR=H $ $ IabbMDMM IDM   188Ity#0E*Etz       s AE EEc||jvS)aDetermines if the argument has the specific attribute. Argument attributes are specified in the header file, such as "[in][out][retval]" etc. You can pass a specific string (eg "out") to find if this attribute was specified for the argument )r)r rs r HasAttributezArgument.HasAttributebsdj  rc@|jd|j}|jr|dz }|S)Nr=z[])rr3rrs rGetRawDeclarationzArgument.GetRawDeclarationks1,,,, >  4KC rN) rrrrgrecompiler classmethodrr rrrrcrrrwrws BJP Q QESS[S " " "(((T!!!rrwc>eZdZdZejdZdZdZdS)MethodzA representation of a C++ method on a COM interface This class contains information about a specific method, as well as a list of all @Argument@s z+virtual (/\*.*?\*/ )?(.*?) (.*?) (.*?)\(\w?cL||_dx|_x|_|_g|_dSr)rr3resultcallconvargsrs rr zMethod.__init__}s*$8!266 6DK$- rcB|}|j|}|st|d|_|d|_|jdkrR|jdkrtdntd|jztd|jd|jd  t|j } | ||j |n#t$rYd SwxYwW) zParse and build my data from a file Reads the next line in the file, and matches it as a method description. If not a valid method line, an error_not_found exception is raised. rUrr&r$zBWarning: Old style interface detected - compilation errors likely!z4Method %s - Only HRESULT return types are supported.z Method r=rr+N) rrrrrr3rrMrwrrrappend)r rrrr"s rrzMethod.BuildFromFiles>}} Z  t $ $ "! !HHQKK hhqkk ;) # #{g%%XJTYV ;;;ty;;; < < < 4455C !!$'''   %%%%"      s/D DDN) rrrrgrrrr rrcrrrrrsP BJE F FE rrc>eZdZdZejdZdZdZdS) InterfacezA representation of a C++ COM Interface This class contains information about a specific interface, as well as a list of all @Method@s z#(interface|) ([^ ]*) : public (.*)$cg|_|d|_|d|_tr!t d|jd|jdSdS)Nrrz Interface z : public )methodsrr3baserrM)r rs rr zInterface.__init__si HHQKK HHQKK  A ?ty??DI?? @ @ @ @ @ A Arc|| t|jg}|||j|n#t $rYdSwxYwX)z(Build all sub-methods for this interfacer+N)rrr3rrrr)r rmethods r BuildMethodszInterface.BuildMethodss     ,,$$T*** ##F++++"      sAA00 A>=A>N) rrrrgrrrr rrcrrrrsS BJ= > >EAAA     rrcvd}|}|rtj|}|r`|d}t |t ddft|<||kr$t|}|||}||r|St)zFind and return an interface in a file Given an interface name and file, search for the specified interface. Upon return, the interface itself has been built, but not the methods. Nrrr+) rrrrrrMrrmrr) interfaceNamer interfacerrr3s rfind_interfacersI ==??D   _ # #D ) )  -88A;;D $KKK#8!Q"?M$ }$$%bMM &&t,,,}}   rc t||S#tj$r&tjt dYdSwxYw)zFind, parse and return an interface in a file Given an interface name and file, search for the specified interface. Upon return, the interface itself is fully built, zCThe interface could not be built, as the regular expression failed!N)rrerror traceback print_excrM)rrs rparse_interface_infors`UmT222 8UUU STTTTTTUs1AActd} td||dS#|wxYw)Nzd:\msdev\include\objidl.hIPersistStream)openrclose)rks rtestrsI +,,A-q111   s 7A c &||d}|dkrtddStd||d|d|d|dfzdS) Nrr)z ** Not foundz%d %s %s %s %sr+rrrU)rrMr)rtextress r test_regexrs ((4  C byy n CQWWQZZQWWUVZZ#X X     r)*rg __future__rrr ExceptionrrrrCrrirrrrrrrrrrrrrrrrr9r6dictfromkeysrm__annotations__rurwrrrrrrrcrrrs    #""""" i )  yyyyyyyyz""""" """N""""" """L77777<777B77777L777477777,777.77777/777D77777-777<99999+999&#N#N#N#N#N,#N#N#NL     /   &     /   .     .   (     .   "     5   .     !:   %G%G%G%G%G1%G%G%GP 7 7 7 7 7/ 7 7 7        "  &  "    %(,,& +!"-#$,(&&+244444444D)1a0D !1a (D#Q*D%q!, D $a+ D #Q* D "Aq)D "Aq)D  !Q'D!1a(D !1%D q! $D/1%D oq !D OQ D  _a !D"?A&#DD$/1%%D&!$'D( ")D*#+D,'+-D.)1-/D0+Q21D2%q!,3D4!1%5D6#Q'7D8#Q'9D:/3;D<115=D>#Q'?D@  #ADB  !$CDD  #EDDDF  "GDH&*IDJ !1 %KDL "A &MDN%q)ODP "A &QDR ! $SDT #Q'UDV #Q'WDX$a(YDZ  "[D\  #]D^%q!,_D`(!Q/aDb*Aq1cDd'A.eDf(!Q/gDDh)!Q/%q!,%q!,'A.(!Q/+Q2(!,.2)1-)1-*A./30!4$6#:CDDDF mm&);Q(?@@GDFFFFR U U U$RRRRRRRRj........b@2 U U U     r