Your IP : 3.145.58.141


Current Path : /usr/lib64/python3.6/site-packages/cffi/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/cffi/__pycache__/vengine_cpy.cpython-36.pyc

3

M��Z���@s@ddlZddlZddlmZddlmZGdd�de�ZdZdS)�N�)�model)�VerificationErrorc@seZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdndd
�Z	dd�Z
dd�Zdd�Zdodd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZeZeZeZeZeZd)d*�Zd+d,�Zd-d.�ZeZd/d0�Z eZ!d1d2�Z"d3d4�Z#d5d6�Z$d7d8�Z%eZ&d9d:�Z'd;d<�Z(d=d>�Z)d?d@�Z*dAdB�Z+dCdD�Z,dEdF�Z-dGdH�Z.eZ/dIdJ�Z0dKdL�Z1dMdN�Z2dOdP�Z3dpdSdT�Z4dUdV�Z5dWdX�Z6eZ7eZ8eZ9dqdYdZ�Z:d[d\�Z;drd^d_�Z<eZ=eZ>d`da�Z?dbdc�Z@ddde�ZAeZBeZCeZDeZEdfdg�ZFdhdi�ZGeZHeZIdjdk�ZJdldm�ZKdS)s�VCPythonEngine�xTcCs||_|j|_i|_i|_dS)N)�verifier�ffi�_struct_pending_verification�_types_of_builtin_functions)�selfr�r�#/usr/lib64/python3.6/vengine_cpy.py�__init__
szVCPythonEngine.__init__cCsdS)Nr)r�kwdsrrr
�patch_extension_kwdssz#VCPythonEngine.patch_extension_kwdscCsPytj||�\}}}Wntk
r*dSX|dk	r<|j�|d|krLdS|S)Nr)�imp�find_module�ImportError�close)rZmodule_name�pathZso_suffixes�f�filenameZdescrrrr
rszVCPythonEngine.find_modulecCsi|_|jd�dS)NZcollecttype)�
_typesdict�	_generate)rrrr
�
collect_types$szVCPythonEngine.collect_types�cCs|jj|d�dS)N�
)Z_f�write)rZwhatrrr
�_prnt(szVCPythonEngine._prntcCs
|j|S)N)r)r�typerrr
�_gettypenum+szVCPythonEngine._gettypenumcCs:t|tj�s|jdkr6||jkr6t|j�}||j|<dS)Nzlong double)�
isinstancer�
PrimitiveType�namer�len)r�tpZnumrrr
�_do_collect_type/s



zVCPythonEngine._do_collect_typecCs�|j�ddg|_|j}|t�|�||jj�|�|jd�|j�|�|d�|jd�|d�|d�|d�|�|jj�}|jd}|d	�|�|d
�|d�|d|�|d
�|d�|d�|d�|d�|�|d�|d|�|d�|d�|d�|d�|d�|d|f�|d�|d�|d�|d�|d�|�|d�|�|d�|d|�|d�|d�|d|�|d�|d �|d!|f�|d �|d"�|d�|�|d#�dS)$Nz
((void)lib,0)�declz&static PyMethodDef _cffi_methods[] = {�methodz3  {"_cffi_setup", _cffi_setup, METH_VARARGS, NULL},z)  {NULL, NULL, 0, NULL}    /* Sentinel */z};Fz#if PY_MAJOR_VERSION >= 3z.static struct PyModuleDef _cffi_module_def = {z  PyModuleDef_HEAD_INIT,z  "%s",z  NULL,z  -1,z  _cffi_methods,z  NULL, NULL, NULL, NULLZPyMODINIT_FUNCzPyInit_%s(void)�{z  PyObject *lib;z+  lib = PyModule_Create(&_cffi_module_def);z  if (lib == NULL)z    return NULL;z#  if (%s < 0 || _cffi_init() < 0) {z    Py_DECREF(lib);z  }z
  return lib;�}z#elsezinit%s(void)z+  lib = Py_InitModule("%s", _cffi_methods);z    return;z!  if (%s < 0 || _cffi_init() < 0)z	  return;z#endif)	r�_chained_list_constantsr�cffimod_headerrZpreambler�_generate_setup_custom�get_module_name)r�prnt�modnameZ	constantsrrr
�write_source_to_f6st




