ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/model.cpython-38.pyc

U

ل=^�T�@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&e�'�Z(d4d5�Z)d6d7�Z*d8d9�Z+d:d;�Z,dS)>�N�)�
allocate_lock)�	CDefError�VerificationError�VerificationMissing��cCs@|t@rd|��}|t@r(d|��}|t@r<d|��}|S)Nz const z
 volatile z __restrict )�Q_CONST�lstrip�
Q_VOLATILE�
Q_RESTRICT)�quals�replace_with�r�	/model.py�qualifysrc@sPeZdZdZdZddd�Zdd�Zd	d
�Zdd�Zdd
d�Z	dd�Z
dd�ZdS)�BaseTypeByIdentityF��a C filercCs�|j}|�d�dkst�|��}|rT|�d�r@d|kr@d|}n|ddkrTd|}t||�}|�d|�}d	|kr�td
|��|f��|S)N�&r�*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|j�dd�S)Nrr)rr�r!rrrr /szBaseTypeByIdentity._get_c_namecCsd|��kS)Nr�r r%rrr�
has_c_name2szBaseTypeByIdentity.has_c_namecCsdS�NFrr%rrr�is_integer_type5sz"BaseTypeByIdentity.is_integer_typecCsNz|j|}Wn:tk
rH|�||�}|j�||�}||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|��fS)Nz<%s>r&r%rrr�__repr__AszBaseTypeByIdentity.__repr__cs�fdd��jD�S)Ncsg|]}|t�|�f�qSr)�getattr)�.0�namer%rr�
<listcomp>Esz1BaseTypeByIdentity._get_items.<locals>.<listcomp>)�_attrs_r%rr%r�
_get_itemsDszBaseTypeByIdentity._get_itemsN)rrr)F)�__name__�
__module__�__qualname__�
is_array_type�is_raw_functionr$r r'r)r3r4r:rrrrrs

	rc@s$eZdZdd�Zdd�Zdd�ZdS)�BaseTypecCs|j|jko|��|��kSr*)�	__class__r:�r!�otherrrr�__eq__Js�zBaseType.__eq__cCs
