iQc@svddlZddlZddlmZddlmZddlmZddlmZddl m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZde fd YZ!gej"j#d d j$ej%D] Z&e&^qZ'e'j(e)ej*d kr\e'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__(((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR%st XDG_DATA_DIRSttnts /usr/sharet TransformercBsoeZedZedZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd Zed<dZedZdZdZedZdZdZdZdZdZd<d<dZdZdZ dZ!dZ"dZ#dZ$dZ%d<d Z&d!Z'd"Z(ed#Z)eed$Z*d<ed<d%Z+eeed<d&Z,d'Z-d(Z.d)Z/ed*Z0d+Z1d,Z2d-Z3d.Z4ed/Z5ed0Z6ed1Z7d2Z8d3Z9d4Z:d5Z;d6Z<d7Z=d8Z>d9Z?d:Z@d;ZARS(=cCs|jS(N(t _namespace(tself((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt1scCs[t|_||_||_t|_i|_i|_g|_t |_ i|_ dS(N( Rt _cachestoret_accept_unprefixedR!tsett_pkg_config_packagest _typedefs_nst_parsed_includest _includepathstFalset_passthrough_modet _annotations(R"t namespacetaccept_unprefixed((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt__init__3s        cCs|jS(N(R'(R"((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytget_pkgconfig_packages>scCs d|_dS(N(tNoneR$(R"((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt disable_cacheAscCs t|_dS(N(tTrueR,(R"((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytset_passthrough_modeDscCs ||_dS(N(R-(R"t annotations((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytset_annotationsGscCs|jj|j}t|tjr<t|tjr<n\|rt}|j|j|j|jt j d|jf|n|jj |dS(NsNamespace conflict for '%s'( R!tgettnamet isinstanceRtConstantR&tupdatetfile_positionsRtfataltappend(R"tnodetoriginalt positions((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_append_new_nodeJs$  cCslxH|D]@}|jdkr"qn|j|}|r|j|qqWx|jjD]\}}|jj|j}|s|jjd|j}n| rt|t j t j frt |j dkrt j |j|dt}|jj|q[|s|jj|q[t|t j t j fr[t |j dkr[|j |_ q[q[Wd|_dS(Ntgst_g_error_get_typet_it disguised(RD(tidentt _traverse_oneRCR(t iteritemsR!R8R9R:RtRecordtUniontlentfieldsR4R?R2(R"tsymbolstsymbolR@ttypedeftcompoundt ns_compoundRF((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytparse[s& "0cCst||_dS(N(tlistR*(R"tpaths((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytset_include_pathsxscCsI||jjkrdS|jjj||j|}|j|dS(N(R!tincludestaddt _find_includet_parse_include(R"tincludetfilename((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytregister_include{s cCstjj|}|jds7td|fn|d }tjj|}||jj kridS|jj j ||j |dt dS(Ns.girs6Include path %r must be a filename path ending in .girit uninstalled( tostpathtbasenametendswitht SystemExitRtIncludet from_stringR!RWRXRZR4(R"t include_pathRatgirnameR[((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytregister_include_uninstalleds cCsd|kr|jj|S|jdd\}}||jjkrV|jj|S||jjkr||jkrtjdd||f|jj|S|j|}|j|SdS(sGiven a name of the form Foo or Bar.Foo, return the corresponding ast.Node, or None if none available. Will throw KeyError however for unknown namespaces.t.is#Deprecated reference to identifier sprefix %s in GIName %sN(R!R8tsplitR9tidentifier_prefixesR)Rtwarn(R"R9tnstginameR[((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt lookup_ginames !  cCs|jr|j|jSdS(siGiven a Type object, if it points to a giname, calls lookup_giname() on the name. Otherwise return None.N(t target_ginameRoR2(R"ttypeobj((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytlookup_typenodes cCs|j}x*tD]"}|jtjj|dqW|jtjjtdd|j|jf}x9|D]1}tjj||}tjj |rp|SqpWt j j d||ft j ddS(Nsgir-1.0s %s-%s.girs+Couldn't find include %r (search path: %r) i(R*t_xdg_data_dirsR?R_R`tjointDATADIRR9tversiontexiststsyststderrtwritetexit(R"R[t searchdirsR`Rgtd((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRYs     cCst|d}|dk r(|j|n|j|j||jj|}|j|_|j|jj =|S(N( R2RVR5RZR$tloadt get_namespaceR!R)R9(tclsR\textra_include_dirsR"tparser((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pytparse_from_girs    cCsd}|jdk r*|jj|}n|dkr~td|j }|j||jdk r~|jj||q~nxH|jjD]7}|j |j kr|j |}|j |qqW|sx*|jj D]}|jj|qWn|j}||j |j |||j}|dkr>dSq>W|S(NcSsog}xYt|jd|jdD]6\}}||krQdj|dS|j|q(Wt||S(NRE(tzipRjRtR?tmin(tatbt commonpartstawordtbword((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt common_prefix[s . iR(RLRTt base_typet child_listR2RG(R"RORRtchild((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_enum_common_prefixZs    c Cs^|j|}|r$t|}nd}g}x|jjD]}|jrRq=n|dkrn|j|}n:y|j|}Wn$tk r}tj ||dSX|j t j |j|j|jdq=Wy|j|j}Wn$tk r}tj ||dSX|jjr,t j} n t j} | ||jd|} | j|| S(Nitmembers(RRLRRtprivateRGRRRt warn_symbolR2R?RtMembertlowert const_intRt is_bitfieldtBitfieldtEnumtadd_symbol_reference( R"RORt prefixlenRRR9Rt enum_nametklassR@((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRps<      cCs|jjdrdSt|j||j}|j|jj}y|j|}Wn$tk r}t j ||dSXt j |||t |j}|j||S(NRE(RGRR2RTt_create_parametersRt_create_returnRRRRRtFunctionR+R(R"ROt parameterstreturn_R9Rtfunc((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs cCs|jtkrd}n|jtkr3|j}nh|jtkrN|j}nM|jtkrm|j|jS|jtkr|j|jd}nd}|S(Ntvoidt*tgpointer( RR RR9R R t_create_source_typeRR(R"t source_typetvalue((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs   cCs)|jt@}|jt@}|jtkr-dS|jttttt gkr|j }|scd}n|rvd|}n|r%d|}q%n|jt kr|j |j S|jtkr|j |j d}|r|d7}n|r%|d7}q%n,|rd}nd}|r!d|}n|S|S( NRRsconst s volatile Rs consts volatilet gconstpointer(ttype_qualifierRRRR RR RRR R9R t_create_complete_source_typeRR(R"RtconsttvolatileR((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs>          ccsQtd|jD}x1t|jD] \}}|j|||Vq)WdS(Ncss|]}|jVqdS(N(RG(t.0R((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pys s(R&Rt enumeratet_create_parameter(R"RORt param_namestiR((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRsc Cs|j}|jd}|r+|d}n|j|}|d\}}|r]d|}ntjd||jf}|j|j||j|tjdd|j |j f} | S(NREiis %s__%s__unionRps%s.%s( RGRRRRKt _parse_fieldsRRCtTypeR9( R"RORt parent_identRRR.t parent_namet fake_uniont fake_type((s{/home/kou/work/ruby/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 |dt}n|jt kr|jdkr|j |dt}n|jt kr|j |}|jjt kr |jjdkr |j||}tjd|d|}n|j|}|j|} | ddkr[| d } n| } |ddkr~|d } n|} |j|d|} tjd| d| d| }t|jj} t|_| r| dj|_qn|j|j}tj|j|dtd td |j}|jrQt|_t|_t|_n|S( Ntmembert anonymoustcomplete_ctypeiRtctypeitreadabletwritabletbits( RRRR t_create_callbackR4RR9R2RRRR RRRtArrayRt_canonicalize_ctypetcreate_type_from_ctype_stringRTRR+tzeroterminatedRtsizet_create_type_from_basetFieldRGRRR(R"RORRR@Rtsynthesized_typetftypeRtcanonical_ctypet derefed_nametderefed_complete_ctypet from_ctypeR((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRsP             cCs|jj}|tkr?|jjjtkr?|j|}np|tkrx|jjjtkrx|j|dt}n7|tkr|j|}n|tkr|j |}n|t kr|j |S|t tt tfkry|j|j}Wn!tk r}tj|dSX|jjr[|j|j}|j|jjd|}n tj}|tjkrwdStj||d|jStd|jt|f|S(NRFRRssymbol %r of type %s(RRRR t_create_typedef_callbackRt_create_typedef_structR4Rt_create_typedef_unionR RR RR RRGRRRlR2R9RRRtTYPE_ANYt type_namestAliastNotImplementedErrorR(R"RORR@R9RRttarget((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyR3sB            cCsYtjj|}|r|jS|jds2|S|d }|j|}|d}|S(NRi(RRR8ttarget_fundamentalRbR(R"Rt firstpasstbasetcanonical_baset canonical((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRXs  cCsQ|j|}|jdd}|rI|jdrI|tjkrIdS|SdS(NRRR(RtreplaceRbRtbasic_type_names(R"Rt is_memberRtderefed_typename((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt parse_ctypeqs c Csb|j|}|j|}|jtko:|jjt@}|j|d|d|d|d|S(Ntis_constt is_parametert is_returnR(RRRRRRRR(R"RR RRRR((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs 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.iRR RtGArrayt GPtrArrayt GByteArrays GLib.Arrays GLib.PtrArraysGLib.ByteArrays GObject.ArraysGObject.PtrArraysGObject.ByteArrayRit GHashTablesGLib.HashTablesGObject.HashTable(RRs GLib.Lists GLib.SList(RR( RRRs GLib.Arrays GLib.PtrArraysGLib.ByteArrays GObject.ArraysGObject.PtrArraysGObject.ByteArray(RsGLib.HashTablesGObject.HashTable(RtListRRjRtMapR2(R"RRR RR9((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyt_create_bare_container_types$       !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*tGStrvRR RR( RRRt TYPE_STRINGtcloneR2RRRR8RRR( R"RR R RRRRt bare_utf8t fundamentalt container((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs"     cCs|jtkrtj}n|j|jdt}|jdkr|jrs|jjt krst j |dnd|f}n |j}tj ||S(NR s&missing parameter name; undocumentablesarg%d( RRRtVarargsRRR4RGR2R RRt Parameter(R"RtindexROtptypeRG((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRs cCs"|j|dt}tj|S(NR(RR4RtReturn(R"Rttypeval((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRsc CsI|jjdrdS|jdks8|jjd r<dSy|j|}Wn$tk ru}tj||dSX|j dk rt j }t |j d}nz|j dk r|jdk r|j|j}n t j}|}|j||jrC|jrC|j|j}|j|}t|t jrC|}qCn|t jkrht|j d }q|t jkrt|j d }q|t jkrt|j d }q|t jkrt|j d }qt|j }n4|jdk rt j}d|jf}n tt j ||||j}|j!||S( NREs.hsutf-8ii@i is%flIii("RGRR2tsource_filenameRbRRRRt const_stringRRtunicodeRRRtTYPE_INTt_resolve_type_from_ctypeRpRRotresolve_aliasesR:Rt TYPE_UINT64Rt TYPE_UINT32t TYPE_UINT16t TYPE_UINT8t const_doublet TYPE_DOUBLEtAssertionErrorR;R( R"ROR9RR#Rt unaliasedRR((s{/home/kou/work/ruby/ruby-gnome2.win32/gobject-introspection/vendor/local/lib/gobject-introspection/giscanner/transformer.pyRsR        cCsy|j|j}Wn$tk r<}tj||dSXtj||jd|}|j|||j |||j |js   4