/usr/lib64/python3.9/site-packages/cffi/__pycache__
NameSizeModeActions
api.cpython-39.opt-1.pyc342910644editdlrm
api.cpython-39.pyc343260644editdlrm
backend_ctypes.cpython-39.opt-1.pyc396540644editdlrm
backend_ctypes.cpython-39.pyc399230644editdlrm
cffi_opcode.cpython-39.opt-1.pyc46910644editdlrm
cffi_opcode.cpython-39.pyc47190644editdlrm
commontypes.cpython-39.opt-1.pyc18260644editdlrm
commontypes.cpython-39.pyc18640644editdlrm
cparser.cpython-39.opt-1.pyc235720644editdlrm
cparser.cpython-39.pyc236870644editdlrm
error.cpython-39.opt-1.pyc14840644editdlrm
error.cpython-39.pyc14840644editdlrm
ffiplatform.cpython-39.opt-1.pyc35410644editdlrm
ffiplatform.cpython-39.pyc35410644editdlrm
lock.cpython-39.opt-1.pyc3810644editdlrm
lock.cpython-39.pyc3810644editdlrm
model.cpython-39.opt-1.pyc195920644editdlrm
model.cpython-39.pyc197230644editdlrm
pkgconfig.cpython-39.opt-1.pyc51190644editdlrm
pkgconfig.cpython-39.pyc51190644editdlrm
recompiler.cpython-39.opt-1.pyc464780644editdlrm
recompiler.cpython-39.pyc469180644editdlrm
setuptools_ext.cpython-39.opt-1.pyc72390644editdlrm
setuptools_ext.cpython-39.pyc72580644editdlrm
vengine_cpy.cpython-39.opt-1.pyc352310644editdlrm
vengine_cpy.cpython-39.pyc354440644editdlrm
vengine_gen.cpython-39.opt-1.pyc207330644editdlrm
vengine_gen.cpython-39.pyc209810644editdlrm
verifier.cpython-39.opt-1.pyc92710644editdlrm
verifier.cpython-39.pyc92880644editdlrm
__init__.cpython-39.opt-1.pyc4830644editdlrm
__init__.cpython-39.pyc4830644editdlrm
Edit: /usr/lib64/python3.9/site-packages/cffi/__pycache__/api.cpython-39.pyc (34326B)
a (ˆ`P¤ã@s¶ddlZddlZddlmZddlmZddlmZzeWn&e ybddl m Z dd„ZYn0ze Wne y‚e Z Yn0eƒZGd d „d eƒZd d „Zd d„Zdd„ZdS)éNé)Ú allocate_lock)Ú CDefError)Úmodel)ÚCallablecCs t|tƒS©N)Ú isinstancer)Úx©r ú./usr/lib64/python3.9/site-packages/cffi/api.pyÚ ór c@sÀeZdZdZdjdd„Zdkdd„Zdldd „Zdmd d „Zdnd d„Zdd„Z dd„Z dodd„Z dd„Z dd„Z dd„Zdd„Zdpdd„Zdqd d!„Zd"d#„Zdrd%d&„Zd'd(„Zedfd)d*„Zd+d,„Zdsd-d.„Zdtd0d1„Zdud2d3„Zd4d5„Zdvd6d7„Zd8d9„Zd:d;„Zeeedd<ƒZ dwd=d>„Z!d?d@„Z"dAdB„Z#dCdD„Z$dEdF„Z%dGdH„Z&dIdJ„Z'dKdL„Z(dMdN„Z)dOdP„Z*dQdR„Z+dxdTdU„Z,dydVdW„Z-dzdYdZ„Z.d[d\„Z/d]d^„Z0d{d`da„Z1dbdc„Z2ddde„Z3dfdg„Z4dhdi„Z5dS)|ÚFFIa’ The main top-level class that you instantiate once, or once per module. Example usage: ffi = FFI() ffi.cdef(""" int printf(const char *, ...); """) C = ffi.dlopen(None) # standard library -or- C = ffi.verify() # use a C compiler: verify the decl above is right C.printf("hello, %s!\n", ffi.new("char[]", "world")) NcCsÌ|dur^ddl}ddlm}|j|kr^t|dƒrJtd|t|j|jfƒ‚ntd|t|jfƒ‚ddlm}||_tƒ|_ |  ¡|_ i|_ t  d ¡j|_t  d ¡j|_g|_g|_g|_g|_d|_i|_d|_d|_t |¡|_t|d ƒrô| |¡t|jƒD] }| d ¡rþt ||t!||ƒƒqþ|j �,| "tj#¡|_$| "tj%¡|_&Wdƒn1�sZ0Yt'|t jƒ�r tt(d ƒ�sÀ| )|j$d¡t(_*| +¡\t(_,t(_-n | )|j$d¡|_*| +¡\|_,|_-|j.|_.dS)z{Create an FFI instance. The 'backend' argument is used to select a non-default backend, mostly for tests. Nrr)Ú __version__Ú__file__zåVersion mismatch: this is the 'cffi' package version %s, located in %r. When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r. The two versions should be equal; check your installation.zØVersion mismatch: this is the 'cffi' package version %s, located in %r. This interpreter comes with a built-in '_cffi_backend' module, which is version %s. The two versions should be equal; check your installation.)ÚcparserZ parsed_typesZ new_typesÚset_ffiZRTLD_ÚNULL)/Z _cffi_backendÚrÚhasattrÚ ExceptionrrÚ_backendrÚ_lockZParserÚ_parserÚ_cached_btypesÚtypesÚ ModuleTypeÚ__dict__Ú _parsed_typesZ _new_typesÚ_function_cachesÚ _librariesÚ _cdefsourcesÚ_included_ffisÚ_windows_unicodeÚ_init_once_cacheÚ _cdef_versionÚ _embeddingrZ get_typecacheZ _typecacherÚlistÚ startswithÚsetattrÚgetattrÚ_get_cached_btypeZ voidp_typeÚBVoidPZchar_array_typeÚBCharArrÚcastrZ _get_typesÚCDataZCTypeÚbuffer)ÚselfÚbackendrrÚnamer r r Ú__init__)sV   þ ÿ      . z FFI.__init__FcCs|j||||d�dS)a[Parse the given C source. This registers all declared functions, types, and global variables. The functions and global variables can then be accessed via either 'ffi.dlopen()' or 'ffi.verify()'. The types can be used in 'ffi.new()' and other functions. If 'packed' is specified as True, all structs declared inside this cdef are packed, i.e. laid out without any field alignment at all. Alternatively, 'pack' can be a small integer, and requests for alignment greater than that are ignored (pack=1 is equivalent to packed=True). )ÚoverrideÚpackedÚpackN)Ú_cdef)r1Úcsourcer5r6r7r r r Úcdefes zFFI.cdefcCs&|j|||dd�|jdur"d|_dS)NT)r6r7Z dllexportr)r8r&)r1r9r6r7r r r Ú embedding_apirs zFFI.embedding_apicKs¾t|tƒs&t|tƒstdƒ‚| d¡}|j�~tƒ|_|jj |fd|i|¤Ž|j   |¡|rr|j D] }|  ¡qd|jj}|rœg|j_|D]}| ||¡qŠWdƒn1s°0YdS)Nz cdef() argument must be a stringÚasciir5)rÚstrÚ basestringÚ TypeErrorÚencoderÚobjectr%rÚparser!ÚappendrÚclearZ _recompleteÚfinish_backend_type)r1r9r5ÚoptionsÚcacheÚ finishlistÚtpr r r r8ws       z FFI._cdefrcCsxt|tƒs&|dus&t||jƒs&tdƒ‚|j�8t|||ƒ\}}|j |¡|j |¡Wdƒn1sj0Y|S)aHLoad and return a dynamic library identified by 'name'. The standard C library can be loaded by passing None. Note that functions and types declared by 'ffi.cdef()' are not linked to a particular library, just like C headers; in the library we only look for the actual (untyped) symbols. NzRdlopen(name): name must be a file name, None, or an already-opened 'void *' handle) rr>r/r?rÚ_make_ffi_libraryrrCr )r1r3ÚflagsÚlibZfunction_cacher r r Údlopen‰s ÿ þ *z FFI.dlopencCst|ƒ |¡dS)z¸Close a library obtained with ffi.dlopen(). After this call, access to functions or variables from the library will fail (possibly with a segmentation fault). N)ÚtypeÚ__cffi_close__)r1rLr r r Údlclose›sz FFI.dlclosecCsj|}||jvr|j|St|tƒs,| d¡}|j |¡}|j}|rJ| ¡}| |¡}||f}||j|<|S)Nr<) rrr=r@rZ parse_typeZis_raw_functionZas_function_pointerr+)r1ÚcdeclÚkeyrNÚreally_a_function_typeÚbtypeÚresultr r r Ú_typeof_locked¢s       zFFI._typeof_lockedc Cstz|j|}WnBtyP|j�| |¡}Wdƒn1sB0YYn0|\}}|rp|sptd|fƒ‚|S)Nz>the type %r is a function type, not a pointer-to-function type)rÚKeyErrorrrVr)r1rQÚconsider_function_as_funcptrrUrTrSr r r Ú_typeof´s .ÿz FFI._typeofcCs¤t|tƒr| |¡St||jƒr,|j |¡St|tjƒrLt|ƒ}|durL|St|tj ƒr”t |dƒr”|j �|  |j ¡WdƒS1sŠ0Ytt|ƒƒ‚dS)z£Parse the C type given as a string and return the corresponding object. It can also be used on 'cdata' instance to get its C type. NÚ_cffi_base_type)rr>rYr/rÚtypeofrÚBuiltinFunctionTypeÚ_builtin_function_typeÚ FunctionTyperrr+rZr?rN)r1rQÚresr r r r[Âs      ÿ*z FFI.typeofcCs0t|tƒr | |¡}|j |¡S|j |¡SdS)zvReturn the size in bytes of the argument. It can be a string naming a C type, or a 'cdata' instance. N)rr>rYrÚsizeof)r1rQÚBTyper r r r`Õs   z FFI.sizeofcCs t|tƒr| |¡}|j |¡S)z\Return the natural alignment size in bytes of the C type given as a string. )rr>rYrÚalignof)r1rQr r r rbßs  z FFI.alignofcGs*t|tƒr| |¡}|j|g|¢RŽdS)a3Return the offset of the named field inside the given structure or array, which must be given as a C type name. You can give several field names in case of nested structures. You can also give numeric values which correspond to array items, in case of an array type. r)rr>rYÚ _typeoffsetof)r1rQÚfields_or_indexesr r r Úoffsetofçs  z FFI.offsetofcCs"t|tƒr| |¡}|j ||¡S)a¬Allocate an instance according to the specified C type and return a pointer to it. The specified C type must be either a pointer or an array: ``new('X *')`` allocates an X and returns a pointer to it, whereas ``new('X[n]')`` allocates an array of n X'es and returns an array referencing it (which works mostly like a pointer, like in C). You can also use ``new('X[]', n)`` to allocate an array of a non-constant length n. The memory is initialized following the rules of declaring a global variable in C: by default it is zero-initialized, but an explicit initializer can be given which can be used to fill all or part of the memory. When the returned object goes out of scope, the memory is freed. In other words the returned object has ownership of the value of type 'cdecl' that it points to. This means that the raw data can be used as long as this object is kept alive, but must not be used for a longer time. Be careful about that when copying the pointer to the memory somewhere else, e.g. into another structure. )rr>rYrZnewp)r1rQÚinitr r r Únewòs  zFFI.newTcs,ˆj ¡}| |||¡‰d‡‡fdd„ }|S)aÇReturn a new allocator, i.e. a function that behaves like ffi.new() but uses the provided low-level 'alloc' and 'free' functions. 'alloc' is called with the size as argument. If it returns NULL, a MemoryError is raised. 'free' is called with the result of 'alloc' as argument. Both can be either Python function or directly C functions. If 'free' is None, then no free function is called. If both 'alloc' and 'free' are None, the default is used. If 'should_clear_after_alloc' is set to False, then the memory returned by 'alloc' is assumed to be already cleared (or you are fine with garbage); otherwise CFFI will clear it. Ncst|tƒrˆ |¡}ˆ||ƒSr©rr>rY)rQrf©Z allocatorr1r r Úallocates  z#FFI.new_allocator..allocate)N)rrÚ new_allocator)r1ZallocÚfreeZshould_clear_after_allocZ compiled_ffirjr rir rk s  ÿzFFI.new_allocatorcCs"t|tƒr| |¡}|j ||¡S)zºSimilar to a C cast: returns an instance of the named C type initialized with the given 'source'. The source is casted between integers or pointers of any type. )rr>rYrr.)r1rQÚsourcer r r r.%s  zFFI.castéÿÿÿÿcCs|j ||¡S)aÃReturn a Python string (or unicode string) from the 'cdata'. If 'cdata' is a pointer or array of characters or bytes, returns the null-terminated string. The returned string extends until the first null character, or at most 'maxlen' characters. If 'cdata' is an array then 'maxlen' defaults to its length. If 'cdata' is a pointer or array of wchar_t, returns a unicode string following the same rules. If 'cdata' is a single character or byte or a wchar_t, returns it as a string or unicode string. If 'cdata' is an enum, returns the value of the enumerator as a string, or 'NUMBER' if the value is out of range. )rÚstring)r1ÚcdataÚmaxlenr r r ro.sz FFI.stringcCs|j ||¡S)aLUnpack an array of C data of the given length, returning a Python string/unicode/list. If 'cdata' is a pointer to 'char', returns a byte string. It does not stop at the first null. This is equivalent to: ffi.buffer(cdata, length)[:] If 'cdata' is a pointer to 'wchar_t', returns a unicode string. 'length' is measured in wchar_t's; it is not the size in bytes. If 'cdata' is a pointer to anything else, returns a list of 'length' items. This is a faster equivalent to: [cdata[i] for i in range(length)] )rÚunpack)r1rpÚlengthr r r rr@sz FFI.unpackcCs:|tur|j|}}nt|tƒr*| |¡}|j |||¡S)aÙReturn a cdata of the given type pointing to the data of the given Python object, which must support the buffer interface. Note that this is not meant to be used on the built-in types str or unicode (you can build 'char[]' arrays explicitly) but only on objects containing large quantities of raw data in some other format, like 'array.array' or numpy arrays. The first argument is optional and default to 'char[]'. )Ú _unspecifiedr-rr>rYrÚ from_buffer)r1rQZ python_bufferZrequire_writabler r r ru^s    ÿzFFI.from_buffercCs|j |||¡S)a_ffi.memmove(dest, src, n) copies n bytes of memory from src to dest. Like the C function memmove(), the memory areas may overlap; apart from that it behaves like the C function memcpy(). 'src' can be any cdata ptr or array, or any Python buffer object. 'dest' can be any cdata ptr or array, or a writable Python buffer object. The size to copy, 'n', is always measured in bytes. Unlike other methods, this one supports all Python buffer including byte strings and bytearrays---but it still does not support non-contiguous buffers. )rÚmemmove)r1ÚdestÚsrcÚnr r r rvpsz FFI.memmovecsB‡‡‡‡fdd„}tˆtƒr*ˆjˆdd�‰|dur6|S||ƒSdS)a�Return a callback object or a decorator making such a callback object. 'cdecl' must name a C function pointer type. The callback invokes the specified 'python_callable' (which may be provided either directly or via a decorator). Important: the callback object must be manually kept alive for as long as the callback may be invoked from the C level. cs"t|ƒstdƒ‚ˆj ˆ|ˆˆ¡S)Nz.the 'python_callable' argument is not callable)Úcallabler?rÚcallback)Úpython_callable©rQÚerrorÚonerrorr1r r Úcallback_decorator_wrapˆs  ÿz-FFI.callback..callback_decorator_wrapT)rXNrh)r1rQr|r~rr€r r}r r{€s  z FFI.callbackrcCsht|tƒr| |¡}| ¡}| d¡rBd|j |d¡vrBd|}n|rZ|ddvrZd|}|j ||¡S)a.Return a string giving the C type 'cdecl', which may be itself a string or a object. If 'replace_with' is given, it gives extra text to append (or insert for more complicated C types), like a variable name, or '*' to get actually the C type 'pointer-to-cdecl'. Ú*z&[ú&z(%s)rz[(ú )rr>rYÚstripr(rZgetcname)r1rQZ replace_withr r r Úgetctype•s   ÿ z FFI.getctypecCs|j |||¡S)a»Return a new cdata object that points to the same data. Later, when this new cdata object is garbage-collected, 'destructor(old_cdata_object)' will be called. The optional 'size' gives an estimate of the size, used to trigger the garbage collection more eagerly. So far only used on PyPy. It tells the GC that the returned object keeps alive roughly 'size' bytes of external memory. )rZgcp)r1rpZ destructorÚsizer r r Úgc¥s zFFI.gccCs`|j d¡dusJ‚z|j|}Wn8tyZg}| ||¡}|D]}| ||¡qDYn0|S)NF)rÚacquirerrWZget_cached_btyperE)r1rNrarHr r r r+±s  zFFI._get_cached_btypecKsZddlm}m}|jr | |¡|p(|ƒ}||||fi|¤Ž|_|j ¡}|j |¡|S)aÊVerify that the current ffi signatures compile on this machine, and return a dynamic library object. The dynamic library can be used to call functions and access global variables declared in this 'ffi'. The library is compiled by the C compiler: it gives you C-level API compatibility (including calling macros). This is unlike 'ffi.dlopen()', which requires binary compatibility in the signatures. r)ÚVerifierÚ_caller_dir_pycache)Úverifierr‰rŠr#Ú_apply_windows_unicodeÚ load_libraryr rC)r1rmÚtmpdirÚkwargsr‰rŠrLr r r Úverify½s     z FFI.verifycCs |j ¡Sr)rZ get_errno©r1r r r Ú _get_errnoÛszFFI._get_errnocCs|j |¡dSr)rZ set_errno)r1Úerrnor r r Ú _set_errnoÝszFFI._set_errnoz(the value of 'errno' from/to the C callscCs |j |¡Sr)rÚ getwinerror)r1Úcoder r r r•âszFFI.getwinerrorcCs6|j�t ||¡WdƒS1s(0YdSr)rrÚ pointer_cache)r1Úctyper r r Ú _pointer_toåszFFI._pointer_tocGsšz|j |¡}Wn<tyLdt|ƒjvrFt|ƒj|g|¢RŽYS‚Yn0|rj|j|g|¢RŽ\}}n|jdkr|tdƒ‚d}| |¡}|j  |||¡S)zêReturn the address of a . If 'fields_or_indexes' are given, returns the address of that field or array item in the structure or array, recursively in case of nested structures. Ú __addressof__Zpointerzaddressof(pointer)r) rr[r?rNrršrcÚkindr™Z rawaddressof)r1rprdr˜ÚoffsetZctypeptrr r r Ú addressofés   z FFI.addressofcGs@|j ||¡\}}|D] }|j ||d¡\}}||7}q||fS)Nr)rZ typeoffsetof)r1r˜Zfield_or_indexrdrœZfield1Zoffset1r r r rcþs  zFFI._typeoffsetofc Cs¾t|tƒstdt|ƒjfƒ‚||ur.tdƒ‚|j�v|j�P|j |j¡|j   d¡|j   |j ¡|j   d¡|j   |¡Wdƒn1s’0YWdƒn1s°0YdS)aÉIncludes the typedefs, structs, unions and enums defined in another FFI instance. Usage is similar to a #include in C, where a part of the program might include types defined in another part for its own usage. Note that the include() method has no effect on functions, constants and global variables, which must anyway be accessed directly from the lib object returned by the original FFI instance. zGffi.include() expects an argument that is also of type cffi.FFI, not %rzself.include(self)ú[ú]N) rrr?rNÚ__name__Ú ValueErrorrrÚincluder!rCÚextendr")r1Zffi_to_includer r r r¢s ÿÿ  z FFI.includecCs|j |j|¡Sr)rZ newp_handler,©r1r r r r Ú new_handleszFFI.new_handlecCs |j |¡Sr)rÚ from_handler¤r r r r¦szFFI.from_handlecCs|j |¡dSr)rÚreleaser¤r r r r§"sz FFI.releasecCs>|jdurtdƒ‚t|ƒ}|r*| d¡n | d¡||_dS)acWindows: if 'enabled_flag' is True, enable the UNICODE and _UNICODE defines in C, and declare the types like TCHAR and LPTCSTR to be (pointers to) wchar_t. If 'enabled_flag' is False, declare these types to be (pointers to) plain 8-bit characters. This is mostly for backward compatibility; you usually want True. Nz%set_unicode() can only be called oncezÄtypedef wchar_t TBYTE;typedef wchar_t TCHAR;typedef const wchar_t *LPCTSTR;typedef const wchar_t *PCTSTR;typedef wchar_t *LPTSTR;typedef wchar_t *PTSTR;typedef TBYTE *PTBYTE;typedef TCHAR *PTCHAR;z²typedef char TBYTE;typedef char TCHAR;typedef const char *LPCTSTR;typedef const char *PCTSTR;typedef char *LPTSTR;typedef char *PTSTR;typedef TBYTE *PTBYTE;typedef TCHAR *PTCHAR;)r#r¡Úboolr:)r1Z enabled_flagr r r Ú set_unicode%s  zFFI.set_unicodecCs>| dd¡}t|ttfƒs"tdƒ‚t|ƒddg}||d<dS)NZ define_macrosr z''define_macros' must be a list or tuple)ÚUNICODEÚ1)Z_UNICODEr«)Úgetrr'Útupler?)r1ÚkwdsZ defmacrosr r r rŒCs ÿzFFI._apply_windows_unicodecsp‡fdd„}dtjvr®ddl}tjdkrVd tj¡}ttdƒrŠ|d|j tj d ¡ƒn4tjd krfd }nd }ttdƒrŠ|d|j tj d ¡ƒttdƒr¬|d|j tj dd¡ƒnžtjdkrÐd}ttdƒrÎ|d7}nJz ddl }Wnt yúddl m }Yn0d}|  d¡�r||  d¡7}|tjd?tjd?d@f}ttdƒ�rL|tj7}|d|ƒtjdk�rl|ddƒdS)Ncs"ˆ |g¡}||vr| |¡dSr)Ú setdefaultrC)rRÚvalueZlst©r®r r ÚensureMs z(FFI._apply_embedding_fix..ensureZ__pypy__rÚwin32zpython{0[0]}{0[1]}ÚprefixZ library_dirsZlibs©ézpypy-czpypy3-cÚbinZpypyZgoalz python%d%dZgettotalrefcountZ_d)Ú sysconfigz python%d.%dZ DEBUG_EXTéééÿÚabiflagsZ librariesZextra_link_argsz /MANIFEST)ÚsysÚbuiltin_module_namesÚosÚplatformÚformatÚ version_inforÚpathÚjoinr´r¸Ú ImportErrorZ distutilsZget_config_varÚ hexversionr¼)r1r®r²r¿Z pythonlibÚtemplater¸r r±r Ú_apply_embedding_fixKsB              ÿ    zFFI._apply_embedding_fixú.ccKsdddl}t|dƒrtdƒ‚t|tƒs,tdƒ‚|j|vsF|jrN|j|vrNtdƒ‚t|ƒ|||f|_ dS)NrÚ_assigned_sourcez:set_source() cannot be called several times per ffi objectz'module_name' must be a stringzY'module_name' must not contain '/': use a dotted name to make a 'package.module' location) r¿rr¡rr>r?ÚsepÚaltsepr=rÊ)r1Ú module_namermÚsource_extensionr®r¿r r r Ú set_source}s  ÿzFFI.set_sourcecKsNddlm}t|tƒstdƒ‚| |¡}| ||¡|j|||fi|¤ŽdS)Nr)Ú pkgconfigz;the pkgconfig_libs argument must be a list of package names)rrÐrr'r?Zflags_from_pkgconfigZ merge_flagsrÏ)r1rÍZpkgconfig_libsrmrÎr®rÐZkwds2r r r Úset_source_pkgconfigŠs     zFFI.set_source_pkgconfigÚbuildc CsÄddlm}ddlm}t|dƒs>t|dƒr6|j ¡Stdƒ‚|j\}}}}|dur\t dƒ‚||ƒ||||f|||d d œ|¤Ž\} } |rÀ| r¨t j   d | j df¡nt j   d | j df¡| S) Nr)Úmkpathr©Ú recompilerÊr‹z8set_source() must be called before distutils_extension()zadistutils_extension() is only for C extension modules, not for dlopen()-style pure Python modulesF)rŽZextradirrÎÚcall_c_compilerzregenerated: %r znot modified: %r )Zdistutils.dir_utilrÓÚ recompilerrÕrr‹Z get_extensionr¡rÊr?r½ÚstderrÚwriteZsources) r1rŽÚverboserÓrÕrÍrmrÎr®ÚextÚupdatedr r r Údistutils_extension”s0     ÿýý zFFI.distutils_extensioncCsZddlm}t|dƒstdƒ‚|j\}}}}|durr z+FFI.embedding_init_code..Z cffi_initÚexec) r&r¡ÚreÚmatchÚendÚ splitlinesÚgroupÚrangeÚlenÚrstripr(rÄrè)r1ZpysourcerórôÚlinesr´rîr rïr Úembedding_init_codeñs$    zFFI.embedding_init_codecOs tdƒ‚dS)Nz:ffi.def_extern() is only available on API-mode FFI objects)r¡)r1Úargsr®r r r Ú def_extern szFFI.def_externcCs”g}g}g}|jjD]\}| d¡r6| |dd…¡q| d¡rT| |dd…¡q| d¡r| |dd…¡q| ¡| ¡| ¡|||fS)z¹Returns the user type names known to this FFI instance. This returns a tuple containing three lists of names: (typedef_names, names_of_structs, names_of_unions) ztypedef éNzstruct ézunion é)rÚ _declarationsr(rCÚsort)r1ZtypedefsZstructsZunionsrRr r r Ú list_typess    zFFI.list_types)N)FFN)FN)F)r)F)N)NNT)rn)NNN)r)r)rN)rn)rÉ)rÉ)rÒT)rårNN)6r Ú __module__Ú __qualname__Ú__doc__r4r:r;r8rMrPrVrYr[r`rbrergrkr.rorrrtrurvr{r…r‡r+r�r’r”Úpropertyr“r•r™r�rcr¢r¥r¦r§r©rŒrÈrÏrÑrÝrãrärèrërürþrr r r r rsp <      ÿ  ÿ     ÿ 2 ÿ   rc Csüddl}t|tƒs4tjdks$|dur0| ||¡Sd}d}d|vsRd|vsR|j|vrŠz| ||¡WStyˆ}z|}WYd}~n d}~00ddl}|j   |¡}|durð|dkrÊtjdkrÊtj dkrÊtdƒ‚d|f}|durèd ||f}t|ƒ‚| ||¡S) Nrr³Úcråú/rµzXdlopen(None) cannot work on Windows for Python 3 (see http://bugs.python.org/issue23606)zGctypes.util.find_library() did not manage to locate a library called %rz%s. Additionally, %s) r¿rr>r½rÀr�rËÚOSErrorZ ctypes.utilÚutilZ find_libraryrÂ) r2r3rKr¿Z first_errorÚeZctypesrÃÚmsgr r r Ú_load_backend_lib$s.   ÿ rc sˆ j}t|||ƒ‰ ‡ ‡ ‡ fdd„‰‡‡ ‡ fdd„‰‡‡ ‡ fdd„‰dd„‰‡ ‡ fd d „‰i‰d g‰i‰‡‡‡‡‡‡‡ ‡ fd d „‰ ‡‡‡ ‡ ‡ fdd„‰ G‡‡‡‡ ‡ ‡ ‡ ‡ fdd„dtƒ‰t|tƒröz"t|tƒsÖ| d¡}d|ˆ_WntyôYn0ˆƒ‰ ˆ ˆ j fS)Ncs<d|}ˆjj|\}}ˆ |¡}ˆ ||¡}|ˆj|<dS)Nz function )rrr+Ú load_functionr)r3rRrIÚ_rar°)Ú backendlibÚffiÚlibraryr r Úaccessor_functionBs   z,_make_ffi_library..accessor_functioncs\dˆ}ˆjj|\}}ˆ |¡‰ˆj‰ˆj‰tˆˆt‡‡‡fdd„‡‡‡fdd„ƒƒdS)Nú variable cs ˆˆˆƒSrr r‘)rar3Ú read_variabler r r Pr z>_make_ffi_library..accessor_variable..cs ˆˆˆ|ƒSrr )r1r°)rar3Úwrite_variabler r r Qr )rrr+rrr)r)r3rRrIr)Ú FFILibraryrr)rar3rrr Úaccessor_variableIs þz,_make_ffi_library..accessor_variablec s¤z ˆ|WStyžˆj�d|ˆvrtd|}ˆjj|\}}ˆ |¡}|jdkr`t ˆ|¡}ˆ ||¡}|ˆ|<Wdƒn1sˆ0Yˆ|YS0dS)NrZarray) rWrrrr+r›rr—r)r3rRrIrraÚp)Úaddr_variablesrrr r Ú addressof_varSs      &z(_make_ffi_library..addressof_varcSstd|fƒ‚dS)NzDnon-integer constant '%s' cannot be accessed from a dlopen() library)ÚNotImplementedError©r3r r r Úaccessor_constantbsÿz,_make_ffi_library..accessor_constantcsˆjj|ˆj|<dSr)rÚ_int_constantsrr)rrr r Úaccessor_int_constantfsz0_make_ffi_library..accessor_int_constantFcsÔˆdˆjurdSˆjj ¡D]Œ\}\}}t|tjƒs|| dd¡\}}|dkrXˆˆ|<qª|dkrjˆˆ|<qª|dkrªˆˆ|<qt|j ƒD]"\}}||f‡fdd„ }|ˆ|<q†qˆjj D]}ˆ  |ˆ¡q´ˆjˆd<dS) NrrƒrÚfunctionÚvariableZconstantcs| ¡|j|ˆj|<dSr)Zcheck_not_partialZ enumvaluesr)r3rIrð)rr r Ú accessor_enum|szB_make_ffi_library..update_accessors..accessor_enum) r%rrÚitemsrrZEnumTypeÚsplitÚ enumerateZ enumeratorsr!r¯)rRrIrrêr3rðZenumnamer%)r rr"rÚ accessorsÚaccessors_versionrrr r Úupdate_accessorsms"      z+_make_ffi_library..update_accessorscsxˆj�^|ˆjvs|ˆjvr,WdƒdS|ˆvrJˆƒ|ˆvrJt|ƒ‚ˆ||ƒWdƒn1sj0YdSr)rrÚAttributeErrorr)rr)rrr+r r Ú make_accessor„sz(_make_ffi_library..make_accessorcsReZdZ‡fdd„Z‡fdd„Z‡‡‡fdd„Z‡‡‡‡fdd„Z‡fd d „Zd S) z%_make_ffi_library..FFILibrarycsˆ|ƒt||ƒSr)r*©r1r3©r-r r Ú __getattr__�sz1_make_ffi_library..FFILibrary.__getattr__csHzt|j|ƒ}Wn&ty6ˆ|ƒt|||ƒYn0| ||¡dSr)r*Ú __class__r,r)Ú__set__)r1r3r°rr/r r Ú __setattr__’s  z1_make_ffi_library..FFILibrary.__setattr__cs8ˆj�ˆƒˆ ¡WdƒS1s*0YdSr)rÚkeysr‘)r)rr+r r Ú__dir__šsz-_make_ffi_library..FFILibrary.__dir__csf|ˆjvrˆj|S|ˆjvr&ˆ|ƒSˆ|ƒ|ˆjvrBˆj|S|ˆjvrTˆ|ƒStd|fƒ‚dS)Nz:cffi library has no function or global variable named '%s')rr,r.)rrrr-r r ršžs      ÿz3_make_ffi_library..FFILibrary.__addressof__csˆ ¡|j ¡dSr)Z close_librrDr‘)rr r rOªsz4_make_ffi_library..FFILibrary.__cffi_close__N)r rrr0r3r5ršrOr )rr)rrrrr-r+r r rŽs    rzutf-8z FFILibrary_%s) rrrArr>r=r@r Ú UnicodeErrorr)rZlibnamerKr2r )rr rr"rr)r*rrrrrr-r+r rJ>s,   "    rJc Cs|ddl}z$|j|j}|j}|j}||}WntttfyFYdS0|j�|  |¡WdƒS1sn0YdS)Nr) r½ÚmodulesrZ_cffi_original_ffiZ_cffi_types_of_builtin_funcsrWr,r?rr+)rér½ÚmodulerZtypes_of_builtin_funcsrIr r r r]¸s  r])r½rÚlockrr~rrrrzÚ NameErrorÚ collectionsrr>r=rArtrrrJr]r r r r Ús.       z