AlkantarClanX12

Your IP : 18.188.227.108


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

3

M��Z0T�@s�ddlZddlZddlmZddlmZmZmZdZdZ	dZ
dd�ZGd	d
�d
e�Z
Gdd�de
�ZGd
d�de�Ze�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zee�Zdd �Zee�ZGd!d"�d"e�ZGd#d$�d$e�Zeed%�d�ZGd&d'�d'e
�ZGd(d)�d)e�Z Gd*d+�d+e �Z!Gd,d-�d-e �Z"Gd.d/�d/e�Z#d<d0d1�Z$d=d2d3�Z%e�Z&ej'�Z(d4d5�Z)d6d7�Z*d8d9�Z+d:d;�Z,dS)>�N�)�
allocate_lock)�	CDefError�VerificationError�VerificationMissing��cCs@|t@rd|j�}|t@r(d|j�}|t@r<d|j�}|S)Nz const z
 volatile z __restrict )�Q_CONST�lstrip�
Q_VOLATILE�
Q_RESTRICT)�quals�replace_with�r�/usr/lib64/python3.6/model.py�qualifysrc@sPeZdZdZdZddd�Zdd�Zd	d
�Zdd�Zdd
d�Z	dd�Z
dd�ZdS)�BaseTypeByIdentityF��a C filercCs�|j}|jd�dkst�|j�}|rT|jd�r@d|kr@d|}n|ddkrTd|}t||�}|jd|�}d	|kr�td
|j�|f��|S)N�&r�*z&[z(%s)rz[(� �$z-cannot generate '%s' in %s: unknown type name)	�c_name_with_marker�count�AssertionError�strip�
startswithr�replacer�_get_c_name)�selfr�contextr
�resultrrr�
get_c_names

zBaseTypeByIdentity.get_c_namecCs|jjdd�S)Nrr)rr)r rrrr/szBaseTypeByIdentity._get_c_namecCsd|j�kS)Nr)r)r rrr�
has_c_name2szBaseTypeByIdentity.has_c_namecCsdS)NFr)r rrr�is_integer_type5sz"BaseTypeByIdentity.is_integer_typecCsNy|j|}Wn:tk
rH|j||�}|jj||�}||ksDt�YnX|S)N)�_cached_btypes�KeyError�build_backend_type�
setdefaultr)r �ffi�
finishlist�	can_delay�BTypeZBType2rrr�get_cached_btype8sz#BaseTypeByIdentity.get_cached_btypecCsd|j�fS)Nz<%s>)r)r rrr�__repr__AszBaseTypeByIdentity.__repr__cs�fdd��jD�S)Ncsg|]}|t�|�f�qSr)�getattr)�.0�name)r rr�
<listcomp>Esz1BaseTypeByIdentity._get_items.<locals>.<listcomp>)�_attrs_)r r)r r�
_get_itemsDszBaseTypeByIdentity._get_itemsN)rrr)F)�__name__�
__module__�__qualname__�
is_array_type�is_raw_functionr#rr$r%r.r/r5rrrrrs

	rc@s$eZdZdd�Zdd�Zdd�ZdS)�BaseTypecCs|j|jko|j�|j�kS)N)�	__class__r5)r �otherrrr�__eq__JszBaseType.__eq__cCs
