_e[c @sddlZddlZddlZddlmZmZddlmZddlTdZ dZ dZ d fd YZ d fd YZ d fdYZdfdYZdfdYZdfdYZejdfkrejZndejfdYZdZedZedZdZdZdZdZdZd ee d!e de e d"Z!d#Z"dS($iNi(t ffiplatformtmodel(tVerificationError(t*i&i'i(t GlobalExprcBs)eZdddZdZdZRS(icCs1||_||_||_||_||_dS(N(tnametaddressttype_optsizet check_value(tselfRRRRR ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt__init__ s     cCs&d|j|j|jj|jfS(Ns' { "%s", (void *)%s, %s, (void *)%s },(RRRt as_c_exprR(R ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR scCs d|jj|j|jfS(Ns b'%s%s',%d(Rtas_python_bytesRR (R ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pytas_python_exprs(t__name__t __module__R R R(((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR s t FieldExprcBs,eZdZdZdZdZRS(cCs1||_||_||_||_||_dS(N(Rt field_offsett field_sizetfbitsizet field_type_op(R RRRRR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR s     cCsOdt|j}d|j|jfd||jfd||jjfS(Nt s { "%s", %s, s %s %s, s %s %s },(tlenRRRRR (R tspaces((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR #s$cCs tdS(N(tNotImplementedError(R ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR)scCsb|jjtkrd}n*|jjtkr?t|j}ntd|jj||jfS(Nts b'%s%s%s'( RtoptOP_NOOPt OP_BITFIELDtformat_four_bytesRRR R(R t size_expr((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pytas_field_python_expr,s (RRR R RR (((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRs   tStructUnionExprcBs#eZdZdZdZRS(c CsL||_||_||_||_||_||_||_||_dS(N(Rt type_indextflagsRt alignmenttcommenttfirst_field_indextc_fields( R RR"R#RR$R%R&R'((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR 8s       cCsfd|j|j|jfd|j|jfd|jt|jf|jr]d|jnddS(Ns { "%s", %d, %s,s %s, %s, s%d, %d s /* %s */ Rs},( RR"R#RR$R&RR'R%(R ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR CscCsct|jt}g|jD]}|j^q}dt|jt||jdj|fS(Ns(b'%s%s%s',%s)t,( tevalR#tG_FLAGSR'R RR"Rtjoin(R R#tc_fieldt fields_expr((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRJs  (RRR R R(((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR!7s tEnumExprcBs#eZdZdZdZRS(cCs1||_||_||_||_||_dS(N(RR"Rtsignedtallenums(R RR"RR/R0((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR Us     cCs&d|j|j|j|j|jfS(Ns1 { "%s", %d, _cffi_prim_int(%s, %s), "%s" },(RR"RR/R0(R ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR \s cCswitd6td6td 6td 6td 6td 6td 6td6|j|j f}dt |j t ||j |j fS(Niiiiisb'%s%s%s\x00%s'(ii(ii(ii(ii(ii(ii(ii(ii(t PRIM_UINT8t PRIM_INT8t PRIM_UINT16t PRIM_INT16t PRIM_UINT32t PRIM_INT32t PRIM_UINT64t PRIM_INT64RR/RR"RR0(R t prim_index((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRas (RRR R R(((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR.Ts  t TypenameExprcBs#eZdZdZdZRS(cCs||_||_dS(N(RR"(R RR"((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR ms cCsd|j|jfS(Ns { "%s", %d },(RR"(R ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR qscCsdt|j|jfS(Nsb'%s%s'(RR"R(R ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRts(RRR R R(((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR:ls  t RecompilercBseZdZedZdZdZdZdZdddd d gZ d Z d d Z dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Z dNd#Z"d$Z#d%Z$d&Z%e%Z&d'Z'd(Z(e(Z)d)Z*e*Z+d*Z,d+Z-d,Z.dNd-dNd.Z/d/Z0d0Z1d1Z2d2Z3dNd3Z4d4Z5d5Z6d6Z7d7Z8d8Z9d9Z:d:Z;d;Z<d<Z=d=Z>e>Z?Z@d>ZAd?ZBd@ZCdAZDdBZEeEZFZGdCZHdDZIdEZJdFZKdGZLdHZMdIZNeNZOeNZPdJZQdKZRdLZSeSZTdMZURS(OicCs(||_||_||_t|_dS(N(tffit module_namettarget_is_pythont VERSION_BASEt_version(R R<R=R>((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR ~s   cCst|j||_dS(N(tmaxR@(R tver((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt needs_versionsc Csi|_|jdt|jdt}g|_x|D]}|jr;|j|dksctt|j|j|<|jj |x|j D]u}t |t j t jt jt jt jfst|j|dkrt|j|j|scSs|jS(N(R(RH((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRIst_emit_bytecode_(t _typesdictt _generatetsortedtstrt cffi_typestis_raw_functiontNonetAssertionErrorRtappendtargst isinstanceRtVoidTypetBasePrimitiveTypet PointerTypetStructOrUnionOrEnumtFunctionPtrTypet is_array_typetlengthtvaluest_struct_unionst_enumst StructOrUniontEnumTypet enumeratetgetattrt __class__RtCffiOpttuple(R t all_declsRHttp1titmethodR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pytcollect_type_tablesZ           cCs6t|tjsFt|trBx|D]}|j|q(WndS||jkr2d|j|RQRRtwrite_py_source_to_ftwrite_c_source_to_f(R tftpreamble((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pytwrite_source_to_f s  cCsDttjjtjjt|d}|j}|j|S(Ntr(topentostpathR+tdirnamet__file__t readlinestclose(R tfilenametgtlines((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_rel_readliness*  cCs||_|j}|jjdk r1|dn|jd}|jd}|jd|||d+|dj||jj dd}|jjdk r|d |jf|d |j |jj|d |d |d |f|d|d|f|d|d|f|d|jd}|jd}|jd|||d+|dj||j t n|d|||||d||dt g|jjD]\}}||f^q}xct|jD]R\}} d} ||krKd||j} n|d|| j| fqW|js|dn|d|t|_|jdi} x|jD]|} |j| } t| | | <| | dkr|d| | fx| D]}||jq W|d|qqW|jjr|dx|jjD]v}y|jd \}}Wn*tk rtd!|j|fnX|dkrtd"n|d#|fq_W|d$|d|n|d%|d&x@|jD]5} | | dkr<|d'| q|d(| qWx8|jD]-} | d)krX|d*| | | fqXqXW|jjr|d+n |d,|d-t|jfd}|jr|dO}n|d.||d||d/|d0|d||d |d1|d2|f|d3|jr|d4|d5|d6n|d7|j|d8|d9|d:|d|d;|d<|d=|d>|d?|f|d@|dA|f|dB|dB|d|d1|dC|f|d3|dD|j|jf|d;|d|d1|dE|f|d3|dF|j|jf|d;|d||d/|dG|dd|_dS(HNs#define _CFFI_USE_EMBEDDINGs_cffi_include.hs#include "parse_c_type.h" sparse_c_type.hiRt.is#define _CFFI_MODULE_NAME "%s"s1static const char _CFFI_PYTHON_STARTUP_CODE[] = {s0 };s#ifdef PYPY_VERSIONs5# define _CFFI_PYTHON_STARTUP_FUNC _cffi_pypyinit_%ss#elif PY_MAJOR_VERSION >= 3s-# define _CFFI_PYTHON_STARTUP_FUNC PyInit_%ss#elses*# define _CFFI_PYTHON_STARTUP_FUNC init%ss#endifs _embedding.hs#include "_cffi_errors.h" s_cffi_errors.hs>/************************************************************/sstatic void *_cffi_types[] = {s // s/* %2d */ %s,%ss 0s};tdeclis.static const struct _cffi_%s_s _cffi_%ss[] = {s.static const char * const _cffi_includes[] = {isQffi object %r includes %r, but the latter has not been prepared with set_source()sMnot implemented yet: ffi.include() of a Python-based ffi inside a C-based ffis "%s",s NULLs?static const struct _cffi_type_context_s _cffi_type_context = {s _cffi_types,s _cffi_%ss,s NULL, /* no %ss */Rs %d, /* num_%ss */s _cffi_includes,s NULL, /* no includes */s %d, /* num_types */s %d, /* flags */s#ifdef __GNUC__s?# pragma GCC visibility push(default) /* for -fvisibility= */tPyMODINIT_FUNCs"_cffi_pypyinit_%s(const void *p[])t{s% if (((intptr_t)p[0]) >= 0x0A03) {sQ _cffi_call_python_org = (void(*)(struct _cffi_externpy_s *, char *))p[1];s }s p[0] = (const void *)0x%x;s p[1] = &_cffi_type_context;s#if PY_MAJOR_VERSION >= 3s return NULL;t}s# ifdef _MSC_VERs PyMODINIT_FUNCs# if PY_MAJOR_VERSION >= 3s% PyInit_%s(void) { return NULL; }s# elses init%s(void) { }s# endifsPyInit_%s(void)s5 return _cffi_init("%s", 0x%x, &_cffi_type_context);s init%s(void)s. _cffi_init("%s", 0x%x, &_cffi_type_context);s# pragma GCC visibility pop( RRR<t _embeddingRQRtindexR+R=Rzt_print_string_literal_in_arrayRCtVERSION_EMBEDDEDtdictRKRyRbROt _get_c_nameR Rt_seen_constantsRLRRRt_included_ffist_assigned_sourceR{Rt _num_externpyR@(R RRtprntRRitbase_module_nameRHttypeindex2typeRR%tnumsRRRtffi_to_includetincluded_module_nametincluded_sourceR#((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRs                4 !                                                          cCst|trd|fSt|ttfrg|D]}|j|^q6}t|dkrs|jdnddj|fS|jS(Nsb'%s'iRs(%s)R(( RURNtlistRft_to_pyRRSR+R(R Rutitemtrep((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRs "cCsN||_|j}|d|dt|jjp8d}xt|D]}|jj|}y|jd \}}Wn*tk rtd|j|fnX|dk rtdn|d||fqKW||d|j f|d|j fd|_ t |j |_ g|j D]}|j^q,} |d |jd j| ftg|jjD]\} }|| f^qz} x\|jD]Q} |j| } t| d kr| d kr|d | |j| fqqW|d kr@|ddjgt|D]}d|^qfn|ddS(Ns# auto-generated filesimport _cffi_backendisQffi object %r includes %r, but the latter has not been prepared with set_source()sMnot implemented yet: ffi.include() of a C-based ffi inside a Python-based ffisfrom %s import ffi as _ffi%dsffi = _cffi_backend.FFI('%s',s _version = 0x%x,s _types = %s,RiRs _%ss = %s,s _includes = (%s,),s, s_ffi%dt)((RRRR<RtrangeRR{RRQR=R@RfROR RR+RRKRyRR(R RRt num_includesRiRRRRt types_lstRHRRR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRsB        "#4 $ 4cCs |j|S(N(RK(R ttype((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt _gettypenumsc Csd}t|tjr|j r|jrV|jdkrVd}d|j}nut|tjrd|jdf}nJ|jd}d||jjddf}|dkr|j t nd }nt|tj r|j ||||dSt|tj s$t|tjr\|jd ||j||f|jd |dSt|tjrd|jd}d|j|}d}n t||jd||||f|jd||jd|f|jd |dS(NRt_Boolt_cffi_to_c_ints, %ss(%s)_cffi_to_c_doubles(%s)_cffi_to_c_%sRRwtchar16_ttchar32_ts-1s6 if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)s %s;s(%s)_cffi_to_c_pointers, _cffi_type(%d)tNULLs %s = %s(%s%s);s' if (%s == (%s)%s && PyErr_Occurred())(RR(RURRWtis_complex_typetis_integer_typeRtUnknownFloatTypet get_c_nametreplaceRCtVERSION_CHAR16CHAR32RXt"_convert_funcarg_to_c_ptr_or_arrayRYRRRZR( R RHtfromvarttovarterrcodetextraargt convertertcnameterrvalue((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_convert_funcarg_to_cs@        cCs&t|tjr"|jdndS(NsPy_ssize_t datasize(RURRXtadd(R RHt localvars((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_extra_local_variables3scCs|jd|jd|j|||f|jd|jd|jd||jd||jdf|jd|f|jd ||j||f|jd||jd dS( Ns1 datasize = _cffi_prepare_pointer_call_argument(s( _cffi_type(%d), %s, (char **)&%s);s if (datasize != 0) {s if (datasize < 0)s %s;s& %s = (%s)alloca((size_t)datasize);Rs, memset((void *)%s, 0, (size_t)datasize);sL if (_cffi_convert_array_from_object((char *)%s, _cffi_type(%d), %s) < 0)s }(RRR(R RHRRR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR7s      cCst|tjr|jr>|jdkr>d||jfSt|tjr[d|fS|jdkr|j r|jjdd}|dkr|jt nd ||fSd ||j |fSnt|tj tj frd ||j |fSt|tj r7d ||j tj |jfSt|tjr|jdkrwtd |j|fnd ||j |fSt|tjrd ||j |fSt|dS(NRs_cffi_from_c_int(%s, %s)s_cffi_from_c_double(%s)s long doubleRRwRRs_cffi_from_c_%s(%s)s/_cffi_from_c_deref((char *)&%s, _cffi_type(%d))s0_cffi_from_c_pointer((char *)%s, _cffi_type(%d))s!'%s' is used as %s, but is opaques0_cffi_from_c_struct((char *)&%s, _cffi_type(%d))(schar16_tschar32_t(RURRWRRRRRRCRRRXRZt ArrayTypeRR`tfldnamesRQt TypeErrorRRaR(R RHtvartcontextR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_convert_expr_from_cGs8   cCs|j|d|fS(Ns (*(%s *)0)(t _global_type(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt _typedef_typejscCs|j|j||dS(N(RmR(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt!_generate_cpy_typedef_collecttypemscCsdS(N((R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_typedef_declpscCs.|j|}|jdjt||dS(NR(RKRRSR:(R RHRR"((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt _typedef_ctxss cCs|j||}|j||t|dddkrV|j||jddn=t|tjr|j|j |j jd|jd|ndS(Ntorigint unknown_typet approxnamet named_ptr( RRRcRQt _struct_ctxRRURtNamedPointerTypettotype(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_typedef_ctxws!cCs:|j|j|jr6|j r6|j|ndS(N(RmRntellipsisR>(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt"_generate_cpy_function_collecttypesc Cs|j stt|tjs(t|jrE|j||dS|j}t|j }|dkrrd}n|dkrd}nd}g}g}d|}xKt |j D]:\} } |j | j d| ||j d| qWd j |} | p d } |jr%|jd } nd } d | || f} |d|jj | f|dd j |}d}t|jtjrd }n|d|||f|d|d|d|d||f|dd|}xAt |j D]0\} } | j d| |}|d|qWt}x!|j D]} |j| |qLWx|D]}|d|fqmWt|jtjsd}d|}d|jj d|}||n d}d }t|j dkrtt|j }x|D]} |d| qW||d|t|t|d j g|D]} d| ^qWf|dn|xBt |j D]1\} } |j| d| d| d|qW|d |d!gtt|j D]} d| ^q}d j |}|d"|||f|d#|d$||d%|dkrr|d&n|r|d'|j|jd(d)n|d*|d+|d|d,d-}t}g}g}d|}x~t |j D]m\} } d }|| r%d.}t}n| j d/|| f|}|j ||j d0|| fqW|j}||rd|}|j d1|}|jd|tj}d}d2}t}n|ryd j |} | pd } d3| || f} |d|j | f|d|r3||nd j |}|d"|||f|rl|d4n|dn|d5||f|d6|dS(7Nitnoargitarg0RTsargument of %ss x%dsx%ds, tvoidRRs%s_cffi_d_%s(%s)s static %sRsreturn s %s%s(%s);Rs#ifndef PYPY_VERSIONsstatic PyObject *s(_cffi_f_%s(PyObject *self, PyObject *%s)s %s;s result = s result of %ss results PyObject *arg%d;s1 if (!PyArg_UnpackTuple(args, "%s", %d, %d, %s))s&arg%ds return NULL;sarg%ds return NULLs Py_BEGIN_ALLOW_THREADSs _cffi_restore_errno();s { %s%s(%s); }s _cffi_save_errno();s Py_END_ALLOW_THREADSs (void)self; /* unused */s (void)noarg; /* unused */s return %s;tresults result types Py_INCREF(Py_None);s return Py_None;s#elsecSs.t|tjp-t|tjo-|jS(N(RURR`t PrimitiveTypeR(R((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pytneed_indirectionsRs %sx%ds%sx%ds *results *result = s%s_cffi_f_%s(%s)s return result;s# define _cffi_f_%s _cffi_d_%ss#endif(R>RRRURRZRt_generate_cpy_constant_declRRRTRbRSRR+tabiRRVRRRQRRRtFalsetTruetinsertt void_type(R RHRRtnumargstargnamet argumentstcall_argumentsRRiRtrepr_argumentsRtname_and_argumentst result_codetargRRt result_decltrngRt differencet indirectiont tp_result((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_function_decls                     +    ,                           cCs|jr'|j r'|j||dS|j|j}t|j}|jr[t}n0|dkrpt}n|dkrt }nt }|j dj t |d|t||dd|dS(NiiRs _cffi_f_%sRs _cffi_d_%s(RR>t_generate_cpy_constant_ctxRKRnRRTtOP_DLOPEN_FUNCtOP_CPYTHON_BLTN_NtOP_CPYTHON_BLTN_OtOP_CPYTHON_BLTN_VRRSRRe(R RHRR"Rt meth_kind((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_function_ctx#s         cCs~t|tjrz|j}|dkrI|jd}d||f}n|j|d||j}tj||}n|S(Ns...Rs_cffi_array_len(((%s)0)->%s)s%s[0](RURRR\RRsR(R t tp_structt field_namettp_fieldt actual_lengthtptr_struct_namettp_item((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRs9s   cCsA|j||jr=x$|jD]}|j|q#WndS(N(RmR>tanonymous_struct_fieldst_struct_collecttype(R RHtfldtype((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyREs  c Cs|jdkrdS|j}d|f}|d|d||f|d|d|dx|jD]\}}}} y|js|dkr|d|||fwrnxGt|tjr|jdks|jd kr|j }|d }qW|d |j d d |d| |fWqrt k rZ} |dt | qrXqrW|d|d||f|dS(Ns_cffi_checkfld_%st_CFFI_UNUSED_FNsstatic void %s(%s *p)Rs8 /* only to generate compile-time warnings or errors */s (void)p;is> (void)((p->%s) | 0); /* check that '%s.%s' is an integer */s...s[0]s { %s = &p->%s; (void)tmp; }s*tmpsfield %rRs /* %s */Rs(struct _cffi_align_%s { char x; %s y; };( RoRQRRrRRURRR\RRRRN( R RHRRRt checkfuncnametfnametftypeRtfqualR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt _struct_declLs6        c Cs|j|}d}g}t|tjr;|jdn|jdkr`|jdd}n||jjj kr|dks||jjj kr|jdkrn+|j st |j rn |jd|j r|jdqn|jdd}dj|pd }g}|dkr;|j } t|j| } x`| D]X\} } } }|j|| | } |j| d |j| ft}| d krt}d | }nd|dkst| tjr| jdkrd }n.d|dkr |jdn|j| f}|dks4| d kr=d }n;|dk r_d|j| f}nd|jd| f}|jt| ||| t||j| qOWt|jd}|jdj||dkrd}d}d}qS|dk rd|jf}d}nd|f}d|f}d}nd }d}d}|}|jdjt|j||||||||j j!|dS(Nt _CFFI_F_UNIONt_CFFI_F_OPAQUEtopaquet_CFFI_F_CHECK_FIELDSt_CFFI_F_PACKEDt_CFFI_F_EXTERNALtexternalt|t0s field '%s.%s'is %d /* bits */s (size_t)-1ssizeof(((%s)0)->%s)Rs"((char *)&((%s)0)->%s) - (char *)0soffsetof(%s, %s)RRs (size_t)-2itunnamedssizeof(*(%s)0)s-1 /* unknown alignment */s sizeof(%s)s"offsetof(struct _cffi_align_%s, y)iR("RKRQRURt UnionTypeRSRoR<RpRqtpartialtanyRtpackedR+R>RRrRst_check_not_opaqueRRRRR\RRReRRtextendR!RR(R RHRRRR"treason_for_not_expandingR#R'texpand_anonymous_struct_unionRrtfldnameRRR"RRtoffsetR&talignR%((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRms                          cCsZxt|tjr!|j}qWt|tjrV|jdkrVtd|ndS(Ns0%s is of an opaque type (not declared in cdef())(RURRRR`RoRQR(R RHtlocation((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR2s  !cCst|jj}|jddx|D]\}}||jkr/|jritd|fn|jjdr|jdj r|jd}nJ|jdkr|j dkrd}|j |dntd|f|j |d|q/q/WdS( NREcSs|dS(Ni((ttp_order((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRIssDinternal inconsistency: %r is partial but was not seen at this pointt$it_IO_FILEtFILEsinternal inconsistency: %r(RR^RyRRR/RRt startswithtisdigitt forcenameRRRQ(R RRHtorderR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRs % cCs|j|dS(N(R(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt _generate_cpy_struct_collecttypescCsC|jd}d|kr1||jddfS|d|fSdS(NRRRw(RR(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt _struct_namess cCs|j||j|dS(N(R#RC(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_struct_declscCs|j||j|dS(N(RRC(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_struct_ctxscCs6t|tjr%|j||n |j|dS(N(RURRat_generate_cpy_enum_collecttypeR(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt#_generate_cpy_anonymous_collecttypescCs=t|tjr"|j|n|j||d|dS(Nttypedef_(RURRat_generate_cpy_enum_declR#(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_anonymous_declscCs@t|tjr%|j||n|j||d|dS(NRH(RURRat _enum_ctxR(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_anonymous_ctxstconstcCsY||f|jkr.td||fn|jj||f|j}d||f}|r|d||d|d|f|d||f|dk r|dkrd|f}n|d |f|d n|d |d nQ|dkst|d ||d|d|jd|f|d |dS(Ns duplicate declaration of %s '%s's _cffi_%s_%ss$static int %s(unsigned long long *o)Rs int n = (%s) <= 0;sI *o = (unsigned long long)((%s) | 0); /* check that %s is an integer */is%dUs" if (!_cffi_check_int(*o, n, %s))s n |= 2;s return n;Rsstatic void %s(char *o)s *(%s)o = %s;R(RRRRRQRRR(R tis_intRRHtcategoryR Rtfuncname((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_consts2         cCs0|j}| s|jr,|j|ndS(N(RR>Rm(R RHRRN((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt"_generate_cpy_constant_collecttype&s cCs#|j}|j|||dS(N(RRQ(R RHRRN((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR+s cCs|j r(|jr(ttd}n4|jr:t}nt}|j|}t||}|jdjt |d||dS(NiRs_cffi_const_%s( R>RRetOP_CONSTANT_INTtOP_DLOPEN_CONSTt OP_CONSTANTRKRRSR(R RHRRt const_kindR"((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR/s    cCs|j|dS(N(Rm(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRF?scCs(x!|jD]}|jt|q WdS(N(t enumeratorsRQR(R RHRt enumerator((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRIBsc CsH|j|}ttd}|jr2|jnxMt|j|jD]6\}}|jdj t |d||d|qHW|dk rd|kr|j rd|}d|}nN|j |j g} |j j| }tt|j j| ddk}d j|j} |jd j t|j|||| dS( NiRs_cffi_const_%sR R;s sizeof(%s)s ((%s)-1) <= 0iR(R(RKRetOP_ENUMR>tcheck_not_partialtzipRWt enumvaluesRRSRRQtbuild_baseinttypeR<tsizeoftinttcastR+R.R( R RHRR"RRXt enumvalueRR/tbasetpR0((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRKFs"   " "  ' cCs|j||jdS(N(RKR(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_enum_ctx[scCsdS(N((R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_macro_collecttypeascCs5|dkrd}n|}|jt|d|dS(Ns...R (RQRQR(R RHRR ((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_macro_declds  cCsw|dkr4|jr+td|fnd}n|}ttd}|jdjt|d||d|dS(Ns...sGcannot use the syntax '...' in '#define %s ...' when using the ABI modeiRs_cffi_const_%sR (R>RRQReRSRRSR(R RHRR R((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_macro_ctxks    cCsit|tjre|j}|dkr7d|f}n|j|jd|}tj||}n|S(Ns...s_cffi_array_len(%s)s%s[0](RURRR\RR(R RHt global_nameRR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyR|s  cCs|j|j||dS(N(RmR(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt"_generate_cpy_variable_collecttypescCs|j}|j||}t|tjrN|jdkrN|j}d}nd}d|f}|d|j|d|j |d|d||f|d|dS( NRt&s*_cffi_var_%s(void)sstatic RRs return %s(%s);R( RRRURRR\RQRRR|(R RHRRt ampersandR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_variable_decls !      cCsh|j||}|j|}|jr1t}nt}|jdjt|d|t||dS(NRs _cffi_var_%s( RRKR>t OP_GLOBAL_VARtOP_GLOBAL_VAR_FRRSRRe(R RHRR"R((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_variable_ctxs    cCs)t|tjst|j|dS(N(RURRZRRRm(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt'_generate_cpy_extern_python_collecttypescCs|j}t|jtjr'd}n&d|}d|jjd|f}|d||d|j||f|g}d|}x@t|jD]/\}} | jd||} |j | qWd j |} | pd } d || f} |j d krd | } nd} t t |jdd}| |jr\t |d}nt|jtjrd|jjd||jjd|f}n|d||jj| f|d|d||dxt|jD]t\}} d|} t| tjs(| | rDd| } tj| } n|d| jd|d| fqW|d|t|jtjs|d|jjdfn|d||jd7_dS(NR,s result of %ss(int)sizeof(%s)Rs3static struct _cffi_externpy_s _cffi_externpy__%s =s { "%s.%s", %s };sargument of %ss a%ds, Rs%s(%s)t __stdcalls_cffi_stdcall cSst|tjo|jdkS(Ns long double(RURRR(RH((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pytmay_need_128_bitssiis!sizeof(%s) > %d ? sizeof(%s) : %ds%s%sRs char a[%s];s char *p = a;sa%dRis *(%s)(p + %d) = %s;Rs, _cffi_call_python(&_cffi_externpy__%s, p);s return *(%s)p;Ri(RRURRRVRR=RbRTRSR+RRARR`RXR(R RHRt tag_and_spaceRtsize_of_resultRRRiRRRRRqt size_of_a((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_extern_python_declsX             (  cCs|j||ddS(Nsstatic (Ru(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt _generate_cpy_extern_python_declscCs|j||ddS(NsCFFI_DLLEXPORT (Ru(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt#_generate_cpy_dllexport_python_declscCs|j||ddS(NR(Ru(R RHR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt'_generate_cpy_extern_python_plus_c_declscCsw|jrtdn|jr0tdn|j|}tt|}|jdjt |d|||dS(Ns,cannot use 'extern "Python"' in the ABI modes$a vararg function is extern "Python"Rs&_cffi_externpy__%s( R>RRRRKRetOP_EXTERN_PYTHONRRSR(R RHRR"R((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_generate_cpy_extern_python_ctxs     cCs|j}|dx|jtD]w}|d|jd}xJ|D]B}t|dkru||d}n|dt|f7}qJW||q#WdS(Ns=// # NB. this is not a string because of a size limit in MSVCs// RiLs%d,(Rt splitlinesRtrstripRtord(R tsRtlinet printed_linetc((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyRs     cCsttt|j| 0, float => 1 */ )(RReRRO(R RHRR~((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_emit_bytecode_UnknownFloatTypescCs tt|j|j|j|<|d7}xr|jD]g}|j|}||krt|tjrx|j ||qtt ||j|Ris(already up-to-date)s%s.~%dtw(R;RQRkRRRtgetvalueRtreadRtIOErrorRRtgetpidRtrenametOSErrortunlinkR( R<R=Rt target_filetverboset recompilerRtoutputtf1ttmp_file((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_make_c_or_py_sourceas4        cCs(|dk stt|||||S(N(RQRRR(R<R=Rt target_c_fileR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt make_c_source}scCst||d||S(N(RRQ(R<R=ttarget_py_fileR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pytmake_py_sourcescCsp|jd}y$tjtjj||d Wntk rFnX|dc|7td|f|jdt|t|||||}|j ||}xit |j D]X} | j dst |j | } | t || tk rt|| | qqqWd} | |_xJt |D]<} | j d r t|j |  r t|| tq q W|jS(Ni(tudirsmodule name conflict: %rRRwc_s tdS(N(R(RTR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyttypeof_disableds(t testing.udirRtimpRtmodulesRRt setdefaultRNRt load_dynamictdirR<R>RctobjectRt_typeofthasattrtNotImplementedtlib( R<R=RRTRRRRtmoduleRtattrR((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyt_verifys$    #(#RRtioRRRterrorRt cffi_opcodeR?RRRRR!R.R:R;t version_infotStringIORtBytesIORRRRRRRRRRRQRR(((s//tmp/pip-install-KP2Jbq/cffi/cffi/recompiler.pyts>$           <