||kSr*rrBrrr�__ne__NszBaseType.__ne__cCst|jt|���f�Sr*)�hashrA�tupler:r%rrr�__hash__QszBaseType.__hash__N)r;r<r=rDrErHrrrrr@Hsr@c@s eZdZdZdd�Zdd�ZdS)�VoidTypercCs
d|_dS)Nzvoid&)rr%rrr�__init__XszVoidType.__init__cCst||d�S)NZ
new_void_type��global_cache�r!r/r0rrrr-[szVoidType.build_backend_typeN�r;r<r=r9rJr-rrrrrIUsrIc@seZdZdd�ZdS)�BasePrimitiveTypecCsdSr(rr%rrr�is_complex_typebsz!BasePrimitiveType.is_complex_typeN)r;r<r=rPrrrrrOasrOc4@s�eZdZdZdddddddddddddddddddddddddddddddddddddddddddddddddddd�3Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dS)�
PrimitiveType�r7�c�i�f�j)3�charZshort�int�longz	long longzsigned charz
unsigned charzunsigned short�unsigned int�
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_TYPESrr7r�r!r7rrrrJ�szPrimitiveType.__init__cCs|j|jdkS)NrS�r^r7r%rrr�is_char_type�szPrimitiveType.is_char_typecCs|j|jdkS)NrTr`r%rrrr)�szPrimitiveType.is_integer_typecCs|j|jdkS)NrUr`r%rrr�
is_float_type�szPrimitiveType.is_float_typecCs|j|jdkS)NrVr`r%rrrrP�szPrimitiveType.is_complex_typecCst||d|j�S)NZnew_primitive_type)rLr7rMrrrr-�sz PrimitiveType.build_backend_typeN)r;r<r=r9r^rJrar)rbrPr-rrrrrQfsv�7rQc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�UnknownIntegerTyperRcCs||_|d|_dSr]�r7rr_rrrrJ�szUnknownIntegerType.__init__cCsdS)NTrr%rrrr)�sz"UnknownIntegerType.is_integer_typecCstd|j��dS)Nz4integer type '%s' can only be used after compilation��NotImplementedErrorr7rMrrrr-�s�z%UnknownIntegerType.build_backend_typeN)r;r<r=r9rJr)r-rrrrrc�srcc@s eZdZdZdd�Zdd�ZdS)�UnknownFloatTyperRcCs||_|d|_dSr]rdr_rrrrJ�szUnknownFloatType.__init__cCstd|j��dS)Nz2float type '%s' can only be used after compilationrerMrrrr-�s�z#UnknownFloatType.build_backend_typeNrNrrrrrg�srgc@seZdZdZddd�ZdS)�BaseFunctionType)�argsr#�ellipsis�abiNcCs�||_||_||_||_dd�|jD�}|jr8|�d�|p@dg}|jd�|�f}|dk	r||dd�|d|dd�}|jj�d|�|_dS)	NcSsg|]}|���qSrr&)r6�argrrrr8�sz-BaseFunctionType.__init__.<locals>.<listcomp>�...Zvoidz, rrr)	rir#rjrk�append�
_base_pattern�joinrr)r!rir#rjrkZreprargsrrrrrJ�s

 �zBaseFunctionType.__init__)N�r;r<r=r9rJrrrrrh�srhc@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)rrMrrrr-�s�z"RawFunctionType.build_backend_typecCst|j|j|j|j�Sr*)�FunctionPtrTyperir#rjrkr%rrr�as_function_pointer�sz#RawFunctionType.as_function_pointerN)r;r<r=ror?r-rtrrrrrr�srrc@s eZdZdZdd�Zdd�ZdS)rsz(*&)(%s)cCs�|j�||�}g}|jD]}|�|�||��qd}|jdkrh|jshz|jjf}Wntk
rfYnXt	||dt
|�||jf|��S)NrZ	__stdcallZnew_function_type)r#r3rirnrkrj�_backendZFFI_STDCALL�AttributeErrorrLrG)r!r/r0r#ri�tpZabi_argsrrrr-�s$

��z"FunctionPtrType.build_backend_typecCst|j|j|j|j�Sr*)rrrir#rjrkr%rrr�as_raw_functionszFunctionPtrType.as_raw_functionN)r;r<r=ror-rxrrrrrs�srsc@s"eZdZdZddd�Zdd�ZdS)	�PointerType)�totyper
rcCs>||_||_t|d�}|jr*d|��f}|j�d|�|_dS)Nz *&rr)rzr
rr>r
rr)r!rzr
ZextrarrrrJs
zPointerType.__init__cCs |jj||dd�}t||d|�S)NT)r1�new_pointer_type)rzr3rL)r!r/r0ZBItemrrrr-szPointerType.build_backend_typeN)rrNrrrrrys
rycCs
t|t�Sr*)ryr	)rzrrr�ConstPointerTypesr|c@seZdZdZddd�ZdS)�NamedPointerType)rzr7rcCs"t�|||�||_|d|_dSr])ryrJr7r)r!rzr7r
rrrrJszNamedPointerType.__init__N)rrqrrrrr}sr}c@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�	ArrayType)�item�lengthTcCsF||_||_|dkrd}n|dkr(d}nd|}|jj�d|�|_dS)Nz&[]rmz
&[/*...*/]z&[%s]r)rr�rr)r!rr�ZbracketsrrrrJ)s�zArrayType.__init__cCst|j|�Sr*)r~r)r!Z	newlengthrrr�resolve_length6szArrayType.resolve_lengthcCsJ|jdkrtd|f��|j�||�t|j��||�}t||d||j�S)Nrmz)cannot render the type %r: unknown lengthZnew_array_type)r�rrr3ryrL)r!r/r0ZBPtrItemrrrr-9s
�zArrayType.build_backend_typeN)r;r<r=r9r>rJr�r-rrrrr~%s

r~rWc@s,eZdZdZdZdd�Zdd�Zdd�ZdS)	�StructOrUnionOrEnumrRNcCs$|jpd|j|jf}|d|_dS)Nz%s %sr)�	forcename�kindr7rr_rrr�build_c_name_with_markerHsz,StructOrUnionOrEnum.build_c_name_with_markercCs||_|��dSr*)r�r�)r!r�rrr�force_the_nameLsz"StructOrUnionOrEnum.force_the_namecCs|j�d�st�|jdd�S)Nr���)r�endswithrr%rrr�get_official_namePsz%StructOrUnionOrEnum.get_official_name)r;r<r=r9r�r�r�r�rrrrr�Ds
r�c@sjeZdZdZdZdZdZddd�Zdd�Zdd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dd�Zdd�ZdS)�
StructOrUnionNrFcCs*||_||_||_||_||_|��dSr*)r7�fldnames�fldtypes�
fldbitsize�fldqualsr�)r!r7r�r�r�r�rrrrJ[szStructOrUnion.__init__ccs>|jdk	r:t|j|j�D] \}}|dkrt|t�r|VqdS)Nr)r��zipr��
isinstancer�)r!r7�typerrr�anonymous_struct_fieldscs
z%StructOrUnion.anonymous_struct_fieldsTccs||j}|dkrdt|j�}t|j|j|j|�D]F\}}}}|dkrht|t�rh|rh|��D]
}|VqZq0||||fVq0dS)N)rr)	r��lenr�r�r�r�r�r��
enumfields)r!Zexpand_anonymous_struct_unionr�r7r��bitsizer
r#rrrr�is
��
zStructOrUnion.enumfieldsc	Cszg}g}g}g}|��D]4\}}}}|�|�|�|�|�|�|�|�qt|�|_t|�|_t|�|_t|�|_dSr*)r�rnrGr�r�r�r�)	r!�names�typesZbitsizesr�r7r�r�r
rrr�
force_flattenws





zStructOrUnion.force_flattencCs$t�||||�}|s |�||�|Sr*)r�r3�finish_backend_type)r!r/r0r1r2rrrr3�s
�zStructOrUnion.get_cached_btypecs2|jr$|jdkr td|jf��dS�j|}d|_|jdkrB�n�|jdkr���fdd�|jD�}tt|j||j	��}d}|j
r�|j
dkr�d}n
d|j
f}�jj|||d	d	f|���npg}|j\}}}	}
t
t|j��D�]"}||}|j|}
t|
t��r�|
jd
k�r�|
j����}t|��|��\}}|dk�rT|�d|j|j|�pLdf�|
�|�}
|jd|�|
f|j|dd�|_|
����}t|
t��r�|
jdk�r�|dk�s�t�n8��|�}||k�r�|�d
|j|j|�p�d||f�|�|�q�tt|j||j	|��}�j�||||	|
�d|_dS)Nrz(recursive structure declaration for '%s'rcsg|]}|�����qSr)r3)r6rw�r/r0rrr8�s�z5StructOrUnion.finish_backend_type.<locals>.<listcomp>r)�rr�rmzfield '%s.%s' has a bogus size?z{}z=field '%s.%s' is declared as %d bytes, but is really %d bytes)�	completedrfr7r+r��fixedlayout�listr�r�r��packedruZcomplete_struct_or_union�ranger�r�r~r�rr3�divmod�sizeof�_verification_errorr�rrn)r!r/r0r2r�Zlst�extra_flagsZfieldofsZ	fieldsizeZ	totalsizeZtotalalignmentrTZfsizeZftypeZ	BItemTypeZnlenZnrestZ
BFieldTypeZ	bitemsizerr�rr��s�
�


�

��


��
�

����z!StructOrUnion.finish_backend_typecCst|��dSr*)r)r!�msgrrrr��sz!StructOrUnion._verification_errorcCs |jr|jdkrt|����dSr*)�partialr�rr r%rrr�check_not_partial�szStructOrUnion.check_not_partialcCs.|��|�|�t||d|j|��|d�S)Nznew_%s_type��key)r�rnrLr�r�rMrrrr-�s
�z StructOrUnion.build_backend_type)N)T)F)r;r<r=r�r�r�r�rJr�r�r�r3r�r�r�r-rrrrr�Us


?r�c@seZdZdZdS)�
StructType�structN�r;r<r=r�rrrrr��sr�c@seZdZdZdS)�	UnionType�unionNr�rrrrr��sr�c@sBeZdZdZdZdZddd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�EnumType�enumFNcCs$||_||_||_||_|��dSr*)r7�enumerators�
enumvalues�baseinttyper�)r!r7r�r�r�rrrrJ�s
zEnumType.__init__cCs4t�||�|jdkr0|��}d|�dd�|_dS)Nrr�_)r�r�r�r�r)r!r�r7rrrr��s
zEnumType.force_the_namecCs|jr|jst|����dSr*)r��partial_resolvedrr r%rrrr��szEnumType.check_not_partialc
Cs4|��|�||�}t||d|��|j|j||d�S)NZ
new_enum_typer�)r��build_baseinttyperLr�r�r�)r!r/r0Z
base_btyperrrr-�s�zEnumType.build_backend_typec
CsJ|jdk	r|j�||�S|jr4t|j�}t|j�}nDddl}zt��Wntk
r\YnX|�	d|�
��d}}|dkr�d}td�}td�}nd}td�}td�}|�||�}	|�||�}
|�|	�}|�|
�}|dd	|d>k�r|dd	||>k�r|	S|dd	|d>k�r6|dd	||>k�r6|
St
d
|�
���dS)NrzU%r has no values explicitly defined; guessing that it is equivalent to 'unsigned int'rrXrYrZr[r�r�z=%s values don't all fit into either 'long' or 'unsigned long')r�r3r��min�max�warningsZ__warningregistry__�clear�	NameError�warnr rQr�r)
r!r/r0Zsmallest_valueZ
largest_valuer�ZsignZ
candidate1Z
candidate2Zbtype1Zbtype2Zsize1Zsize2rrrr�sH

�


���zEnumType.build_baseinttype)N)r;r<r=r�r�r�rJr�r�r-r�rrrrr��s
r�cCs2|dkrd|}t|ddd�}|�|�d|_|S)Nz$%s�unknown_type)r�r��origin�r7Z
structnamerwrrrr�-s
r�cCs(|dkrd|}t|ddd�}t||�S)Nz$$%s)r�r}r�rrr�unknown_ptr_type5sr�c
CsRt|tj�rtSt�4tt|�d�s2t��t|�_	t|�j	W5QR�SQRXdS)N�__typecache)
r�r��
ModuleType�_typecache_cffi_backend�global_lock�hasattrr��weakref�WeakValueDictionaryr�)Zbackendrrr�
get_typecache?sr�c

Os�|�d||f�}|rt�z|j|WStk
r8YnXzt|j|�|�}Wn4tk
r�}ztd|||f��W5d}~XYnX|j}t�@|�|�}	|	dkr�|||<|W5QR�S|	W5QR�SW5QRXdS)Nr�z
%s: %r: %s)	�poprZ
_typecacher,r5rurfr��get)
Zsrctyper/�funcnameri�kwdsr��res�e�cacheZres1rrrrLJs"$
rLcCstd|d|�S)N�?r{rK)r/r2rrr�
pointer_cacheasr�cCs@|jr<t|jd�tkr<d||jdff|jdd�|_dS)Nrz%s: %sr)rir��str)r�r7rrr�attach_exception_infodsr�)N)N)-r�r��lockr�errorrrrr	rrr�objectrr@rIZ	void_typerOrQrcrgrhrrrsryZ
voidp_typer|Zconst_voidp_typer}r~Zchar_array_typer�r�r�r�r�r�r�r�r�r�r�rLr�r�rrrr�<module>sN
/
	L	
G



Zerion Mini Shell 1.0