9Wc@sZddlZddlZddlZddlmZdZdZdZdZde fdYZ d e fd YZ d e fd YZ e Z d e fdYZdefdYZdefdYZdefdYZde fdYZdefdYZdefdYZde fdYZee ZdZee ZdefdYZd e fd!YZeed"dZd#e fd$YZd%efd&YZd'efd(YZd)efd*YZ d+efd,YZ!dd-Z"dd.Z#eZ$d/Z%d0Z&d1Z'dS(2iNi(t allocate_lockiicCs[|t@rd|j}n|t@r:d|j}n|t@rWd|j}n|S(Ns const s volatile s __restrict (tQ_CONSTtlstript Q_VOLATILEt Q_RESTRICT(tqualst replace_with((s0/usr/lib64/python2.7/site-packages/cffi/model.pytqualify s   tBaseTypeByIdentitycBs_eZeZeZddddZdZdZdZedZ dZ d Z RS( tsa C fileicCs|j}|j}|rc|jdrCd|krCd|}qc|ddkrcd|}qcnt||}|jd|}d|krd d lm}|d |j|fn|S( Nt*s&[s(%s)is[(t t&t$i(tVerificationErrors-cannot generate '%s' in %s: unknown type name(tc_name_with_markertstript startswithRtreplacet ffiplatformRt _get_c_name(tselfRtcontextRtresultR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt get_c_names    cCs|jjddS(NR R (RR(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR0scCsd|jkS(NR (R(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt has_c_name3scCstS(N(tFalse(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pytis_integer_type6scCsPy|j|}Wn8tk rK|j||}|jj||}nX|S(N(t_cached_btypestKeyErrortbuild_backend_typet setdefault(Rtffit finishlistt can_delaytBTypetBType2((s0/usr/lib64/python2.7/site-packages/cffi/model.pytget_cached_btype9s cCsd|jfS(Ns<%s>(R(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt__repr__BscCs)g|jD]}|t||f^q S(N(t_attrs_tgetattr(Rtname((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt _get_itemsEs( t__name__t __module__Rt is_array_typetis_raw_functionRRRRR%R&R*(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs    tBaseTypecBs#eZdZdZdZRS(cCs(|j|jko'|j|jkS(N(t __class__R*(Rtother((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt__eq__KscCs ||k S(N((RR1((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt__ne__OscCst|jt|jfS(N(thashR0ttupleR*(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt__hash__Rs(R+R,R2R3R6(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR/Is  tVoidTypecBs eZdZdZdZRS(cCs d|_dS(Nsvoid&(R(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt__init__YscCst||dS(Nt new_void_type(t global_cache(RR R!((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR\s((R+R,R'R8R(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR7Vs tBasePrimitiveTypecBseZRS((R+R,(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR;bst PrimitiveTypecBseZd8Zi/dd6dd6dd6dd6dd6dd6dd 6dd 6dd 6dd 6dd 6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd!6dd"6dd#6dd$6dd%6dd&6dd'6dd(6dd)6dd*6dd+6dd,6dd-6dd.6dd/6dd06dd16dd26Zd3Zd4Zd5Zd6Zd7ZRS(9R)tctchartitshorttinttlongs long longs signed chars unsigned charsunsigned shorts unsigned ints unsigned longsunsigned long longtftfloattdoubles long doublet_Booltwchar_ttint8_ttuint8_ttint16_ttuint16_ttint32_ttuint32_ttint64_ttuint64_tt int_least8_tt uint_least8_tt int_least16_ttuint_least16_tt int_least32_ttuint_least32_tt int_least64_ttuint_least64_tt int_fast8_tt uint_fast8_tt int_fast16_tt uint_fast16_tt int_fast32_tt uint_fast32_tt int_fast64_tt uint_fast64_ttintptr_tt uintptr_ttintmax_tt uintmax_tt ptrdiff_ttsize_ttssize_tcCs||_|d|_dS(NR (R)R(RR)((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8s cCs|j|jdkS(NR=(tALL_PRIMITIVE_TYPESR)(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt is_char_typescCs|j|jdkS(NR?(RgR)(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRscCs|j|jdkS(NRC(RgR)(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt is_float_typescCst||d|jS(Ntnew_primitive_type(R:R)(RR R!((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs(sname( R+R,R'RgR8RhRRiR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR<fsl     tUnknownIntegerTypecBs)eZdZdZdZdZRS(R)cCs||_|d|_dS(NR (R)R(RR)((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8s cCstS(N(tTrue(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRscCstd|jdS(Ns4integer type '%s' can only be used after compilation(tNotImplementedErrorR)(RR R!((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs(sname(R+R,R'R8RR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRks  tUnknownFloatTypecBs eZdZdZdZRS(R)cCs||_|d|_dS(NR (R)R(RR)((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8s cCstd|jdS(Ns2float type '%s' can only be used after compilation(RmR)(RR R!((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs(sname(R+R,R'R8R(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRns tBaseFunctionTypecBseZdZddZRS(targsRtellipsistabicCs||_||_||_||_g|jD]}|j^q.}|jr_|jdn|pkdg}|jdj|f}|dk r|d |d|d}n|jj j d||_ dS(Ns...tvoids, iR R ( RpRRqRrRtappendt _base_patterntjointNoneRR(RRpRRqRrtargtreprargsR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8s    "  (sargssresultsellipsissabiN(R+R,R'RwR8(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRostRawFunctionTypecBs&eZdZeZdZdZRS(s(&)(%s)cCs*ddlm}|jd|fdS(Ni(tapisPcannot render the type %r: it is a function type, not a pointer-to-function type(R R{t CDefError(RR R!R{((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs cCst|j|j|j|jS(N(tFunctionPtrTypeRpRRqRr(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pytas_function_pointers(R+R,RuRlR.RR~(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRzs R}cBs eZdZdZdZRS(s(*&)(%s)cCs|jj||}g}x*|jD]}|j|j||q%Wd}|jdkr|jsy|jjf}Wqtk rqXqnt ||dt |||j|S(Nt __stdcalltnew_function_type(( RR%RpRtRrRqt_backendt FFI_STDCALLtAttributeErrorR:R5(RR R!RRpttptabi_args((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs    cCst|j|j|j|jS(N(RzRpRRqRr(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pytas_raw_functions(R+R,RuRR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR}s t PointerTypecBs#eZdZddZdZRS(ttotypeRicCs\||_||_t|d}|jr@d|jf}n|jjd||_dS(Ns *&s(%s)R (RRRR-RRR(RRRtextra((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8s    cCs.|jj||dt}t||d|S(NR"tnew_pointer_type(RR%RlR:(RR R!tBItem((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR s(stotypesquals(R+R,R'R8R(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs cCs t|tS(N(RR(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pytConstPointerTypestNamedPointerTypecBseZdZddZRS(RR)icCs-tj|||||_|d|_dS(NR (RR8R)R(RRR)R((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8s (stotypesname(R+R,R'R8(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRst ArrayTypecBs/eZdZeZdZdZdZRS(titemtlengthcCse||_||_|dkr'd}n|dkr<d}n d|}|jjjd||_dS(Ns&[]s...s &[/*...*/]s&[%s]R (RRRwRR(RRRtbrackets((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8$s       cCst|j|S(N(RR(Rt newlength((s0/usr/lib64/python2.7/site-packages/cffi/model.pytresolve_length1scCs|jdkr8ddlm}|jd|fn|jj||t|jj||}t||d||jS(Ns...i(R{s)cannot render the type %r: unknown lengthtnew_array_type(RR R{R|RR%RR:(RR R!R{tBPtrItem((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR4s (sitemslength(R+R,R'RlR-R8RR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR s  R>tStructOrUnionOrEnumcBs/eZdZdZdZdZdZRS(R)cCs0|jpd|j|jf}|d|_dS(Ns%s %sR (t forcenametkindR)R(RR)((s0/usr/lib64/python2.7/site-packages/cffi/model.pytbuild_c_name_with_markerDscCs||_|jdS(N(RR(RR((s0/usr/lib64/python2.7/site-packages/cffi/model.pytforce_the_nameHs cCs |jd S(Ni(R(R((s0/usr/lib64/python2.7/site-packages/cffi/model.pytget_official_nameLs(snameN(R+R,R'RwRRRR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR@s   t StructOrUnioncBsweZd ZdZeZeZd dZdZ dZ dZ edZ dZ dZdZd ZRS( icCs;||_||_||_||_||_|jdS(N(R)tfldnamestfldtypest fldbitsizetfldqualsR(RR)RRRR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8Ws      cCs\|jdkrtSxBt|j|jD]+\}}|dkr)t|tr)tSq)WtS(NR (RRwRtzipRt isinstanceRRl(RR)ttype((s0/usr/lib64/python2.7/site-packages/cffi/model.pythas_anonymous_struct_fields_s "ccs|j}|dkr+dt|j}nx}t|j|j|j|D]]\}}}}|dkrt|trx-|j D] }|VqWqJ||||fVqJWdS(NiR (i( RRwtlenRRRRRRt enumfields(RRR)RtbitsizeRR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRgs   c Csg}g}g}g}xT|jD]F\}}}}|j||j||j||j|q%Wt||_t||_t||_t||_dS(N(RRtR5RRRR( RtnamesttypestbitsizesRR)RRR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt force_flattents   cCs5tj||||}|s1|j||n|S(N(RR%tfinish_backend_type(RR R!R"R#((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR%s  c Cs|jr5|jdkr1td|jfndS|j|}d|_|jdkr]nh|jdkrg|jD]}|j||^qv}tt |j ||j }d}|j rd}n|j j|||dd|ng}|j\}} } } x~tt|j D]g} | | } |j| }t|tr|jdkr|jj||}t| |j|\}}|dkr|jd|j|j | pd fn|j|}|j| |f|j| d|_n|j||}t|tr,|jdkr,nK|j|}|| krw|jd |j|j | pfd || fn|j|qWtt |j ||j |}|j j|||| | d|_dS( Nis(recursive structure declaration for '%s'iiiis...sfield '%s.%s' has a bogus size?s{}s=field '%s.%s' is declared as %d bytes, but is really %d bytes(t completedRmR)RRRwt fixedlayoutR%tlistRRRtpackedRtcomplete_struct_or_uniontrangeRRRRRtdivmodtsizeoft_verification_errorRRt(RR R!R#RRtlsttsflagstfieldofst fieldsizet totalsizettotalalignmentR?tfsizetftypet BItemTypetnlentnrestt BFieldTypet bitemsize((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs`   %     ! ! cCs ddlm}||dS(Ni(R(RR(RtmsgR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRscCsD|jr@|jdkr@ddlm}|j|jndS(Ni(R(tpartialRRwR RtVerificationMissingR(RR((s0/usr/lib64/python2.7/site-packages/cffi/model.pytcheck_not_partialscCs=|j|j|t||d|j|jd|S(Ns new_%s_typetkey(RRtR:RR(RR R!((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs  N(R+R,RwRRRRRR8RRRR%RRRR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRQs     <  t StructTypecBseZdZRS(tstruct(R+R,R(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRst UnionTypecBseZdZRS(tunion(R+R,R(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRstEnumTypecBsJeZdZeZeZddZdZdZ dZ dZ RS(tenumcCs2||_||_||_||_|jdS(N(R)t enumeratorst enumvaluest baseinttypeR(RR)RRR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR8s     cCsKtj|||jdkrG|j}d|jdd|_ndS(NR R t_(RRRRwRR(RRR)((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs cCs?|jr;|j r;ddlm}|j|jndS(Ni(R(Rtpartial_resolvedR RRR(RR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRsc CsJ|j|j||}t||d|j|j|j|d|S(Nt new_enum_typeR(Rtbuild_baseinttypeR:RRR(RR R!t base_btype((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs     cCs|jdk r"|jj||Sddlm}|jr\t|j}t|j}n-ddl}|j d|j d}}|dkrd}t d}t d} nd}t d}t d } |j||} | j||} |j | } |j | } |dd | d>krJ|dd | |>krJ| S|dd | d>kr~|dd | |>kr~| S|j d |j dS( Ni(R{is%r has no values explicitly defined; next version will refuse to guess which integer type it is meant to be (unsigned/signed, int/long)iRARBs unsigned ints unsigned longis=%s values don't all fit into either 'long' or 'unsigned long'(RRwR%R R{RtmintmaxtwarningstwarnRR<RR|(RR R!R{tsmallest_valuet largest_valueRtsignt candidate1t candidate2tbtype1tbtype2tsize1tsize2((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs:         N( R+R,RRRRRwR8RRRR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pyRs    cCsH|dkrd|}nt|ddd}|j|d|_|S(Ns$%st unknown_type(RwRRtorigin(R)t structnameR((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR%s     cCs;|dkrd|}nt|ddd}t||S(Ns$$%s(RwRR(R)RR((s0/usr/lib64/python2.7/site-packages/cffi/model.pytunknown_ptr_type-s  c Os%|jd||f}y|jj|SWnctk r=nStk rt|jtjrttj |j_qtj t |j_nXyt |j||}Wn,t k r}t d|||fnX|jj}t 2|j|} | dkr|||<|S| SWdQXdS(NRs %s: %r: %s(tpopRt __typecacheRRRRt ModuleTypetweakreftWeakValueDictionaryRR(Rmt global_locktgetRw( tsrctypeR tfuncnameRptkwdsRtrestetcachetres1((s0/usr/lib64/python2.7/site-packages/cffi/model.pyR:6s(     cCstd|d|S(Nt?R(R:(R R#((s0/usr/lib64/python2.7/site-packages/cffi/model.pyt pointer_cacheUscCsQ|jrMt|jdtkrMd||jdff|jd|_ndS(Nis%s: %si(RpRtstr(RR)((s0/usr/lib64/python2.7/site-packages/cffi/model.pytattach_exception_infoXs"((RtsysRtlockRRRRRtobjectRR/R7t void_typeR;R<RkRnRoRzR}Rt voidp_typeRtconst_voidp_typeRRRwtchar_array_typeRRRRRRRRR:RR(((s0/usr/lib64/python2.7/site-packages/cffi/model.pytsF  0  F     C