Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 AøªjP¤ã@sºddlZddlZddlmZddlmZddlmZyeWn(e k rdddl m Z dd„ZYnXye Wne k r†e Z YnXeƒZGd d „d eƒZd d „Zd d„Zdd„ZdS)éNé)Ú allocate_lock)Ú CDefError)Úmodel)ÚCallablecCs t|tƒS)N)Ú isinstancer)Úx©r ú(/tmp/pip-build-_d5lkt3n/cffi/cffi/api.pyÚ sr 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#„Zdsd%d&„Zd'd(„Zedfd)d*„Zd+d,„Zdtd-d.„Zdud0d1„Zdvd2d3„Zd4d5„Zdwd6d7„Zd8d9„Zd:d;„Zeeedd<ƒZ dyd=d>„Z!d?d@„Z"dAdB„Z#dCdD„Z$dEdF„Z%dGdH„Z&dIdJ„Z'dKdL„Z(dMdN„Z)dOdP„Z*dQdR„Z+dzdTdU„Z,d{dVdW„Z-d|dYdZ„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")) Nc Cs¾|dkr^ddl}ddlm}|j|kr^t|dƒrJtd|t|j|jfƒ‚ntd|t|jfƒ‚ddlm}||_tƒ|_ |j ƒ|_ i|_ t jd ƒj|_t jd ƒj|_g|_g|_g|_g|_d|_i|_d|_d|_tj|ƒ|_t|d ƒrô|j|ƒx2t|jƒD]$}|jd ƒ�rt ||t!||ƒƒ�qW|j �"|j"tj#ƒ|_$|j"tj%ƒ|_&WdQRXt'|t jƒ�r’tt(d ƒ�s²|j)|j$dƒt(_*|j+ƒ\t(_,t(_-n |j)|j$dƒ|_*|j+ƒ\|_,|_-|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Ú_lockÚParserÚ_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Úbackendr rÚnamer r r Ú__init__)sR          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)r0Úcsourcer4r5r6r r r Úcdefes zFFI.cdefcCs&|j|||dd�|jdkr"d|_dS)NT)r5r6Z dllexportr)r7r%)r0r8r5r6r r r Ú embedding_apirs zFFI.embedding_apic Ks²t|tƒs&t|tƒstdƒ‚|jdƒ}|j�|tƒ|_|jj |fd|i|—Ž|j j |ƒ|rvx|j D] }|j ƒqfW|jj}|r¤g|j_x|D]}|j||ƒq�WWdQRXdS)Nz cdef() argument must be a stringÚasciir4)rÚstrÚ basestringÚ TypeErrorÚencoderÚobjectr$rÚparser ÚappendrÚclearZ _recompleteÚfinish_backend_type)r0r8r4ÚoptionsÚcacheÚ finishlistÚtpr r r r7ws        z FFI._cdefrc Csdt|tƒp|dkpt||jƒs&tdƒ‚|j�.t|||ƒ\}}|jj|ƒ|jj|ƒWdQRX|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_libraryrrBr)r0r2ÚflagsÚlibZfunction_cacher r r Údlopen‰s   z FFI.dlopencCst|ƒj|ƒ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__)r0rKr r r Údlclose›sz FFI.dlclosecCsj|}||jkr|j|St|tƒs,|jdƒ}|jj|ƒ}|j}|rJ|jƒ}|j|ƒ}||f}||j|<|S)Nr;) rrr<r?rZ parse_typeZis_raw_functionZas_function_pointerr*)r0ÚcdeclÚkeyrMÚreally_a_function_typeÚbtypeÚresultr r r Ú_typeof_locked¢s       zFFI._typeof_lockedcCsdy|j|}Wn0tk r>|j�|j|ƒ}WdQRXYnX|\}}|r`| r`td|fƒ‚|S)Nz>the type %r is a function type, not a pointer-to-function type)rÚKeyErrorrrUr)r0rPÚconsider_function_as_funcptrrTrSrRr r r Ú_typeof´s  z FFI._typeofc CsŒt|tƒr|j|ƒSt||jƒr,|jj|ƒSt|tjƒrLt|ƒ}|dk rL|St|tj ƒr|t |dƒr||j �|j |j ƒSQRXtt|ƒƒ‚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=rXr.rÚtypeofrÚBuiltinFunctionTypeÚ_builtin_function_typeÚ FunctionTyperrr*rYr>rM)r0rPÚresr r r rZÂs       z FFI.typeofcCs0t|tƒr |j|ƒ}|jj|ƒS|jj|ƒSdS)zvReturn the size in bytes of the argument. It can be a string naming a C type, or a 'cdata' instance. N)rr=rXrÚsizeof)r0rPÚBTyper r r r_Õs   z FFI.sizeofcCs t|tƒr|j|ƒ}|jj|ƒS)z\Return the natural alignment size in bytes of the C type given as a string. )rr=rXrÚalignof)r0rPr r r raßs  z FFI.alignofcGs(t|tƒr|j|ƒ}|j|f|žŽ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=rXÚ _typeoffsetof)r0rPÚfields_or_indexesr r r Úoffsetofçs  z FFI.offsetofcCs"t|tƒr|j|ƒ}|jj||ƒ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=rXrZnewp)r0rPÚinitr r r Únewòs  zFFI.newTcs,ˆjjƒ}|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ˆj|ƒ}ˆ||ƒS)N)rr=rX)rPre)Ú allocatorr0r r Úallocates  z#FFI.new_allocator..allocate)N)rr Ú new_allocator)r0ZallocÚfreeZshould_clear_after_allocZ compiled_ffirhr )rgr0r ri s  zFFI.new_allocatorcCs"t|tƒr|j|ƒ}|jj||ƒ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=rXrr-)r0rPÚsourcer r r r-%s  zFFI.castrcCs|jj||ƒ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)r0ÚcdataÚmaxlenr r r rl.sz FFI.stringcCs|jj||ƒ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)r0rmÚlengthr r r ro@sz FFI.unpackcCs:|tkr|j|}}nt|tƒr*|j|ƒ}|jj|||ƒ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=rXrÚ from_buffer)r0rPZ python_bufferZrequire_writabler r r rr^s    zFFI.from_buffercCs|jj|||ƒ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)r0ÚdestÚsrcÚnr r r rspsz FFI.memmovecsB‡‡‡‡fdd„}tˆtƒr*ˆjˆdd�‰|dkr6|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ƒ‚ˆjjˆ|ˆˆƒS)Nz.the 'python_callable' argument is not callable)Úcallabler>rÚcallback)Úpython_callable)rPÚerrorÚonerrorr0r r Úcallback_decorator_wrapˆs z-FFI.callback..callback_decorator_wrapT)rWN)rr=rX)r0rPryrzr{r|r )rPrzr{r0r rx€s  z FFI.callbackrcCsht|tƒr|j|ƒ}|jƒ}|jdƒrBd|jj|dƒkrBd|}n|rZ|ddkrZd|}|jj||ƒ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=rXÚstripr'rZgetcname)r0rPZ replace_withr r r Úgetctype•s    z FFI.getctypecCs|jj|||ƒ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)r0rmZ destructorÚsizer r r Úgc¥s zFFI.gcc Csf|jjdƒdkst‚y|j|}Wn>tk r`g}|j||ƒ}x|D]}|j||ƒqHWYnX|S)NF)rÚacquireÚAssertionErrorrrVZget_cached_btyperD)r0rMr`rGr r r r*±s  zFFI._get_cached_btypecKsVddlm}m}|jr |j|ƒ|p(|ƒ}||||f|Ž|_|jjƒ}|jj|ƒ|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_libraryrrB)r0rkÚtmpdirÚkwargsr†r‡rKr r r Úverify½s     z FFI.verifycCs |jjƒS)N)rÚ get_errno)r0r r r Ú _get_errnoÛszFFI._get_errnocCs|jj|ƒdS)N)rÚ set_errno)r0Úerrnor r r Ú _set_errnoÝszFFI._set_errnoz(the value of 'errno' from/to the C callscCs |jj|ƒS)N)rÚ getwinerror)r0Úcoder r r r“âszFFI.getwinerrorc Cs|j�tj||ƒSQRXdS)N)rrÚ pointer_cache)r0Úctyper r r Ú _pointer_toåszFFI._pointer_toc Gs”y|jj|ƒ}Wn8tk rHdt|ƒjkrBt|ƒj|f|žŽS‚YnX|rd|j|f|žŽ\}}n|jdkrvtdƒ‚d}|j|ƒ}|jj |||ƒ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__Úpointerzaddressof(pointer)r) rrZr>rMrr˜rbÚkindr—Z rawaddressof)r0rmrcr–ÚoffsetZctypeptrr r r Ú addressofés  z FFI.addressofcGsD|jj||ƒ\}}x(|D] }|jj||dƒ\}}||7}qW||fS)Nr)rZ typeoffsetof)r0r–Zfield_or_indexrcr›Zfield1Zoffset1r r r rbþs   zFFI._typeoffsetofcCs–t|tƒstdt|ƒjfƒ‚||kr.tdƒ‚|j�X|j�F|jj|jƒ|j j dƒ|j j |j ƒ|j j dƒ|j j |ƒWdQRXWdQRXdS)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) rr r>rMÚ__name__Ú ValueErrorrrÚincluder rBÚextendr!)r0Zffi_to_includer r r r¡s   z FFI.includecCs|jj|j|ƒS)N)rZ newp_handler+)r0rr r r Ú new_handleszFFI.new_handlecCs |jj|ƒS)N)rÚ from_handle)r0rr r r r¤szFFI.from_handlecCs|jj|ƒdS)N)rÚrelease)r0rr r r r¥"sz FFI.releasecCs>|jdk rtdƒ‚t|ƒ}|r*|jdƒn |jdƒ||_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 Úboolr9)r0Z enabled_flagr r r Ú set_unicode%s  zFFI.set_unicodecCs>|jdfƒ}t|ttfƒs"tdƒ‚t|ƒddg}||d<dS)NÚ define_macrosz''define_macros' must be a list or tupleÚUNICODEÚ1Ú_UNICODE)r©rª)r«rª)Úgetrr&Útupler>)r0ÚkwdsZ defmacrosr r r r‰Cs  zFFI._apply_windows_unicodec sr‡fdd„}dtjkr®ddl}tjdkrVdjtjƒ}ttdƒrŠ|d|jjtj d ƒƒn4tjdkrfd }nd }ttdƒrŠ|d|jjtj d ƒƒttdƒr¬|d|jjtj ddƒƒn tjdkrÐd}ttdƒrÎ|d7}nLy ddl }Wn t k rüddl m }YnXd}|j dƒ�r||j dƒ7}|tjd?tjd?d@f}ttdƒ�rN|tj7}|d|ƒtjdk�rn|ddƒdS)Ncs"ˆj|gƒ}||kr|j|ƒdS)N)Ú setdefaultrB)rQÚvalueÚlst)r®r r ÚensureMs z(FFI._apply_embedding_fix..ensureZ__pypy__rÚwin32zpython{0[0]}{0[1]}ÚprefixÚ library_dirsZlibsézpypy-czpypy3-cÚbinZpypyZgoalz python%d%dÚgettotalrefcountZ_d)Ú sysconfigz python%d.%dZ DEBUG_EXTéééÿÚabiflagsÚ librariesÚextra_link_argsz /MANIFEST)r¶)ÚsysÚbuiltin_module_namesÚosÚplatformÚformatÚ version_inforÚpathÚjoinr´r¹Ú ImportErrorÚ distutilsÚget_config_varÚ hexversionr½)r0r®r²rÂZ pythonlibÚtemplater¹r )r®r Ú_apply_embedding_fixKs@                 zFFI._apply_embedding_fixú.ccKsdddl}t|dƒrtdƒ‚t|tƒs,tdƒ‚|j|ksF|jrN|j|krNtdƒ‚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Ï)r0Ú module_namerkÚsource_extensionr®rÂr r r Ú set_source}s  zFFI.set_sourcecKsJddlm}t|tƒstdƒ‚|j|ƒ}|j||ƒ|j|||f|ŽdS)Nr)Ú pkgconfigz;the pkgconfig_libs argument must be a list of package names)rrÕrr&r>Zflags_from_pkgconfigZ merge_flagsrÔ)r0rÒZpkgconfig_libsrkrÓr®rÕZkwds2r r r Úset_source_pkgconfigŠs     zFFI.set_source_pkgconfigÚbuildc CsÄddlm}ddlm}t|dƒs>t|dƒr6|jjƒStdƒ‚|j\}}}}|dkr\t dƒ‚||ƒ||||f|||d d œ|—Ž\} } |rÀ| r¨t j j d | j dfƒnt j 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 )Údistutils.dir_utilrØÚ recompilerrÙrrˆÚ get_extensionr rÏr>rÀÚstderrÚwriteÚsources) r0r‹ÚverboserØrÙrÒrkrÓr®ÚextÚupdatedr r r Údistutils_extension”s&     zFFI.distutils_extensioncCsZddlm}t|dƒstdƒ‚|j\}}}}|dkr)r0ÚfilenamerÙrÒrkrÓr®r r r Ú emit_c_code®s   zFFI.emit_c_codecCsZddlm}t|dƒstdƒ‚|j\}}}}|dk r)r0rærÙrÒrkrÓr®r r r Úemit_python_codeºs   zFFI.emit_python_codeÚ.c CsLddlm}t|dƒstdƒ‚|j\}}}} ||||f|||||dœ| —ŽS)a¿The 'target' argument gives the final file name of the compiled DLL. Use '*' to force distutils' choice, suitable for regular CPython C API modules. Use a file name ending in '.*' to ask for the system's default extension for dynamic libraries (.so/.dll/.dylib). The default is '*' when building a non-embedded C API extension, and (module_name + '.*') when building an embedded library. r)rÙrÏz,set_source() must be called before compile())r‹ÚtargetrÓZcompiler_verboseÚdebug)rÜrÙrr rÏ) r0r‹rárêrërÙrÒrkrÓr®r r r ÚcompileÆs   z FFI.compilecCsŽy|j|}Wn(tk r6|jj|dtƒfƒ}YnX|drH|dS|d�4|j|}|drl|dS|ƒ}d|f|j|<WdQRX|S)NFrrT)r#rVr¯r)r0ÚfuncÚtagrrTr r r Ú init_onceÙs  z FFI.init_oncecsÖ|jrtdƒ‚ddl}|jd|ƒ}|r6||jƒd…}|jƒpBdg}|jd|dƒjƒ}xBtdt|ƒƒD]0‰|ˆ}|j ƒrhx|j |ƒs–|dd …}q~WqhWt|ƒ‰‡fdd„|Dƒ}dj |ƒ}t |d d ƒ||_dS) Nz-embedding_init_code() can only be called oncerz\s*\nrz\s*rcsg|]}|ˆd…d‘qS)NÚ r )Ú.0Úline)Úir r ú sz+FFI.embedding_init_code..Z cffi_initÚexecéÿÿÿÿ) r%r ÚreÚmatchÚendÚ splitlinesÚgroupÚrangeÚlenÚrstripr'rÇrì)r0Zpysourcer÷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 )r0Úargsr®r r r Ú def_extern szFFI.def_externcCs˜g}g}g}xh|jjD]\}|jdƒr8|j|dd…ƒq|jdƒrV|j|dd…ƒq|jdƒr|j|dd…ƒqW|jƒ|jƒ|jƒ|||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'rBÚsort)r0ZtypedefsÚstructsZunionsrQr r r Ú list_typess   zFFI.list_types)N)FFN)FN)F)r)F)N)NNTrö)rö)NNN)r)r)rNrö)rö)rÎ)rÎ)r×T)rérNN)6rŸÚ __module__Ú __qualname__Ú__doc__r3r9r:r7rLrOrUrXrZr_rardrfrir-rlrorqrrrsrxr�rƒr*r�r�r’Úpropertyr‘r“r—rœrbr¡r£r¤r¥r§r‰rÍrÔrÖrärçrèrìrïrrr r r r r r sh <              2    r c Csøddl}t|tƒs4tjdks$|dk r0|j||ƒSd}d}d|ksRd|ksR|j|kr†y |j||ƒStk r„}z |}WYdd}~XnXddl}|j j |ƒ}|dkrì|dkrÆtjdkrÆtj d krÆtdƒ‚d|f}|dk räd ||f}t|ƒ‚|j||ƒ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¶) rÂrr=rÀrÃrŠrÐÚOSErrorÚ ctypes.utilÚutilÚ find_libraryrÅ) r1r2rJrÂZ first_errorÚeÚctypesrÆÚ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øy"t|tƒsÖ|jdƒ}d|ˆ_Wntk röYnXˆƒ‰ ˆ ˆ j fS)Ncs<d|}ˆjj|\}}ˆj|ƒ}ˆj||ƒ}|ˆj|<dS)Nz function )rrr*Ú load_functionr)r2rQrHÚ_r`r°)Ú backendlibÚffiÚlibraryr r Úaccessor_functionBs   z,_make_ffi_library..accessor_functioncs\dˆ}ˆjj|\}}ˆj|ƒ‰ˆj‰ˆj‰tˆˆt‡‡‡fdd„‡‡‡fdd„ƒƒdS)Nz variable cs ˆˆˆƒS)Nr )r0)r`r2Ú read_variabler r r Psz>_make_ffi_library..accessor_variable..cs ˆˆˆ|ƒS)Nr )r0r°)r`r2Úwrite_variabler r r Qs)rrr*rrr(r )r2rQrHr)Ú FFILibraryrr)r`r2rrr Úaccessor_variableIs z,_make_ffi_library..accessor_variablecsŒyˆ|Stk r†ˆj�Z|ˆkrtd|}ˆjj|\}}ˆj|ƒ}|jdkr`tjˆ|ƒ}ˆj||ƒ}|ˆ|<WdQRXˆ|SXdS)Nz variable Úarray) rVrrrr*ršrr•r)r2rQrHrr`Ú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)r2r r r Úaccessor_constantbsz,_make_ffi_library..accessor_constantcsˆjj|ˆj|<dS)N)rÚ_int_constantsr)r2)rrr r Úaccessor_int_constantfsz0_make_ffi_library..accessor_int_constantFcsàˆdˆjkrdSx ˆjjjƒD]�\}\}}t|tjƒs~|jddƒ\}}|dkrZˆˆ|<q°|dkrlˆˆ|<q°|dkr°ˆˆ|<q x0t|j ƒD]"\}}||f‡fdd„ }|ˆ|<qŠWq Wxˆjj D]}ˆj |ˆƒq¾Wˆjˆd<dS) NrrrÚfunctionÚvariableZconstantcs|jƒ|j|ˆj|<dS)N)Zcheck_not_partialZ enumvaluesr)r2rHró)rr r Ú accessor_enum|szB_make_ffi_library..update_accessors..accessor_enum) r$rrÚitemsrrZEnumTypeÚsplitÚ enumerateZ enumeratorsr(r¯)rQrHrrîr2róZenumnamer,)r'rr)r!Ú accessorsÚaccessors_versionrrr r Úupdate_accessorsms"    z+_make_ffi_library..update_accessorsc sXˆj�H|ˆjks|ˆjkr dS|ˆkr>ˆƒ|ˆkr>t|ƒ‚ˆ||ƒWdQRXdS)N)rrÚAttributeError)r2)r r0rrr2r 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||ƒS)N)r))r0r2)r4r r Ú __getattr__�sz1_make_ffi_library..FFILibrary.__getattr__c sJyt|j|ƒ}Wn(tk r8ˆ|ƒt|||ƒYnX|j||ƒdS)N)r)Ú __class__r3r(Ú__set__)r0r2r°r )r4r r Ú __setattr__’s z1_make_ffi_library..FFILibrary.__setattr__c s ˆj�ˆƒˆjƒSQRXdS)N)rÚkeys)r0)r0rr2r r Ú__dir__šsz-_make_ffi_library..FFILibrary.__dir__csf|ˆjkrˆj|S|ˆjkr&ˆ|ƒSˆ|ƒ|ˆjkrBˆj|S|ˆjkrTˆ|ƒStd|fƒ‚dS)Nz:cffi library has no function or global variable named '%s')rr3)r0r2)r r%rr4r r r˜žs      z3_make_ffi_library..FFILibrary.__addressof__csˆjƒ|jjƒdS)N)Z close_librrC)r0)rr r rNªsz4_make_ffi_library..FFILibrary.__cffi_close__N)rŸr r r5r8r:r˜rNr )r r0r%rrrr4r2r r r Žs    r zutf-8z FFILibrary_%s) rrr@rr=r<r?rŸÚ UnicodeErrorr)rÚlibnamerJr1r )r r'rr)r!r0r1r$r%rrrr4r2r rI>s,   "   rIcCsdddl}y$|j|j}|j}|j}||}Wntttfk rFdSX|j� |j |ƒSQRXdS)Nr) rÀÚmodulesr Z_cffi_original_ffiZ_cffi_types_of_builtin_funcsrVr3r>rr*)rírÀÚmodulerZtypes_of_builtin_funcsrHr r r r\¸s  r\)rÀrÚlockrrzrrrrwÚ NameErrorÚ collectionsrr=r<r@rqr rrIr\r r r r Ús.     z