z VCPythonEngine.write_source_to_fNcsvtj�z�ttd�rtj�}zvy6ttd�r<|dk	r<tj|�tj�jj��jj	��Wn:t
k
r�}zd�jj	|f}t|��WYdd}~XnXWdttd�r�tj|�XWdtj�X�j
�d�tdd��jj�D����fdd�tt���D�}tt�jj|��}G���fdd	�d	t����}�j|t|��rRd
dl}|jd�jj���j
�d|d
��j�_�j�_|S)N�getdlopenflags�setdlopenflagszimporting %r: %sZloadingcSsg|]\}}||f�qSrr)�.0�key�valuerrr
�
<listcomp>�sz/VCPythonEngine.load_library.<locals>.<listcomp>csg|]}�|�qSrr)r4�i)�
revmappingrr
r7�scs&eZdZ�Z�jZgZ�fdd�ZdS)z/VCPythonEngine.load_library.<locals>.FFILibrarycs�jt|j�S)N)�	_cffi_dir�list�__dict__)r)�
FFILibraryrr
�__dir__�sz7VCPythonEngine.load_library.<locals>.FFILibrary.__dir__N)�__name__�
__module__�__qualname__Z_cffi_python_modulerZ	_cffi_ffir:r>r)r=�modulerrr
r=�sr=rz0reimporting %r might overwrite older definitionsZloaded)�library)r�acquire_lock�hasattr�sysr2r3Zload_dynamicrr.Zmodulefilenamerr�release_lock�_load�dictr�items�ranger$r;�mapr�_get_cached_btype�objectZ_cffi_setup�warnings�warnZ_cffi_original_ffir
Z_cffi_types_of_builtin_funcs)r�flagsZprevious_flags�e�error�lstrCrOr)r=rBr9rr
�load_library�s<



