ok
Direktori : /opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/ |
Current File : //opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/api.cpython-38.pyc |
U ل=^P� � @ s� d dl Z d dlZddlmZ ddlmZ ddlmZ ze W n( e k rd d dl mZ dd� ZY nX ze W n e k r� e ZY nX e� ZG d d � d e�Zdd� Zd d� Zdd� ZdS )� N� )� allocate_lock)� CDefError)�model)�Callablec C s t | t�S �N)� isinstancer )�x� r �/api.py�<lambda> � r c @ s� e Zd ZdZdjdd�Zdkdd�Zdldd �Zdmd d�Zdnd d�Zdd� Z dd� Z dodd�Zdd� Zdd� 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")) Nc C s� |dkr^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%�| _&W 5 Q R X t'|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. Nr r )�__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.)�cparserZparsed_typesZ new_types�set_ffiZRTLD_�NULL)/Z _cffi_backend� r �hasattr� Exceptionr r �_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� _embeddingr Z get_typecacheZ _typecacher �list� startswith�setattr�getattr�_get_cached_btypeZ voidp_type�BVoidPZchar_array_type�BCharAr r �castr Z _get_types�CDataZCType�buffer)�self�backendr r �namer r r �__init__) s^ � � zFFI.__init__Fc C s | 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 �csourcer5 r6 r7 r r r �cdefe s zFFI.cdefc C s&