||kS)Nr)r r=rrr�__ne__NszBaseType.__ne__cCst|jt|j��f�S)N)�hashr<�tupler5)r rrr�__hash__QszBaseType.__hash__N)r6r7r8r>r?rBrrrrr;Hsr;c@s eZdZfZdd�Zdd�ZdS)�VoidTypecCs
d|_dS)Nzvoid&)r)r rrr�__init__XszVoidType.__init__cCst||d�S)NZ
new_void_type)�global_cache)r r*r+rrrr([szVoidType.build_backend_typeN)r6r7r8r4rDr(rrrrrCUsrCc@seZdZdd�ZdS)�BasePrimitiveTypecCsdS)NFr)r rrr�is_complex_typebsz!BasePrimitiveType.is_complex_typeN)r6r7r8rGrrrrrFasrFc4@s�eZdZdZdddddddddddddddddddddddddddddddddddddddddddddddddddd�3Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dS)�
PrimitiveTyper2�c�i�f�j)3�charZshort�int�longz	long longzsigned charz
unsigned charzunsigned shortzunsigned intz
unsigned longzunsigned long long�floatZdoublezlong doublezfloat _Complexzdouble _ComplexZ_BoolZwchar_tZchar16_tZchar32_tZint8_tZuint8_tZint16_tZuint16_tZint32_tZuint32_tZint64_tZuint64_tZint_least8_tZ
uint_least8_tZ
int_least16_tZuint_least16_tZ
int_least32_tZuint_least32_tZ
int_least64_tZuint_least64_tZint_fast8_tZuint_fast8_tZint_fast16_tZ
uint_fast16_tZint_fast32_tZ
uint_fast32_tZint_fast64_tZ
uint_fast64_tZintptr_tZ	uintptr_tZintmax_tZ	uintmax_tZ	ptrdiff_tZsize_tZssize_tcCs"||jkst�||_|d|_dS)Nr)�ALL_PRIMITIVE_TYPESrr2r)r r2rrrrD�szPrimitiveType.__init__cCs|j|jdkS)NrI)rQr2)r rrr�is_char_type�szPrimitiveType.is_char_typecCs|j|jdkS)NrJ)rQr2)r rrrr%�szPrimitiveType.is_integer_typecCs|j|jdkS)NrK)rQr2)r rrr�
is_float_type�szPrimitiveType.is_float_typecCs|j|jdkS)NrL)rQr2)r rrrrG�szPrimitiveType.is_complex_typecCst||d|j�S)NZnew_primitive_type)rEr2)r r*r+rrrr(�sz PrimitiveType.build_backend_typeN)r2)r6r7r8r4rQrDrRr%rSrGr(rrrrrHfstrHc@s(eZdZd	Zdd�Zdd�Zdd�ZdS)
�UnknownIntegerTyper2cCs||_|d|_dS)Nr)r2r)r r2rrrrD�szUnknownIntegerType.__init__cCsdS)NTr)r rrrr%�sz"UnknownIntegerType.is_integer_typecCstd|j��dS)Nz4integer type '%s' can only be used after compilation)�NotImplementedErrorr2)r r*r+rrrr(�sz%UnknownIntegerType.build_backend_typeN)r2)r6r7r8r4rDr%r(rrrrrT�srTc@s eZdZdZdd�Zdd�ZdS)�UnknownFloatTyper2cCs||_|d|_dS)Nr)r2r)r r2rrrrD�szUnknownFloatType.__init__cCstd|j��dS)Nz2float type '%s' can only be used after compilation)rUr2)r r*r+rrrr(�sz#UnknownFloatType.build_backend_typeN)r2)r6r7r8r4rDr(rrrrrV�srVc@seZdZdZd	dd�ZdS)
�BaseFunctionType�argsr"�ellipsis�abiNcCs�||_||_||_||_dd�|jD�}|jr8|jd�|p@dg}|jdj|�f}|dk	r||dd�|d|dd�}|jjjd|�|_dS)	NcSsg|]}|j��qSr)r)r1�argrrrr3�sz-BaseFunctionType.__init__.<locals>.<listcomp>z...�voidz, rrr)	rXr"rYrZ�append�
_base_pattern�joinrr)r rXr"rYrZZreprargsrrrrrD�s

 zBaseFunctionType.__init__)rXr"rYrZ)N)r6r7r8r4rDrrrrrW�srWc@s$eZdZdZdZdd�Zdd�ZdS)�RawFunctionTypez(&)(%s)TcCstd|f��dS)NzPcannot render the type %r: it is a function type, not a pointer-to-function type)r)r r*r+rrrr(�sz"RawFunctionType.build_backend_typecCst|j|j|j|j�S)N)�FunctionPtrTyperXr"rYrZ)r rrr�as_function_pointer�sz#RawFunctionType.as_function_pointerN)r6r7r8r^r:r(rbrrrrr`�sr`c@s eZdZdZdd�Zdd�ZdS)raz(*&)(%s)cCs�|jj||�}g}x |jD]}|j|j||��qWf}|jdkrl|jsly|jjf}Wntk