zVCPythonEngine.load_librarycCs$dd�|jjjj�D�}|j�|S)NcSsg|]\}\}}||f�qSrr)r4r5r%Zqualrrr
r7�sz4VCPythonEngine._get_declarations.<locals>.<listcomp>)rZ_parserZ
_declarationsrJ�sort)rrTrrr
�_get_declarations�sz VCPythonEngine._get_declarationscCs�x�|j�D]�\}}|jdd�\}}yt|d||f�}Wn tk
rXtd|��YnXy|||�Wq
tk
r�}ztj||��WYdd}~Xq
Xq
WdS)N� rz_generate_cpy_%s_%sznot implemented in verify(): %r)rW�split�getattr�AttributeErrorr�	Exceptionr�attach_exception_info)r�	step_namer#r%�kind�realnamer(rRrrr
r�szVCPythonEngine._generatec
Ks�x||j�D]p\}}|jdd�\}}t|d||f�}y||||f|�Wq
tk
rx}	ztj|	|��WYdd}	~	Xq
Xq
WdS)NrXrz
_%s_cpy_%s)rWrYrZr\rr])
rrBr^rr#r%r_r`r(rRrrr
rH�szVCPythonEngine._loadcCsdS)Nr)rr%r#rrr
�_generate_nothing�sz VCPythonEngine._generate_nothingcKsdS)Nr)rr%r#rBrrrr
�_loaded_noop�szVCPythonEngine._loaded_noopcCs*d}t|tj�rT|j�r2|jdkr2d}d|j}nd|jd�|jjdd�f}d}n�t|tj�rt|j||||�dSt|tj	tj
f�r�|jd	||j|�|f�|jd
|�dSt|tj
�r�d|jd�}d|j|�}d
}nt|��|jd||||f�|jd||jd�|f�|jd
|�dS)Nr�_BoolZ_cffi_to_c_intz, %sz(%s)_cffi_to_c_%srX�_z-1z6  if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)z    %s;z(%s)_cffi_to_c_pointerz, _cffi_type(%d)ZNULLz  %s = %s(%s%s);z'  if (%s == (%s)%s && PyErr_Occurred()))r!rr"�is_integer_typer#�
get_c_name�replace�PointerType�"_convert_funcarg_to_c_ptr_or_array�
StructOrUnion�EnumTyperr �FunctionPtrType�NotImplementedError)rr%�fromvar�tovar�errcodeZextraargZ	converterZerrvaluerrr
�_convert_funcarg_to_c�s4
z$VCPythonEngine._convert_funcarg_to_ccCst|tj�r|jd�dS)NzPy_ssize_t datasize)r!rrh�add)rr%�	localvarsrrr
�_extra_local_variablessz%VCPythonEngine._extra_local_variablescCs�|jd�|jd|j|�||f�|jd�|jd�|jd|�|jd|f�|jd|f�|jd||j|�|f�|jd|�|jd	�dS)
Nz1  datasize = _cffi_prepare_pointer_call_argument(z(      _cffi_type(%d), %s, (char **)&%s);z  if (datasize != 0) {z    if (datasize < 0)z	      %s;z"    %s = alloca((size_t)datasize);z,    memset((void *)%s, 0, (size_t)datasize);zL    if (_cffi_convert_array_from_object((char *)%s, _cffi_type(%d), %s) < 0)z  })rr )rr%rnrorprrr
ris


z1VCPythonEngine._convert_funcarg_to_c_ptr_or_arraycCst|tj�r`|j�r,|jdkr,d||jfS|jdkrLd|jjdd�|fSd||j|�fSn�t|tjtjf�r�d||j|�fSt|tj	�r�d||jtj|j
��fSt|tj�r�|jdkr�t
d	|j�|f��d
||j|�fSt|tj��rd||j|�fSt|��dS)Nrcz_cffi_from_c_int(%s, %s)zlong doublez_cffi_from_c_%s(%s)rXrdz/_cffi_from_c_deref((char *)&%s, _cffi_type(%d))z0_cffi_from_c_pointer((char *)%s, _cffi_type(%d))z!'%s' is used as %s, but is opaquez0_cffi_from_c_struct((char *)&%s, _cffi_type(%d)))r!rr"rer#rgr rhrl�	ArrayType�itemrj�fldnames�	TypeError�_get_c_namerkrm)rr%�var�contextrrr
�_convert_expr_from_c)s.

z#VCPythonEngine._convert_expr_from_ccCsLt|tj�st�|jr"|j|�n&x|jD]}|j|�q*W|j|j�dS)N)r!rrl�AssertionError�ellipsisr&�args�result)rr%r#rrrr
�"_generate_cpy_function_collecttypePsz1VCPythonEngine._generate_cpy_function_collecttypec
	Cs�t|tj�st�|jr(|jd||�dS|j}t|j�}|dkrFd}n|dkrTd}nd}|d�|d||f�|d	�d
|}x.t	|j�D] \}}|d|j
d||��q�Wt�}	x|jD]}|j||	�q�Wx|	D]}
|d|
f�q�Wt|j
tj��s"d
}d|}|d|j
j
d|��nd}t|j�dk�r�tt|j��}x|D]}|d|��qJW|�|dd||djdd�|D��f�|d�|�x6t	|j�D](\}}|j|d|d|d�|��q�W|d�|d�|d||djdd�tt|j��D��f�|d�|d �|�|d!�|dk�r>|d"�|�r^|d#|j|j
d$d%��n|d&�|d'�|d(�|�dS))NFrZnoargrZarg0rzstatic PyObject *z(_cffi_f_%s(PyObject *self, PyObject *%s)r)zargument of %sz  %s;z x%dz	result = zresult of %sz resultrz  PyObject *arg%d;z+  if (!PyArg_ParseTuple(args, "%s:%s", %s))�Oz, cSsg|]}d|�qS)z&arg%dr)r4r8rrr
r7�sz>VCPythonEngine._generate_cpy_function_decl.<locals>.<listcomp>z    return NULL;zarg%dzx%dzreturn NULLz  Py_BEGIN_ALLOW_THREADSz  _cffi_restore_errno();z  { %s%s(%s); }cSsg|]}d|�qS)zx%dr)r4r8rrr
r7�sz  _cffi_save_errno();z  Py_END_ALLOW_THREADSz  (void)self; /* unused */z  (void)noarg; /* unused */z  return %s;r�zresult typez  Py_INCREF(Py_None);z  return Py_None;r*)r!rrlr}r~�_generate_cpy_constrr$r�	enumeraterf�setrtr�ZVoidTyperK�joinrqr|)
rr%r#r/�numargsZargnamer{r8rrsr'Zresult_code�rngrrr
�_generate_cpy_function_decl[st


"$
z*VCPythonEngine._generate_cpy_function_declcCsL|jr
dSt|j�}|dkr"d}n|dkr0d}nd}|jd|||f�dS)NrZMETH_NOARGSrZMETH_OZMETH_VARARGSz  {"%s", _cffi_f_%s, %s, NULL},)r~r$rr)rr%r#r��methrrr
�_generate_cpy_function_method�s
z,VCPythonEngine._generate_cpy_function_methodcCs.|jr
dSt||�}t|||�||j|<dS)N)r~rZ�setattrr
)rr%r#rBrC�funcrrr
�_loaded_cpy_function�s

z#VCPythonEngine._loaded_cpy_functioncCs ||jkst�|j|d|�dS)N�struct)r#r}�_generate_struct_or_union_decl)rr%r#rrr
�_generate_cpy_struct_decl�sz(VCPythonEngine._generate_cpy_struct_declcCs|j|d|�dS)Nr�)� _generate_struct_or_union_method)rr%r#rrr
�_generate_cpy_struct_method�sz*VCPythonEngine._generate_cpy_struct_methodcCs|j|d||�dS)Nr�)�_loading_struct_or_union)rr%r#rBrrr
�_loading_cpy_struct�sz"VCPythonEngine._loading_cpy_structcKs|j|�dS)N)�_loaded_struct_or_union)rr%r#rBrrrr
�_loaded_cpy_struct�sz!VCPythonEngine._loaded_cpy_structcCs ||jkst�|j|d|�dS)N�union)r#r}r�)rr%r#rrr
�_generate_cpy_union_decl�sz'VCPythonEngine._generate_cpy_union_declcCs|j|d|�dS)Nr�)r�)rr%r#rrr
�_generate_cpy_union_method�sz)VCPythonEngine._generate_cpy_union_methodcCs|j|d||�dS)Nr�)r�)rr%r#rBrrr
�_loading_cpy_union�sz!VCPythonEngine._loading_cpy_unioncKs|j|�dS)N)r�)rr%r#rBrrrr
�_loaded_cpy_union�sz VCPythonEngine._loaded_cpy_unionc
Cs|jdkrdSd||f}d||f}d||fj�}|j}|d||f�|d�|d�|d�x�|j�D]�\}}	}
}t|	tj�r�|	j�s�|
dkr�|d	|�qny$|d
|	jdd||d
�|f�Wqnt	k
r�}z|dt
|��WYdd}~XqnXqnW|d�|d�|d|f�|d�|d|�|d�|d|�|d�xt|j�D]h\}}	}
}|
dk�rr�qX|d||f�t|	tj��r�|	jdk�r�|d|	j
��n|d||f��qXW|d�|d�|d�|d�|d�|d�|d|f�|d�|�dS) Nz_cffi_check_%s_%sz_cffi_layout_%s_%sz%s %szstatic void %s(%s *p)r)z8  /* only to generate compile-time warnings or errors */z
  (void)p;rz  (void)((p->%s) << 1);z  { %s = &p->%s; (void)tmp; }z*tmpzfield %r)Zqualsz
  /* %s */r*zstatic PyObject *z#%s(PyObject *self, PyObject *noarg)z,  struct _cffi_aligncheck { char x; %s y; };z  static Py_ssize_t nums[] = {z    sizeof(%s),z)    offsetof(struct _cffi_aligncheck, y),z    offsetof(%s, %s),z    0,  /* %s */z    sizeof(((%s *)0)->%s),z    -1z  };z  (void)self; /* unused */z  (void)noarg; /* unused */z'  return _cffi_get_struct_layout(nums);z3  /* the next line is not executed, but compiled */z  %s(0);)rw�stripr�
enumfieldsr!rr"rerfr�strru�lengthry)
rr%�prefixr#Z
checkfuncname�layoutfuncname�cnamer/�fname�ftype�fbitsize�fqualrRrrr
r��sX
&
z-VCPythonEngine._generate_struct_or_union_declcCs0|jdkrdSd||f}|jd||f�dS)Nz_cffi_layout_%s_%sz   {"%s", %s, METH_NOARGS, NULL},)rwr)rr%r�r#r�rrr
r�s

z/VCPythonEngine._generate_struct_or_union_methodc
Cs�|jdkrdSd||f}t||�}|�}t|tj�r�|jr�|d}|d}	|ddd�}
|ddd�}|j�t|
�t|�ko�t|j�kns�t�|
|||	f|_	nd||fj
�}||f|j|<dS)Nz_cffi_layout_%s_%srr��z%s %s)rwrZr!rrj�partialZ
force_flattenr$r}Zfixedlayoutr�r	)
rr%r�r#rBr�Zfunction�layoutZ	totalsizeZtotalalignmentZfieldofsZ	fieldsizer�rrr
r�s

*z'VCPythonEngine._loading_struct_or_unionc
Cs|jdkrdS|jj|�||jk�rdd�}|j}|j|�}|jj|�\}}||d|j|�d�||d|j|�d�d}x�|j�D]v\}}	}
}|
dkr�q�||||j||�d|f�||ddkr�|j|	�}|||d|j|�d	|f�|d7}q�W|t	|�k�st
�dS)
NcSs||krtd|||f��dS)Nz'%s (we have %d, but C compiler says %d))r)Z	realvalueZ
expectedvalue�msgrrr
�check(sz5VCPythonEngine._loaded_struct_or_union.<locals>.checkrzwrong total sizerzwrong total alignmentr�zwrong offset for field %rzwrong size for field %r)rwrrMr	�pop�sizeofZalignofr�Zoffsetofr$r})
rr%r�rZBStructr�r�r8r�r�r�r�ZBFieldrrr
r�!s,


z&VCPythonEngine._loaded_struct_or_unioncCs.t|tj�r|j||d�n|j|d|�dS)Nr)r!rrk�_generate_cpy_enum_declr�)rr%r#rrr
�_generate_cpy_anonymous_declEsz+VCPythonEngine._generate_cpy_anonymous_declcCst|tj�s|j|d|�dS)Nr)r!rrkr�)rr%r#rrr
�_generate_cpy_anonymous_methodKsz-VCPythonEngine._generate_cpy_anonymous_methodcCs0t|tj�r|j|||�n|j|d||�dS)Nr)r!rrk�_loading_cpy_enumr�)rr%r#rBrrr
�_loading_cpy_anonymousOsz%VCPythonEngine._loading_cpy_anonymouscKs.t|tj�r |j|||f|�n
|j|�dS)N)r!rrk�_loaded_cpy_enumr�)rr%r#rBrrrr
�_loaded_cpy_anonymousUsz$VCPythonEngine._loaded_cpy_anonymous�constFc	Cst|j}	d||f}
|	d|
�|	d�|	d�|	d�|sT|	d|pD|jd|��n|dks`t�|dk	rt|j||�|s�|d	kr�d
|}n|}|	d|f�|	d|j|d
d�f�|s�t�n|	d|�|	d�|	d�|�r|	d�|	d�|	d|f�|	d�|	d�|	d�|	d�|	d|�|	d�|	d�|	d�|	d|j|�|
d|j|<|	d�|	�dS)Nz_cffi_%s_%szstatic int %s(PyObject *lib)r)z  PyObject *o;z
  int res;z  %s;z ir�rz�&z  i = (%s);z	  o = %s;r8z
