OUc@sddlZddlZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z de!fd YZ"gej#j$d d j%ej&D] Z'e'^q*Z(e(j)e*ej+d krhe(j)d nde,fdYZ-dS(iNi(tast(tmessage(t CacheStore(t GIRParser(t SourceSymbolt ctype_namet CTYPE_POINTERtCTYPE_BASIC_TYPEt CTYPE_UNIONt CTYPE_ARRAYt CTYPE_TYPEDEFt CTYPE_VOIDt CTYPE_ENUMtCTYPE_FUNCTIONt CTYPE_STRUCTtCSYMBOL_TYPE_FUNCTIONtCSYMBOL_TYPE_TYPEDEFtCSYMBOL_TYPE_STRUCTtCSYMBOL_TYPE_ENUMtCSYMBOL_TYPE_UNIONtCSYMBOL_TYPE_OBJECTtCSYMBOL_TYPE_MEMBERtCSYMBOL_TYPE_ELLIPSIStCSYMBOL_TYPE_CONSTtTYPE_QUALIFIER_CONSTtTYPE_QUALIFIER_VOLATILEtTransformerExceptioncBseZRS((t__name__t __module__(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR'st XDG_DATA_DIRSttnts /usr/sharet TransformercBs*eZedZeddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd Zed6dZedZdZdZedZdZdZdZdZdZd6d6dZdZdZdZ dZ!dZ"dZ#dZ$d6d Z%d!Z&d"Z'eed#Z(d6ed6d$Z)eeed6d%Z*d&Z+d'Z,d(Z-ed)Z.d*Z/d+Z0d,Z1d-Z2ed.Z3d/Z4d0Z5d1Z6d2Z7d3Z8d4Z9d5Z:RS(7cCs|jS(N(t _namespace(tself((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt3sRcCsdt|_||_||_t|_i|_i|_g|_t |_ ||_ i|_ dS(N( Rt _cachestoret_accept_unprefixedR!tsett_pkg_config_packagest _typedefs_nst_parsed_includest _includepathstFalset_passthrough_modet_identifier_filter_cmdt_tag_ns(R"t namespacetaccept_unprefixedtidentifier_filter_cmd((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt__init__5s         cCs|jS(N(R'(R"((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytget_pkgconfig_packagesEscCs d|_dS(N(tNoneR$(R"((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt disable_cacheHscCs t|_dS(N(tTrueR,(R"((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytset_passthrough_modeKscCs|jj|j}t|tjr<t|tjr<nk||krKn\|rt}|j|j|j|jt j d|jf|n|jj |dS(NsNamespace conflict for '%s'( R!tgettnamet isinstanceRtConstantR&tupdatetfile_positionsRtfataltappend(R"tnodetoriginalt positions((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_append_new_nodeNs$   cCs@x|D]}|jdkr"qny|j|}Wn&tk r]}tj||qnX|r}|jr}|j|nt|tj r|j r|j |j kr||j |j |||j}|dkr>dSq>W|S(NcSsog}xYt|jd|jdD]6\}}||krQdj|dS|j|q(Wt||S(NR(tzipRhRrR?tmin(tatbt commonpartstawordtbword((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt common_prefixps . iR(RRRt base_typet child_listR4RE(R"RNRRtchild((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_enum_common_prefixos    c Cs|j|}|r$t|}nd}g}xy|jjD]k}|jrRq=n|dkrn|j|}n|j|}|jtj |j |j |jdq=W|j |j}|jjrtj}n tj}|||jd|} | j|| S(Nitmembers(RRRRtprivateRERR?RtMembertlowert const_intR4RKt is_bitfieldtBitfieldtEnumtadd_symbol_reference( R"RNRt prefixlenRRR9t enum_nametklassR@((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs,      cCs|jjdrdSt|j||j}|j|jj}|j|}tj |||t |j}|j ||S(NR( RERR4RRt_create_parametersRt_create_returnRRtFunctionR+R(R"RNt parameterstreturn_R9tfunc((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs cCs|dk st|jtkr*d}n|jtkrE|j}nh|jtkr`|j}nM|jtkr|j|j S|jt kr|j|j d}nd}|S(Ntvoidt*tgpointer( R4RRR RR9R R t_create_source_typeRR(R"t source_typetvalue((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs   cCs;|dk st|jt@}|jt@}|jtkr?dS|jttt t t gkr|j }|sud}n|rd|}n|r7d|}q7n|jt kr|j|jS|jtkr |j|jd}|r|d7}n|r7|d7}q7n,|rd}nd}|r3d|}n|S|S( NRRsconst s volatile Rs consts volatilet gconstpointer(R4Rttype_qualifierRRRR RR RRR R9R t_create_complete_source_typeRR(R"RtconsttvolatileR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs@          ccsQtd|jD}x1t|jD] \}}|j|||Vq)WdS(Ncss|]}|jVqdS(N(RE(t.0R((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pys s(R&Rt enumeratet_create_parameter(R"RNRt param_namestiR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRsc Cs|j}|jd}|r+|d}n|j|}|d\}}|rV|s\t|rod|}ntjd||jf}|j|j||j|tj dd|j |j f} | S(NRiis %s__%s__unionRns%s.%s( RERRRRRt _parse_fieldsRRCtTypeR9( R"RNRt parent_identRRR/t parent_namet fake_uniont fake_type((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_synthesize_union_types     c CsU|j}|jtkrE|jjjtkrE|j|dt}n |jtkr{|jdkr{|j t j |}n|jt kr|jdkr|j t j |}n|jtkr|j|}|jjt kr |jjdkr |j||}t jd|d|}n|j|}|j|} | ddkr[| d } n| } |ddkr~|d } n|} |j|d|} t jd| d| d| }t|jj} t|_| r| dj|_qn|j|j}t j|j|dtdtd |j}|jrQt|_t|_ t|_n|S( Ntmembertcomplete_ctypeiRtctypeitreadabletwritabletbits(!RRRR t_create_callbackR6RR9R4t_create_member_compoundRRRRR RRtArrayRt_canonicalize_ctypetcreate_type_from_ctype_stringRRRR+tzeroterminatedRtsizet_create_type_from_basetFieldRERRR(R"RNRRR@Rtsynthesized_typetftypeRtcanonical_ctypet derefed_nametderefed_complete_ctypet from_ctypeR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRsP             cCs|jj}|tkr?|jjjtkr?|j|}nZ|tkr~|jjjtkr~|jtj|dt }n|tkr|jtj|}n|t kr|jtj |}n|t kr|j |S|ttttfkrz|j|j}|jjrE|j|j}|j|jjd|}n tj}|tjkradStj||d|jStd|jt|f|S(Nt disguisedRRssymbol %r of type %s(RRRR t_create_typedef_callbackRt_create_typedef_compoundRRR6RRR RR RR RKRER9RRtTYPE_ANYt type_namesR4tAliastNotImplementedErrorR(R"RNRR@R9Rttarget((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR<s6 !!        cCsYtjj|}|r|jS|jds2|S|d }|j|}|d}|S(NRi(RRR8ttarget_fundamentalR`R(R"Rt firstpasstbasetcanonical_baset canonical((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR[s  c Csb|j|}|j|}|jtko:|jjt@}|j|d|d|d|d|S(Ntis_constt is_parametert is_returnR(RRRRRRRR(R"RRRRRR((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRts c Cs|dkrT|dkr)d|d}n|}tj|tjd|d|d |S|dkrd|krd|jddd}nd|d}tj|tjd|d|d |S|dkrtjtjtjd|d|d |SdS(NtGListtGSLists GLib.Lists GLib.SListsGLib.iRRRtGArrayt GPtrArrayt GByteArrays GLib.Arrays GLib.PtrArraysGLib.ByteArrays GObject.ArraysGObject.PtrArraysGObject.ByteArrayRgt GHashTablesGLib.HashTablesGObject.HashTable(RRs GLib.Lists GLib.SList(RR( RRRs GLib.Arrays GLib.PtrArraysGLib.ByteArrays GObject.ArraysGObject.PtrArraysGObject.ByteArray(RsGLib.HashTablesGObject.HashTable(RtListRRhRtMapR4(R"R RRRR9((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_create_bare_container_type}s$       !c Cs|j|}|jdd}|r3|dks?|dkrytjj}d|_tjd|d|d|d|Stjj |} | dk rtj d| j d|d|d|S|j |d|d|d|} | r| Stj d|d|d|S( NRRsutf8*tGStrvRRRR ( RtreplaceRt TYPE_STRINGtcloneR4RRRR8RR R( R"RRRRRRR t bare_utf8t fundamentalt container((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs"     cCs|jtkr%tjdtjS|j|jdt}|jdkr|jrz|jjt krzt j |dnd|f}n |j}tj||SdS(Ns...Rs&missing parameter name; undocumentablesarg%d( RRRt ParametertVarargsRRR6RER4R RRG(R"RtindexRNtptypeRE((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs cCs"|j|dt}tj|S(NR(RR6RtReturn(R"Rttypeval((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRscCsN|jjdrdS|jdks8|jjd r<dS|j|}|jdk rxtj}t |jd}n|j dk r|j dk r|j |j }n tj }|}|j||jr|jr|j|j}|j|}t|tjr|}qn|tjkr=t|j d }q"|tjkrbt|j d }q"|tjkrt|j d }q"|tjkrt|j d}q"t|j }nd|jdk rtj}|jrdnd }n4|jdk rtj}d |jf}n ttj||||j}|j ||S(NRs.hsutf-8ii@i ittruetfalses%flIii(!RERR4tsource_filenameR`Rt const_stringRRtunicodeRRRtTYPE_INTt_resolve_type_from_ctypeRnRRmtresolve_aliasesR:Rt TYPE_UINT64Rt TYPE_UINT32t TYPE_UINT16t TYPE_UINT8t const_booleant TYPE_BOOLEANt const_doublet TYPE_DOUBLERR;R(R"RNR9R(Rt unaliasedR R((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRsN"         cCs|j|j}|js!t|jjr<|jj}nd}||jkr|j|}|jr|||jd|}|j|_|j||S||_|j|_ n@|||jd|d|}|rt |_ n|j |||j||S(NRIR( RKRERRR9R4R.tfieldsRRR6RR(R"tcompound_classRNRR9RItcompoundt new_compound((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs(        cCsj|j|jkr%|j|j}n|d|jd|j}t|_|j|||j||S(NRI(RER.R4R+RRR(R"R;RNR<((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR's  cCs6||j|j}|j|||j||S(N(RERR(R"R;RNR<((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR7s cCs|j|}|sdS|S(N(RR4(R"RNtcallback((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR=scCsx|jjD]s}|j|d|}|s4q nt|tjrO|}n!tj|jdtt d|}|j j |q WdS(NRtanonymous_node( RRRFR:RRRER4R6R+R:R?(R"RNR<Rt child_nodetfield((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRCs  c Cst|j||jj}|j|jjj}xJt|D]<\}}|jjdkrC|jdkrC|j|_qCqCW|r|j }n<|j j ddkr|j |}n|j |j }t j|||td|j }|j||S(NRt user_dataRiR(RRRRRRRR targnamet closure_nameREtfindRRKRtCallbackR+R( R"RNRRtretvalRtparamR9R>((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyROs!   cCstd|kr?|j|}|r*|}qN|jj|}n|j|}|j||jrpd|_n|S(sParse a C type string (as might be given from an annotation) and resolve it. For compatibility, we can consume both GI type string (utf8, Foo.Bar) style, as well as C (char *, FooBar) style. Note that type resolution may not succeed.RgN(RR!ttype_from_nameRt resolve_typetresolvedR4R(R"ttypestrR"R(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytcreate_type_from_user_stringds     cCsPxI|jjD]8}|j|}|rd|j|jf|_tSqWtS(Ns%s.%s(R)Rt get_by_ctypeR9RnR6R+(R"R(tpointer_strippedR/R ((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt'_resolve_type_from_ctype_all_namespacesys cCs|jdk st|jjdd}y|j|}Wntk r]|j||SXx^|D]V\}}|j|}|s|j|}n|red|j |j f|_ t SqeWt S(NRRs%s.%s( RR4RRRRRPR8RNR9RnR6R+(R"R(RORR/R9R ((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR/s cCsq|jdk stxU|jD]G}|jj|jd}|dk r"d|j|jf|_tSq"Wt S(Ns%s.%s( t gtype_nameR4RRRR8R9RnR6R+(R"R(RkR@((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_resolve_type_from_gtype_names cCst|tjtjfr+|j|jSt|tjrk|j|j}|j|j}|oj|S|j rxt S|j r|j |S|j r|j|SdS(N(R:RRRRJt element_typeRtkey_typet value_typeRKR6RR/RQRR(R"R(t key_resolvedtvalue_resolved((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_resolve_type_internals     cCs|j|stS|js%|jr)tS|jdk s>ty|j|j}Wnt k rmd}nX|dkrd|_n|j S(N( RXR+R ttarget_foreignR6RnR4RRmtKeyErrorRK(R"R(ttype_((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRJs    cCspxit|tjrk|jjdk r?|j|jj}q|jjdk rgtj|jj}qPqW|S(sRemoves all aliases from typenode, returns first non-alias in the typenode alias chain. Returns typenode argument if it is not an alias.N( R:RRR RnR4RmR R(R"ttypenode((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR0sN(;RRtpropertyR/R+R2R3R5R7RCRQRTR[RfRmRpRWt classmethodR4RRXRRRRRRRKRRFRRRRRRRRRRRRRRRRRRRRRRRMRPR/RRRXRJR0(((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR 2sr             "         )   8       0 8        (.R]RvRRRRt cachestoreRt girparserRt sourcescannerRRRRRR R R R R RRRRRRRRRRRRt ExceptionRtenvironR8RhtpathsepRRqR?RsR9tobjectR (((su/home/vagrant/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyts    4