rjYnXt	||dt
|�||jf|��S)NZ	__stdcallZnew_function_type)r"r.rXr]rZrY�_backendZFFI_STDCALL�AttributeErrorrErA)r r*r+r"rX�tpZabi_argsrrrr(�s
z"FunctionPtrType.build_backend_typecCst|j|j|j|j�S)N)r`rXr"rYrZ)r rrr�as_raw_functionszFunctionPtrType.as_raw_functionN)r6r7r8r^r(rfrrrrra�srac@s"eZdZd	Zd
dd�Zdd�ZdS)�PointerType�totyper
rcCs>||_||_t|d�}|jr*d|j�f}|jjd|�|_dS)Nz *&z(%s)r)rhr
rr9r
rr)r rhr
ZextrarrrrDs
zPointerType.__init__cCs |jj||dd�}t||d|�S)NT)r,�new_pointer_type)rhr.rE)r r*r+ZBItemrrrr(szPointerType.build_backend_typeN)rhr
)r)r6r7r8r4rDr(rrrrrgs
rgcCs
t|t�S)N)rgr	)rhrrr�ConstPointerTypesrjc@seZdZdZddd�ZdS)	�NamedPointerTyperhr2rcCs"tj|||�||_|d|_dS)Nr)rgrDr2r)r rhr2r
rrrrDszNamedPointerType.__init__N)rhr2)r)r6r7r8r4rDrrrrrksrkc@s,eZdZdZdZdd�Zdd�Zdd	�Zd
S)�	ArrayType�item�lengthTcCsF||_||_|dkrd}n|dkr(d}nd|}|jjjd|�|_dS)Nz&[]z...z
&[/*...*/]z&[%s]r)rmrnrr)r rmrnZbracketsrrrrD)szArrayType.__init__cCst|j|�S)N)rlrm)r Z	newlengthrrr�resolve_length6szArrayType.resolve_lengthcCsJ|jdkrtd|f��|jj||�t|j�j||�}t||d||j�S)Nz...z)cannot render the type %r: unknown lengthZnew_array_type)rnrrmr.rgrE)r r*r+ZBPtrItemrrrr(9s

zArrayType.build_backend_typeN)rmrn)r6r7r8r4r9rDror(rrrrrl%s

rlrMc@s,eZdZd	ZdZdd�Zdd�Zdd�ZdS)
�StructOrUnionOrEnumr2NcCs$|jpd|j|jf}|d|_dS)Nz%s %sr)�	forcename�kindr2r)r r2rrr�build_c_name_with_markerHsz,StructOrUnionOrEnum.build_c_name_with_markercCs||_|j�dS)N)rqrs)r rqrrr�force_the_nameLsz"StructOrUnionOrEnum.force_the_namecCs|jjd�st�|jdd�S)Nrr���)r�endswithr)r rrr�get_official_namePsz%StructOrUnionOrEnum.get_official_name)r2)r6r7r8r4rqrsrtrwrrrrrpDs
rpc@sjeZdZdZdZdZdZddd�Zdd�Zdd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dd�Zdd�ZdS)�
StructOrUnionNrFcCs*||_||_||_||_||_|j�dS)N)r2�fldnames�fldtypes�
fldbitsize�fldqualsrs)r r2ryrzr{r|rrrrD[szStructOrUnion.__init__ccsB|jdk	r>x2t|j|j�D] \}}|dkrt|t�r|VqWdS)Nr)rz�zipry�
isinstancerx)r r2�typerrr�anonymous_struct_fieldscs
z%StructOrUnion.anonymous_struct_fieldsTccs�|j}|dkrdt|j�}xbt|j|j|j|�D]J\}}}}|dkrnt|t�rn|rnx&|j�D]
}|Vq^Wq2||||fVq2WdS)Nrr)r)	r|�lenryr}rzr{r~rx�
enumfields)r Zexpand_anonymous_struct_unionr|r2r�bitsizer
r"rrrr�iszStructOrUnion.enumfieldsc	Cs~g}g}g}g}x@|j�D]4\}}}}|j|�|j|�|j|�|j|�qWt|�|_t|�|_t|�|_t|�|_dS)N)r�r]rAryrzr{r|)	r �names�typesZbitsizesr|r2rr�r
rrr�
force_flattenws





zStructOrUnion.force_flattencCs$tj||||�}|s |j||�|S)N)rpr.�finish_backend_type)r r*r+r,r-rrrr.�s