variable typez!  o = _cffi_from_c_int_const(%s);z  if (o == NULL)z    return -1;z  {z    PyObject *o1 = o;z8    o = Py_BuildValue("On", o1, (Py_ssize_t)sizeof(%s));z    Py_DECREF(o1);z    if (o == NULL)z      return -1;z  }z-  res = PyObject_SetAttrString(lib, "%s", o);z  Py_DECREF(o);z  if (res < 0)z  return %s;z(lib)r*)rrfr}�_check_int_constant_valuer|r+)r�is_intr#r%�category�vartp�delayed�size_too�check_valuer/�funcnameZrealexprrrr
r�^sN


z"VCPythonEngine._generate_cpy_constcCs&t|tj�o|j�}|s"|j|�dS)N)r!rr"rer&)rr%r#r�rrr
�"_generate_cpy_constant_collecttype�sz1VCPythonEngine._generate_cpy_constant_collecttypecCs&t|tj�o|j�}|j|||�dS)N)r!rr"rer�)rr%r#r�rrr
�_generate_cpy_constant_decl�sz*VCPythonEngine._generate_cpy_constant_declcCs�|j}|dkr"|d|||f�n|d|||f�|d�|d|�|d|�|d�|d|�|d	�|d
�|d|||f�|d�|d
�dS)Nrz&  if ((%s) > 0 || (long)(%s) != %dL) {z1  if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {z    char buf[64];z    if ((%s) <= 0)z.        snprintf(buf, 63, "%%ld", (long)(%s));z    elsez7        snprintf(buf, 63, "%%lu", (unsigned long)(%s));z)    PyErr_Format(_cffi_VerificationError,z6                 "%s%s has the real value %s, not %s",z(                 "%s", "%s", buf, "%d");z    return -1;z  })r)rr#r6Z
err_prefixr/rrr
r��s$z(VCPythonEngine._check_int_constant_valuecCs|jdd�}d||fS)N�$Z___D_z
_cffi_e_%s_%s)rg)rr�r#rrr
�_enum_funcname�szVCPythonEngine._enum_funcname�enumcCs�|jr*x|jD]}|jd|dd�qWdS|j||�}|j}|d|�|d�x,t|j|j�D]\}}|j||d|�q`W|d|jd�|d|jd<|d	�|�dS)
NTF)r�zstatic int %s(PyObject *lib)r)z	enum %s: z  return %s;z(lib)r*)	r��enumeratorsr�r�r�zip�
enumvaluesr�r+)rr%r#r��
enumeratorr�r/�	enumvaluerrr
r��sz&VCPythonEngine._generate_cpy_enum_declcs.|jr*�fdd�|jD�}t|�|_d|_dS)Ncsg|]}t�|��qSr)rZ)r4r�)rBrr
r7�sz4VCPythonEngine._loading_cpy_enum.<locals>.<listcomp>T)r�r��tupler�Zpartial_resolved)rr%r#rBr�r)rBr
r��s



z VCPythonEngine._loading_cpy_enumcCs,x&t|j|j�D]\}}t|||�qWdS)N)r�r�r�r�)rr%r#rBrCr�r�rrr
r��szVCPythonEngine._loaded_cpy_enumcCs&|dkrd}n|}|jd||d�dS)Nz...T)r�)r�)rr%r#r�rrr
�_generate_cpy_macro_decl�sz'VCPythonEngine._generate_cpy_macro_declcCs2t|tj�rtj|j�}n
tj|�}|j|�dS)N)r!rrurhrvr&)rr%r#�tp_ptrrrr
�"_generate_cpy_variable_collecttype�s
z1VCPythonEngine._generate_cpy_variable_collecttypecCsTt|tj�r4tj|j�}|jd||||jdkd�ntj|�}|jd||dd�dS)NFz...)r�r�rz)r�)r!rrurhrvr�r�)rr%r#r�rrr
�_generate_cpy_variable_decl�s
z*VCPythonEngine._generate_cpy_variable_declc
st||�}t|tj�r�|jdkr~t|t�s.t�|\}}|jj|j	�}t
||jj|��\}}	|	dkrttd||j	f��|j
|�}|jdk	r�|jj|�}
|jj|
|�}t|||�dS|�t||��fdd�}�fdd�}tt|�|t||��t|�jj|�dS)Nz...rz/bad size: %r does not seem to be an array of %scs�dS)Nrr)rC)�ptrrr
�gettersz3VCPythonEngine._loaded_cpy_variable.<locals>.gettercs|�d<dS)Nrr)rCr6)r�rr
�settersz3VCPythonEngine._loaded_cpy_variable.<locals>.setter)rZr!rrur�r�r}rrMrv�divmodr�rZresolve_length�castr��delattrr�propertyr:�append)
rr%r#rBrCr6�sizeZ	BItemTyper��restZBArrayr�r�r)r�r
�_loaded_cpy_variable�s.




z#VCPythonEngine._loaded_cpy_variablecCs4|j}|d�|d�|d|jd�|d�dS)Nz,static int _cffi_setup_custom(PyObject *lib)r)z  return %s;Tr*)rr+)rr/rrr
r-s
z%VCPythonEngine._generate_setup_custom)r)N)Nr�NTFN)r)r�)Lr?r@rAZ
_class_keyZ_gen_python_modulerrrrrr r&r1rUrWrrHrarbrqrtrir|Z!_generate_cpy_typedef_collecttypeZ_generate_cpy_typedef_declZ_generate_cpy_typedef_methodZ_loading_cpy_typedefZ_loaded_cpy_typedefr�r�r�Z_loading_cpy_functionr�Z _generate_cpy_struct_collecttyper�r�r�r�Z_generate_cpy_union_collecttyper�r�r�r�r�r�r�r�Z#_generate_cpy_anonymous_collecttyper�r�r�r�r�r�r�Z_generate_cpy_constant_methodZ_loading_cpy_constantZ_loaded_cpy_constantr�r�r�Z_generate_cpy_enum_collecttypeZ_generate_cpy_enum_methodr�r�r�Z_generate_cpy_macro_collecttypeZ_generate_cpy_macro_methodZ_loading_cpy_macroZ_loaded_cpy_macror�r�Z_generate_cpy_variable_methodZ_loading_cpy_variabler�r-rrrr
r	s�
[
:
$I
3"	
.

	"rat#
#include <Python.h>
#include <stddef.h>

/* this block of #ifs should be kept exactly identical between
   c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py
   and cffi/_cffi_include.h */
#if defined(_MSC_VER)
# include <malloc.h>   /* for alloca() */
# if _MSC_VER < 1600   /* MSVC < 2010 */
   typedef __int8 int8_t;
   typedef __int16 int16_t;
   typedef __int32 int32_t;
   typedef __int64 int64_t;
   typedef unsigned __int8 uint8_t;
   typedef unsigned __int16 uint16_t;
   typedef unsigned __int32 uint32_t;
   typedef unsigned __int64 uint64_t;
   typedef __int8 int_least8_t;
   typedef __int16 int_least16_t;
   typedef __int32 int_least32_t;
   typedef __int64 int_least64_t;
   typedef unsigned __int8 uint_least8_t;
   typedef unsigned __int16 uint_least16_t;
   typedef unsigned __int32 uint_least32_t;
   typedef unsigned __int64 uint_least64_t;
   typedef __int8 int_fast8_t;
   typedef __int16 int_fast16_t;
   typedef __int32 int_fast32_t;
   typedef __int64 int_fast64_t;
   typedef unsigned __int8 uint_fast8_t;
   typedef unsigned __int16 uint_fast16_t;
   typedef unsigned __int32 uint_fast32_t;
   typedef unsigned __int64 uint_fast64_t;
   typedef __int64 intmax_t;
   typedef unsigned __int64 uintmax_t;
# else
#  include <stdint.h>
# endif
# if _MSC_VER < 1800   /* MSVC < 2013 */
#  ifndef __cplusplus
    typedef unsigned char _Bool;
#  endif
# endif
#else
# include <stdint.h>
# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux)
#  include <alloca.h>
# endif
#endif

#if PY_MAJOR_VERSION < 3
# undef PyCapsule_CheckExact
# undef PyCapsule_GetPointer
# define PyCapsule_CheckExact(capsule) (PyCObject_Check(capsule))
# define PyCapsule_GetPointer(capsule, name) \
    (PyCObject_AsVoidPtr(capsule))
#endif

#if PY_MAJOR_VERSION >= 3
# define PyInt_FromLong PyLong_FromLong
#endif

#define _cffi_from_c_double PyFloat_FromDouble
#define _cffi_from_c_float PyFloat_FromDouble
#define _cffi_from_c_long PyInt_FromLong
#define _cffi_from_c_ulong PyLong_FromUnsignedLong
#define _cffi_from_c_longlong PyLong_FromLongLong
#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong
#define _cffi_from_c__Bool PyBool_FromLong

#define _cffi_to_c_double PyFloat_AsDouble
#define _cffi_to_c_float PyFloat_AsDouble

#define _cffi_from_c_int_const(x)                                        \
    (((x) > 0) ?                                                         \
        ((unsigned long long)(x) <= (unsigned long long)LONG_MAX) ?      \
            PyInt_FromLong((long)(x)) :                                  \
            PyLong_FromUnsignedLongLong((unsigned long long)(x)) :       \
        ((long long)(x) >= (long long)LONG_MIN) ?                        \
            PyInt_FromLong((long)(x)) :                                  \
            PyLong_FromLongLong((long long)(x)))

#define _cffi_from_c_int(x, type)                                        \
    (((type)-1) > 0 ? /* unsigned */                                     \
        (sizeof(type) < sizeof(long) ?                                   \
            PyInt_FromLong((long)x) :                                    \
         sizeof(type) == sizeof(long) ?                                  \
            PyLong_FromUnsignedLong((unsigned long)x) :                  \
            PyLong_FromUnsignedLongLong((unsigned long long)x)) :        \
        (sizeof(type) <= sizeof(long) ?                                  \
            PyInt_FromLong((long)x) :                                    \
            PyLong_FromLongLong((long long)x)))

#define _cffi_to_c_int(o, type)                                          \
    ((type)(                                                             \
     sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o)        \
                                         : (type)_cffi_to_c_i8(o)) :     \
     sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o)       \
                                         : (type)_cffi_to_c_i16(o)) :    \
     sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o)       \
                                         : (type)_cffi_to_c_i32(o)) :    \
     sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o)       \
                                         : (type)_cffi_to_c_i64(o)) :    \
     (Py_FatalError("unsupported size for type " #type), (type)0)))

#define _cffi_to_c_i8                                                    \
                 ((int(*)(PyObject *))_cffi_exports[1])
#define _cffi_to_c_u8                                                    \
                 ((int(*)(PyObject *))_cffi_exports[2])
#define _cffi_to_c_i16                                                   \
                 ((int(*)(PyObject *))_cffi_exports[3])
#define _cffi_to_c_u16                                                   \
                 ((int(*)(PyObject *))_cffi_exports[4])
#define _cffi_to_c_i32                                                   \
                 ((int(*)(PyObject *))_cffi_exports[5])
#define _cffi_to_c_u32                                                   \
                 ((unsigned int(*)(PyObject *))_cffi_exports[6])
#define _cffi_to_c_i64                                                   \
                 ((long long(*)(PyObject *))_cffi_exports[7])
#define _cffi_to_c_u64                                                   \
                 ((unsigned long long(*)(PyObject *))_cffi_exports[8])
#define _cffi_to_c_char                                                  \
                 ((int(*)(PyObject *))_cffi_exports[9])
#define _cffi_from_c_pointer                                             \
    ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[10])
#define _cffi_to_c_pointer                                               \
    ((char *(*)(PyObject *, CTypeDescrObject *))_cffi_exports[11])
#define _cffi_get_struct_layout                                          \
    ((PyObject *(*)(Py_ssize_t[]))_cffi_exports[12])
#define _cffi_restore_errno                                              \
    ((void(*)(void))_cffi_exports[13])
#define _cffi_save_errno                                                 \
    ((void(*)(void))_cffi_exports[14])
#define _cffi_from_c_char                                                \
    ((PyObject *(*)(char))_cffi_exports[15])
#define _cffi_from_c_deref                                               \
    ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[16])
#define _cffi_to_c                                                       \
    ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[17])
#define _cffi_from_c_struct                                              \
    ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[18])
#define _cffi_to_c_wchar_t                                               \
    ((wchar_t(*)(PyObject *))_cffi_exports[19])
#define _cffi_from_c_wchar_t                                             \
    ((PyObject *(*)(wchar_t))_cffi_exports[20])
#define _cffi_to_c_long_double                                           \
    ((long double(*)(PyObject *))_cffi_exports[21])
#define _cffi_to_c__Bool                                                 \
    ((_Bool(*)(PyObject *))_cffi_exports[22])
#define _cffi_prepare_pointer_call_argument                              \
    ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23])
#define _cffi_convert_array_from_object                                  \
    ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24])
#define _CFFI_NUM_EXPORTS 25

typedef struct _ctypedescr CTypeDescrObject;

static void *_cffi_exports[_CFFI_NUM_EXPORTS];
static PyObject *_cffi_types, *_cffi_VerificationError;

static int _cffi_setup_custom(PyObject *lib);   /* forward */

static PyObject *_cffi_setup(PyObject *self, PyObject *args)
{
    PyObject *library;
    int was_alive = (_cffi_types != NULL);
    (void)self; /* unused */
    if (!PyArg_ParseTuple(args, "OOO", &_cffi_types, &_cffi_VerificationError,
                                       &library))
        return NULL;
    Py_INCREF(_cffi_types);
    Py_INCREF(_cffi_VerificationError);
    if (_cffi_setup_custom(library) < 0)
        return NULL;
    return PyBool_FromLong(was_alive);
}

static int _cffi_init(void)
{
    PyObject *module, *c_api_object = NULL;

    module = PyImport_ImportModule("_cffi_backend");
    if (module == NULL)
        goto failure;

    c_api_object = PyObject_GetAttrString(module, "_C_API");
    if (c_api_object == NULL)
        goto failure;
    if (!PyCapsule_CheckExact(c_api_object)) {
        PyErr_SetNone(PyExc_ImportError);
        goto failure;
    }
    memcpy(_cffi_exports, PyCapsule_GetPointer(c_api_object, "cffi"),
           _CFFI_NUM_EXPORTS * sizeof(void *));

    Py_DECREF(module);
    Py_DECREF(c_api_object);
    return 0;

  failure:
    Py_XDECREF(module);
    Py_XDECREF(c_api_object);
    return -1;
}

#define _cffi_type(num) ((CTypeDescrObject *)PyList_GET_ITEM(_cffi_types, num))

/**********/
)	rFrrrrSrrNrr,rrrr
�<module>su

?>