zStructOrUnion.get_cached_btypecs|jr$|jdkr td|jf��dS�j|}d|_|jdkrB�n�|jdkr���fdd�|jD�}tt|j||j	��}d}|j
r�d}�jj|||dd
|��ntg}|j\}}}	}
�x4t
t|j��D�] }||}|j|}
t|
t�o�|
jdk�rn|
jj���}t|�j|��\}}|dk�r<|jd	|j|j|�p4d
f�|
j|�}
|jd|�|
f|j|dd�|_|
j���}t|
t��r�|
jdk�r�|dk�s�t�n8�j|�}||k�r�|jd|j|j|�p�d
||f�|j|�q�Wtt|j||j	|��}�jj||||	|
�d|_dS)Nrz(recursive structure declaration for '%s'rcsg|]}|j����qSr)r.)r1re)r*r+rrr3�sz5StructOrUnion.finish_backend_type.<locals>.<listcomp>r�z...zfield '%s.%s' has a bogus size?z{}z=field '%s.%s' is declared as %d bytes, but is really %d bytesruru)�	completedrUr2r&rz�fixedlayout�listr}ryr{�packedrcZcomplete_struct_or_union�ranger�r~rlrnrmr.�divmod�sizeof�_verification_errorrorr])r r*r+r-rzZlstZsflagsZfieldofsZ	fieldsizeZ	totalsizeZtotalalignmentrJZfsizeZftypeZ	BItemTypeZnlenZnrestZ
BFieldTypeZ	bitemsizer)r*r+rr��s`









z!StructOrUnion.finish_backend_typecCst|��dS)N)r)r �msgrrrr��sz!StructOrUnion._verification_errorcCs |jr|jdkrt|j���dS)N)�partialr�rr)r rrr�check_not_partial�szStructOrUnion.check_not_partialcCs.|j�|j|�t||d|j|j�|d�S)Nznew_%s_type)�key)r�r]rErrrw)r r*r+rrrr(�s
z StructOrUnion.build_backend_type)N)T)F)r6r7r8r�r�r�r�rDr�r�r�r.r�r�r�r(rrrrrxUs


<rxc@seZdZdZdS)�
StructType�structN)r6r7r8rrrrrrr��sr�c@seZdZdZdS)�	UnionType�unionN)r6r7r8rrrrrrr��sr�c@sBeZdZdZdZdZddd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�EnumType�enumFNcCs$||_||_||_||_|j�dS)N)r2�enumerators�
enumvalues�baseinttypers)r r2r�r�r�rrrrD�s
zEnumType.__init__cCs4tj||�|jdkr0|j�}d|jdd�|_dS)Nrr�_)rprtrqrwr)r rqr2rrrrt�s
zEnumType.force_the_namecCs|jr|jrt|j���dS)N)r��partial_resolvedrr)r rrrr��szEnumType.check_not_partialc
Cs4|j�|j||�}t||d|j�|j|j||d�S)NZ
new_enum_type)r�)r��build_baseinttyperErwr�r�)r r*r+Z
base_btyperrrr(�szEnumType.build_backend_typec
CsH|jdk	r|jj||�S|jr4t|j�}t|j�}nDddl}ytj�Wntk
r\YnX|j	d|j
��d}}|dkr�d}td�}td�}nd}td�}td�}|j||�}	|j||�}
|j|	�}|j|
�}|d
d|d>ko�|dd||>k�r|	S|dd|d>k�r4|dd||>k�r4|
St
d	|j
���dS)NrzU%r has no values explicitly defined; guessing that it is equivalent to 'unsigned int'rrNrOzunsigned intz
unsigned longr�z=%s values don't all fit into either 'long' or 'unsigned long'ruru)r�r.r��min�max�warningsZ__warningregistry__�clear�	NameError�warnrrHr�r)
r r*r+Zsmallest_valueZ
largest_valuer�ZsignZ
candidate1Z
candidate2Zbtype1Zbtype2Zsize1Zsize2rrrr�s@




zEnumType.build_baseinttype)N)r6r7r8rrr�r�rDrtr�r(r�rrrrr��s
r�cCs2|dkrd|}t|ddd�}|j|�d|_|S)Nz$%s�unknown_type)r�rt�origin)r2�
structnamererrrr�*s
r�cCs(|dkrd|}t|ddd�}t||�S)Nz$$%s)r�rk)r2r�rerrr�unknown_ptr_type2sr�c
CsFt|tj�rtSt�(tt|�d�s2tj�t|�_	t|�j	SQRXdS)N�__typecache)
r~r��
ModuleType�_typecache_cffi_backend�global_lock�hasattrr�weakref�WeakValueDictionaryr�)Zbackendrrr�
get_typecache<sr�c
 Os�|jd||f�}|st�y
|j|Stk
r8YnXyt|j|�|�}Wn4tk
r�}ztd|||f��WYdd}~XnX|j}t�(|j|�}	|	dkr�|||<|S|	SWdQRXdS)Nr�z
%s: %r: %s)	�poprZ
_typecacher'r0rcrUr��get)
Zsrctyper*�funcnamerX�kwdsr��res�e�cacheZres1rrrrEGs"

$
rEcCstd|d|�S)N�?ri)rE)r*r-rrr�
pointer_cache^sr�cCs@|jr<t|jd�tkr<d||jdff|jdd�|_dS)Nrz%s: %sr)rXr�str)r�r2rrr�attach_exception_infoasr�)N)N)-r�r��lockr�errorrrrr	rrr�objectrr;rCZ	void_typerFrHrTrVrWr`rargZ
voidp_typerjZconst_voidp_typerkrlZchar_array_typerprxr�r�r�r�r�r�r�r�r�rEr�r�rrrr�<module>sN
/
	L	G