Your IP : 18.225.54.147


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/cffi/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/cffi/__pycache__/recompiler.cpython-311.pyc

�

S�DgV����ddlZddlZddlZddlmZmZddlmZddlTdZ	dZ
dZejd	kpej
d
kp
ej
dkZGd�d
��ZGd�d��ZGd�d��ZGd�d��ZGd�d��ZGd�d��Zej
dkrejZnGd�dej��Zd�Zd(d�Zd(d�Zd�Zd �Zd!�Zd"�Zd#�Z			d)d'�Z dS)*�N�)�ffiplatform�model)�VerificationError)�*i&i'i(�win32)�r)r	�c�"�eZdZdd�Zd�Zd�ZdS)�
GlobalExprrc�L�||_||_||_||_||_dS�N)�name�address�type_op�size�check_value)�selfrrrrrs      �q/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/cffi/recompiler.py�__init__zGlobalExpr.__init__s,����	���������	�&�����c	�l�d|j�d|j�d|j����d|j�d�	S)N�  { "z", (void *)�, z
, (void *)� },)rrr�	as_c_exprr�rs rrzGlobalExpr.as_c_exprs?����I�I�I�t�|�|�|�T�\�%;�%;�%=�%=�%=�%=�t�y�y�y�J�	Jrc�T�d|j���|j|jfzS)Nz
b'%s%s',%d)r�as_python_bytesrrrs r�as_python_exprzGlobalExpr.as_python_exprs.���t�|�;�;�=�=�t�y�#�/�1�1�	1rN)rr��__name__�
__module__�__qualname__rrr �rrrrsI������'�'�'�'�J�J�J�1�1�1�1�1rrc�&�eZdZd�Zd�Zd�Zd�ZdS)�	FieldExprc�L�||_||_||_||_||_dSr)r�field_offset�
field_size�fbitsize�
field_type_op)rrr)r*r+r,s      rrzFieldExpr.__init__s-����	�(���$��� ��
�*����rc��dt|j��z}d|j�d|j�d�d|�d|j�d�zd|�d|j����d�zS)N� r�", z,
z     z   r)�lenrr)r*r,r)r�spacess  rrzFieldExpr.as_c_expr&sy���s�4�9�~�~�%���%)�Y�Y�Y��0A�0A�0A�B�B�%+�V�V�T�_�_�_�=�>�>�%+�V�V�T�-?�-I�-I�-K�-K�-K�-K�L�M�	Nrc��t�r)�NotImplementedErrorrs rr zFieldExpr.as_python_expr,s��!�!rc���|jjtkrd}n1|jjtkrt	|j��}nt�d|j����|�|j�d�S)N��b'�')	r,�op�OP_NOOP�OP_BITFIELD�format_four_bytesr+r3rr)r�	size_exprs  r�as_field_python_exprzFieldExpr.as_field_python_expr/sp���� �G�+�+��I�I�
�
�
"�k�
1�
1�)�$�-�8�8�I�I�%�%��"�0�@�@�B�B�B�'�i�"�i�i�i�)�	)rN)r"r#r$rrr r=r%rrr'r'sS������+�+�+�N�N�N�"�"�"�	)�	)�	)�	)�	)rr'c� �eZdZd�Zd�Zd�ZdS)�StructUnionExprc	�v�||_||_||_||_||_||_||_||_dSr)r�
type_index�flagsr�	alignment�comment�first_field_index�c_fields)	rrrArBrrCrDrErFs	         rrzStructUnionExpr.__init__;s?����	�$�����
���	�"������!2��� ��
�
�
rc���d|j|j|jfzd|j�d|j�d�zd|jt
|j��fzz|jr
d|jzndzdzS)Nz  { "%s", %d, %s,z
    rz%d, %d z	/* %s */ r5z},)	rrArBrrCrEr0rFrDrs rrzStructUnionExpr.as_c_exprFs���#�t�y�$�/�4�:�&N�N�N�&*�i�i�i�����@�A��t�5�s�4�=�7I�7I�J�J�K�26��E�;���-�-�2�G��	�	rc���t|jt��}d�|jD��}dt	|j���t	|���|j�dd�|���d�S)Nc�6�g|]}|�����Sr%)r=)�.0�c_fields  r�
<listcomp>z2StructUnionExpr.as_python_expr.<locals>.<listcomp>Os4��5�5�5�"��3�3�5�5�5�5�5rz(b'�',�,�))�evalrB�G_FLAGSrFr;rAr�join)rrB�fields_exprs   rr zStructUnionExpr.as_python_exprMs}���T�Z��)�)��5�5�&*�m�5�5�5���
�d�o�.�.�.��e�$�$�$��I�I�I��H�H�[�!�!�!�!�	#�	#rNr!r%rrr?r?:sA������	!�	!�	!����#�#�#�#�#rr?c� �eZdZd�Zd�Zd�ZdS)�EnumExprc�L�||_||_||_||_||_dSr�rrAr�signed�allenums)rrrArrXrYs      rrzEnumExpr.__init__Xs)����	�$�����	���� ��
�
�
rc�H�d|j|j|j|j|jfzS)Nz1  { "%s", %d, _cffi_prim_int(%s, %s),
    "%s" },rWrs rrzEnumExpr.as_c_expr_s/���!%��D�O�!%��D�K���!H�H�	Irc	��tttttt
ttd�|j|j	f}dt|j���t|���|j�d|j
�d�S)N))rr)rr)�r)r\r)�r)r]r)�r)r^rr6z\x00r7)�
PRIM_UINT8�	PRIM_INT8�PRIM_UINT16�
PRIM_INT16�PRIM_UINT32�
PRIM_INT32�PRIM_UINT64�
PRIM_INT64rrXr;rArrY)r�
prim_indexs  rr zEnumExpr.as_python_exprdsr���)��*��*��*�	��
�i���$�&�
�
�&7�t��%G�%G�%G�%6�z�%B�%B�%B�%)�Y�Y�Y��
�
�
�?�	?rNr!r%rrrUrUWsD������!�!�!�I�I�I�
	?�	?�	?�	?�	?rrUc� �eZdZd�Zd�Zd�ZdS)�TypenameExprc�"�||_||_dSr�rrA)rrrAs   rrzTypenameExpr.__init__ps����	�$����rc�$�d|j|jfzS)Nz  { "%s", %d },rkrs rrzTypenameExpr.as_c_exprts�� �D�I�t��#?�?�?rc�@�dt|j���|j�d�S)Nr6r7)r;rArrs rr zTypenameExpr.as_python_exprws"���-�d�o�>�>�>��	�	�	�J�JrNr!r%rrririosI������%�%�%�@�@�@�K�K�K�K�Krric��eZdZdZdNd�Zd�Zd�Zd�Zd�Zd�Z	gd	�Z
d
�ZdOd�Zd
�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Z d!�Z!dPd#�Z"d$�Z#d%�Z$d&�Z%e%Z&d'�Z'd(�Z(e(Z)d)�Z*e*Z+d*�Z,d+�Z-d,�Z.		dQd.�Z/d/�Z0d0�Z1d1�Z2d2�Z3dPd3�Z4d4�Z5d5�Z6d6�Z7d7�Z8d8�Z9d9�Z:d:�Z;d;�Z<d<�Z=d=�Z>e>xZ?Z@d>�ZAd?�ZBd@�ZCdA�ZDdB�ZEeExZFZGdC�ZHdD�ZIdE�ZJdF�ZKdG�ZLdH�ZMdI�ZNeNZOeNZPdJ�ZQdK�ZRdL�ZSeSZTdM�ZUd"S)R�
RecompilerrFc�H�||_||_||_t|_dSr)�ffi�module_name�target_is_python�VERSION_BASE�_version)rrqrrrss    rrzRecompiler.__init__�s$�����&��� 0���$��
�
�
rc�:�t|j|��|_dSr)�maxru)r�vers  r�
needs_versionzRecompiler.needs_version�s���D�M�3�/�/��
�
�
rc
��i|_|�d��t|jt���}g|_|D]�}|jr�|j|�J�t
|j��|j|<|j�|��|jD]�}t|tjtjtj
tjtjf��sJ�|j|�t
|j��|j|<|j�|����|j�d����|D]t}|jsk|j|�^t
|j��|j|<|j�|��|jr!|j�|j�d���ud|j���vsJ�i|_i|_|D]K}t|tj��rd|j|<�'t|tj��r
d|j|<�Lt/t|jd������D]\}}||j|<�t/t|jd������D]\}}||j|<�|D]6}t1|d|jjz��}|||j|���7|jD]}t|t6��sJ��t9|j��|_dS)N�collecttype��key�END�LENc��|jSr�r��tps r�<lambda>z/Recompiler.collect_type_table.<locals>.<lambda>����R�W�rc��|jSrr�r�s rr�z/Recompiler.collect_type_table.<locals>.<lambda>�r�r�_emit_bytecode_)�
_typesdict�	_generate�sorted�str�
cffi_types�is_raw_functionr0�append�args�
isinstancer�VoidType�BasePrimitiveType�PointerType�StructOrUnionOrEnum�FunctionPtrType�
is_array_type�length�values�_struct_unions�_enums�
StructOrUnion�EnumType�	enumerate�getattr�	__class__r"�CffiOp�tuple)r�	all_declsr��tp1�i�methodr8s       r�collect_type_tablezRecompiler.collect_type_table�sS��������}�%�%�%��4�?��4�4�4�	�����	.�	.�B��!�

.���r�*�2�2�2�&)�$�/�&:�&:����#���&�&�r�*�*�*��7�0�0�C�%�c�E�N�,1�,C�,1�,=�,1�,E�,1�,A�	,C�D�D�D�D�D�
��s�+�3�/2�4�?�/C�/C����,��O�*�*�3�/�/�/�/���&�&�u�-�-�-���	2�	2�B��%�
2�$�/�"�*=�*E�&)�$�/�&:�&:����#���&�&�r�*�*�*��#�2��	�(=��O�*�*�5�1�1�1���4�?�1�1�3�3�3�3�3�3�!�������	'�	'�B��"�e�1�2�2�
'�*.��#�B�'�'��B���/�/�
'�"&���B����v�d�&9�*<�*<� >� >� >�?�?�	(�	(�E�A�r�&'�D���#�#��v�d�k�*<�*<� >� >� >�?�?�	 �	 �E�A�r��D�K��O�O��	,�	,�B��T�#4�r�|�7L�#L�M�M�F��F�2�t��r�*�+�+�+�+��/�	*�	*�B��b�&�)�)�)�)�)�)����0�0����rc�<�|j}|�|��Sr)rs�
enumfields)rr��expand_anonymous_struct_unions   r�_enum_fieldszRecompiler._enum_fields�s#��-1�,A�(A�%��}�}�:�;�;�;rc��t|tj��s1t|t��r|D]}|�|���dS||jvr�d|j|<t|tj��r)|�|�����dSt|tj��rg|j	�Z||j
jjvrI|�
|��D]5\}}}}|�|�|||�����2dSdSdS|���D]\}}|�|���dSdSr)r�r�BaseTypeByIdentityr��_do_collect_typer�r��as_raw_functionr��fldtypesrq�_parser�_included_declarationsr��_field_type�
_get_items)rr��x�name1r��_s      rr�zRecompiler._do_collect_type�s����"�e�6�7�7�	��"�e�$�$�
-��-�-�A��)�)�!�,�,�,�,��F�
�T�_�$�$�"&�D�O�B���"�e�3�4�4�	
-��%�%�b�&8�&8�&:�&:�;�;�;�;�;��B�� 3�4�4�
-��;�*��$�(�"2�"I�I�I�,0�,=�,=�b�,A�,A�P�P�(��s�A�q��-�-�d�.>�.>�r�5�#�.N�.N�O�O�O�O�+�*�I�I�P�P��M�M�O�O�-�-�D�A�q��)�)�!�,�,�,�,�%�$�-�-rc��|jjj���}t	|��D]�\}\}}|�dd��\}}	t
|d|�d|����}n #t$rtd|z���wxYw	||_	|||���n#t$r}	tj|	|���d}	~	wwxYwdS)Nr.r�_generate_cpy_r�z"not implemented in recompile(): %r)
rqr��
_declarations�itemsr��splitr��AttributeErrorr�_current_quals�	Exceptionr�attach_exception_info)
r�	step_name�lstrr��quals�kind�realnamer��es
          rr�zRecompiler._generate�s���h��,�2�2�4�4��!'����
	�
	��D�+�2�u�!�Z�Z��Q�/�/�N�D�(�
A� ������@I�	�(K�L�L����!�
A�
A�
A�'�8�4�?�A�A�A�
A����
�&+��#���r�8�$�$�$�$���
�
�
��+�A�t�4�4�4������
����
	�
	s$�A,�,B	�
B!�!
C�+C�C)�global�field�struct_union�enum�typenamec�J�i|_|jD]}g|j|<�
t��|_|�d��|���|jD]C}|j|}|dkr|�d����t|��|j|<�D|jd}|j�	��D]2\}}|t|��ksJ�||j|jksJ��3t|��t|j��ksJ�|jd}|j�	��D]2\}}|t|��ksJ�||j|jksJ��3t|��t|j��ksJ�dS)N�ctxr�c��|jSrr�)�entrys rr�z0Recompiler.collect_step_tables.<locals>.<lambda>s��5�:�rr|r�r�)
�_lsts�	ALL_STEPS�set�_seen_struct_unionsr��_add_missing_struct_unions�sortr�r�r�r0rr�)rr�r�r�r�s     r�collect_step_tableszRecompiler.collect_step_tables�s�����
���	'�	'�I�$&�D�J�y�!�!�#&�5�5�� ����u�����'�'�)�)�)���	/�	/�I��*�Y�'�C��G�#�#����5�5��6�6�6�$)�#�J�J�D�J�y�!�!��j��(���(�.�.�0�0�	*�	*�E�B���s�3�x�x�<�<�<�<��q�6�;�"�'�)�)�)�)�)��3�x�x�3�t�2�3�3�3�3�3�3��j�� ���[�&�&�(�(�	*�	*�E�B���s�3�x�x�<�<�<�<��q�6�;�"�'�)�)�)�)�)��3�x�x�3�t�{�+�+�+�+�+�+�+�+rr5c�@�|j�|dz��dS)N�
)�_f�write)r�whats  r�_prntzRecompiler._prnts ����
�
�d�T�k�"�"�"�"�"rc�~�|jr|�J�|�|��dS|�J�|�||��dSr)rs�write_py_source_to_f�write_c_source_to_f)r�f�preambles   r�write_source_to_fzRecompiler.write_source_to_fs[��� �	2��#�#�#��%�%�a�(�(�(�(�(��'�'�'��$�$�Q��1�1�1�1�1rc��ttj�tj�t
��|��d��}|���}|���|S)N�r)�open�os�pathrR�dirname�__file__�	readlines�close)r�filename�g�liness    r�_rel_readlineszRecompiler._rel_readlines!sN�������b�g�o�o�h�7�7��B�B�C�H�H�����
�
��	���	�	�	��rc	�x�||_|j}|jj�|d��ts|d��|�d��}|�d��}|�d��|||dz�<|d�|����|j�	d��d	}|jj��|d
|j�d���|d��|�
|jj��|d
��|d��|d|����|d��|d|����|d��|d|����|d��|�d��}|�d��}|�d��|||dz�<|d�|����|�t��|d��|��||��|��|d��|��|d��td�|j���D����}t!|j��D]K\}}d}	||vrd||���z}	|d||���|	fz���L|js|d��|d��|��t)��|_|�d��i}
|jD]v}|j|}t3|��|
|<|
|d krI|d!|�d"|�d#���|D]}
||
������ |d��|���w|jjr�|d$��|jjD]_}	|jdd%�\}}n)#t8$rt;d&|j�d'|�d(����wxYw|�t;d)���|d*|�d+����`|d,��|d��|��|d-��|d.��|jD]+}|
|d kr|d/|z���|d0|z���,|jD]}|d1kr|d2|
||fz���|jjr|d3��n|d4��|d5t3|j��fz��d }|jd ks|jj�|dz}|d6|z��|d��|��|d7��|d8��|d��|��|d��|d9��|d:|�d;���|d<��|dzr!|d=��|d>��|d?��|d@|jz��|dA��|dB��|dC��|d��|dD��|dE��|dF��|dG��|dH|�dI���|dJ��|dK|�dL���|dM��|dM��|d��|d9��|dN|�dO���|d<��|dP|j|jfz��|dD��|d��|d9��|dQ|�dO���|d<��|dR|j|jfz��|dD��|d��|��|d7��|dS��|d��d|_dS)TNz#define _CFFI_USE_EMBEDDINGz#define _CFFI_NO_LIMITED_APIz_cffi_include.hz#include "parse_c_type.h"
zparse_c_type.hrr5�.���z#define _CFFI_MODULE_NAME  "�"z1static const char _CFFI_PYTHON_STARTUP_CODE[] = {z0 };z#ifdef PYPY_VERSIONz3# define _CFFI_PYTHON_STARTUP_FUNC  _cffi_pypyinit_z#elif PY_MAJOR_VERSION >= 3z+# define _CFFI_PYTHON_STARTUP_FUNC  PyInit_�#elsez(# define _CFFI_PYTHON_STARTUP_FUNC  init�#endifz_embedding.hz#include "_cffi_errors.h"
z_cffi_errors.hz>/************************************************************/zstatic void *_cffi_types[] = {c��g|]	\}}||f��
Sr%r%�rJr�r�s   rrLz2Recompiler.write_c_source_to_f.<locals>.<listcomp>W� ��N�N�N�7�B���2�w�N�N�Nrz // z/* %2d */ %s,%sz  0z};�declrzstatic const struct _cffi_z	_s _cffi_zs[] = {z.static const char * const _cffi_includes[] = {r\�ffi object �
 includes �8, but the latter has not been prepared with set_source()zMnot implemented yet: ffi.include() of a Python-based ffi inside a C-based ffiz  "z",z  NULLz?static const struct _cffi_type_context_s _cffi_type_context = {z  _cffi_types,z  _cffi_%ss,z  NULL,  /* no %ss */r�z  %d,  /* num_%ss */z  _cffi_includes,z  NULL,  /* no includes */z  %d,  /* num_types */z  %d,  /* flags */z#ifdef __GNUC__z?#  pragma GCC visibility push(default)  /* for -fvisibility= */�PyMODINIT_FUNC�_cffi_pypyinit_z(const void *p[])�{z%    if (((intptr_t)p[0]) >= 0x0A03) {zQ        _cffi_call_python_org = (void(*)(struct _cffi_externpy_s *, char *))p[1];z    }z    p[0] = (const void *)0x%x;z    p[1] = &_cffi_type_context;z#if PY_MAJOR_VERSION >= 3�    return NULL;�}z#  ifdef _MSC_VERz     PyMODINIT_FUNCz#  if PY_MAJOR_VERSION >= 3z     PyInit_z(void) { return NULL; }z#  elsez	     initz
(void) { }z#  endif�PyInit_�(void)z5  return _cffi_init("%s", 0x%x, &_cffi_type_context);�initz.  _cffi_init("%s", 0x%x, &_cffi_type_context);z#  pragma GCC visibility pop) r�r�rq�
_embedding�USE_LIMITED_APIr��indexrRrrr��_print_string_literal_in_arrayry�VERSION_EMBEDDED�dictr�r�r�r��_get_c_namerr��_seen_constantsr�r�r�r0�_included_ffis�_assigned_sourcer�r�
_num_externpyru)rr�r��prntr�r��base_module_name�typeindex2typer8rD�numsr�r�r��ffi_to_include�included_module_name�included_sourcerBs                  rr�zRecompiler.write_c_source_to_f's�	������z���8��*��D�.�/�/�/��	1��D�/�0�0�0��#�#�$5�6�6���K�K�5�6�6���*�*�+;�<�<��a��!��e����R�W�W�U�^�^���� �+�1�1�#�6�6�r�:���8��*��D�D�d�6F�6F�6F�H�I�I�I��D�D�E�E�E��/�/���0C�D�D�D��D��L�L�L��D�&�'�'�'��D�D� � �#�
$�
$�
$��D�.�/�/�/��D�D� � �#�
$�
$�
$��D��M�M�M��D�D� � �#�
$�
$�
$��D��N�N�N��'�'��7�7�E����9�:�:�A��.�.�/?�@�@�E�!�A�a�C�%�L��D������� � � ����/�0�0�0�	
��
M�N�N�N��������X�����������
M�N�N�N������	
��
-�.�.�.��N�N�d�o�6K�6K�6M�6M�N�N�N�O�O���t��/�/�	C�	C�E�A�r��G��N�"�"� �>�!�#4�#@�#@�#B�#B�B���D�"�a�������%A�A�B�B�B�B���	��D��K�K�K���T�
�
�
������ #�u�u������v��������		�		�I��*�Y�'�C�!�#�h�h�D��O��I���"�"�����I�I�y�y�y�*�+�+�+� �,�,�E��D����*�*�+�+�+�+���T�
�
�
��������8�"�	��D�A�B�B�B�"&�(�"9�

:�

:��8�&�7����;�:�(�/�/��%�8�8�8�+�+�!�H�H�H�n�n�n�7�8�8�8�8����
#�*�+�3�4�4�4����"6�"6�"6�8�9�9�9�9��D��N�N�N��D��J�J�J��D�F�F�F�	
��
N�O�O�O���
������	:�	:�I��I���"�"���^�i�/�0�0�0�0���,�y�8�9�9�9�9���	L�	L�I��G�#�#���+�t�I��	�.J�J�K�K�K���8�"�	/��D�$�%�%�%�%��D�-�.�.�.���
%��T�_�)=�)=�(?�
?�@�@�@������!�!�T�X�%8�%D��Q�J�E���
!�E�
)�*�*�*���T�
�
�
������	
��
������
N�O�O�O���X�����������
"�#�#�#���
�������5E�5E�5E�
G�H�H�H���S�	�	�	��1�9�	��D�8�9�9�9��D�E�
F�
F�
F��D��M�M�M���
-��
�
=�>�>�>���
.�/�/�/���
(�)�)�)���
� � � ���X������S�	�	�	�	
��
 �!�!�!���
"�#�#�#���
*�+�+�+����8H�8H�8H�
J�K�K�K���Y�������(8�(8�(8�
:�;�;�;���Z������Z������
*�+�+�+���
�������"2�"2�"2�
4�5�5�5���S�	�	�	���
D���d�m�H-�-�	.�	.�	.���S�	�	�	���W�
�
�
���
�������/�/�/�
1�2�2�2���S�	�	�	���
=���d�m�A-�-�	.�	.�	.���S�	�	�	���X�����������
������
+�,�,�,���X������
�
�
s�7O
�
&O0c�8��t|t��rd|�d�St|ttf��rO�fd�|D��}t	|��dkr|�d��dd�|���d�S|���S)	Nr6r7c�:��g|]}��|����Sr%)�_to_py)rJ�itemrs  �rrLz%Recompiler._to_py.<locals>.<listcomp>�s%���3�3�3��4�;�;�t�$�$�3�3�3rrr5�(rNrO)r�r��listr�r0r�rRr )rr��reps`  rrzRecompiler._to_py�s�����a����	"�	"��a�a�>�!��a�$���'�'�	-�3�3�3�3��3�3�3�C��3�x�x�1�}�}��
�
�2����� �X�X�c�]�]�]�]�,�,����!�!�!rc	�V�||_|j}|d��|d��t|jjpd��}t|��D]r}|jj|}	|jdd�\}}n)#t$rtd|j�d|�d����wxYw|�td���|d	||fz���s|��|d
|j	�d���|d|j
fz��d|_
t|j��|_d
�|jD��}|d|�
d�|�����d���td�|j���D����}	|jD]M}
|j|
}t|��dkr+|
dkr%|d|
�d|�
|���d����N|dkr9|dd�d�t|��D�����d���|d��dS)Nz# auto-generated filezimport _cffi_backendr%r\r�r�r�zMnot implemented yet: ffi.include() of a C-based ffi inside a Python-based ffizfrom %s import ffi as _ffi%dzffi = _cffi_backend.FFI('rMz    _version = 0x%x,c�6�g|]}|�����Sr%)r)rJr8s  rrLz3Recompiler.write_py_source_to_f.<locals>.<listcomp>�s$��D�D�D�b�R�'�'�)�)�D�D�Drz
    _types = r5rNc��g|]	\}}||f��
Sr%r%r�s   rrLz3Recompiler.write_py_source_to_f.<locals>.<listcomp>r�rrr�z    _zs = z    _includes = (rc��g|]}d|z��S)z_ffi%dr%�rJr�s  rrLz3Recompiler.write_py_source_to_f.<locals>.<listcomp>s��E�E�E�A�8�a�<�E�E�Erz,),rO)r�r�r0rqr�ranger
r�rrrrur�r�rrRr	r�r�r�r�)rr�r�num_includesr�rrr�	types_lstrr�r�s            rr�zRecompiler.write_py_source_to_f�s�������z��	
��
$�%�%�%���
#�$�$�$��4�8�2�8�b�9�9���|�$�$�	M�	M�A�!�X�4�Q�7�N�
4�"�3�B�Q�B�7�6�$�o�o��!�
4�
4�
4�'�'�����.�.�.�3�4�4�4�
4����
�*�'�4�5�5�5�
�D�/�3G��2K�K�L�L�L�L����������0@�0@�0@�
B�C�C�C���
#�t�}�&6�
6�7�7�7���
� ���0�0���D�D�D�O�D�D�D�	����4�;�;�r�w�w�y�/A�/A�#B�#B�#B�#B�
D�E�E�E��N�N�d�o�6K�6K�6M�6M�N�N�N�O�O����	G�	G�I��*�Y�'�C��3�x�x�!�|�|�	�W� 4� 4�������D�K�K��4D�4D�4D�4D�E�F�F�F���!����D�D��	�	�E�E��|�1D�1D�E�E�E�F�F�F�F�I�
J�
J�
J�	
��S�	�	�	�	�	s�$A7�7&Bc��|j|Sr)r�)r�types  r�_gettypenumzRecompiler._gettypenums����t�$�$rc
���d}t|tj��r�|���s�|���r|jdkr
d}d|jz}n�t|tj��rd|�d���d�}nT|�d��}d|�d|j�dd	����}|d
vr|�	t��d}�nt|tj��r|�||||��dSt|tj
��st|tj��rH|�d||�|��|fz��|�d
|z��dSt|tj��r3d|�d��z}d|�|��z}d}nt#|���|�d|�d|�d|�|�d���|�d|�d|�d���d|�d���|�d
|z��dS)Nr5�_Bool�_cffi_to_c_intz, %srz)_cffi_to_c_doublez)_cffi_to_c_r.r���char16_t�char32_tz-1z6  if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)z    %s;z(%s)_cffi_to_c_pointerz, _cffi_type(%d)�NULL�  z = �);z  if (z == (rOz && PyErr_Occurred()))r�rr��is_complex_type�is_integer_typer�UnknownFloatType�
get_c_name�replacery�VERSION_CHAR16CHAR32r��"_convert_funcarg_to_c_ptr_or_arrayr�r�r'r�r3)	rr��fromvar�tovar�errcode�extraarg�	converter�cname�errvalues	         r�_convert_funcarg_to_cz Recompiler._convert_funcarg_to_cs������b�%�1�2�2�$	*�2�;M�;M�;O�;O�$	*��!�!�#�#�
=���7�(:�(:�,�	�!�B�G�+����B�� 6�7�7�	
=�	
=�8:�}�}�R�7H�7H�7H�7H�J�	�	��
�
�b�)�)���38�5�5�35�7�?�?�3��3L�3L�3L�N�	��4�4�4��&�&�';�<�<�<��H�H�
��E�-�
.�
.�	*��3�3�B��49�7�
D�
D�
D��F���U�6�7�7�	*���U�4�5�5�	*�
�J�J�O��� 0� 0�� 4� 4�g�>�?�
@�
@�
@��J�J�y�7�*�+�+�+��F�
��E�1�
2�
2�	*�0�2�=�=��3D�3D�D�I�)�D�,<�,<�R�,@�,@�@�H��H�H�&�b�)�)�)��
�
�
����	�	�	�7�7�H�H�H�M�N�N�N��
�
�
��E�E�2�=�=��$�$�$�$�h�h�h�0�	1�	1�	1��
�
�9�w�&�'�'�'�'�'rc��t|tj��rA|�d��|�d��|�d��dSdS)NzPy_ssize_t datasizez-struct _cffi_freeme_s *large_args_free = NULLzIif (large_args_free != NULL) _cffi_free_array_arguments(large_args_free);)r�rr��add)rr��	localvars�	freeliness    r�_extra_local_variablesz!Recompiler._extra_local_variablesCsu���b�%�+�,�,�	K��M�M�/�0�0�0��M�M�I�J�J�J��M�M�J�
K�
K�
K�
K�
K�	K�	Krc���|�d��|�d|�|��||fz��|�d��|�d|�d|�d���d���|�d|�|��||fz��|�d	��|�d
|z��|�d��dS)Nz1  datasize = _cffi_prepare_pointer_call_argument(z(      _cffi_type(%d), %s, (char **)&%s);z  if (datasize != 0) {z    z  = ((size_t)datasize) <= 640 ? (r5z!)alloca((size_t)datasize) : NULL;zF    if (_cffi_convert_array_argument(_cffi_type(%d), %s, (char **)&%s,z,            datasize, &large_args_free) < 0)z	      %s;z  })r�r'r4)rr�r8r9r:s     rr7z-Recompiler._convert_funcarg_to_c_ptr_or_arrayJs���
�
�F�G�G�G��
�
�=����R� � �'�5�A2�2�	3�	3�	3��
�
�+�,�,�,��
�
�
��E�E�2�=�=��$�$�$�$�&�	'�	'�	'�	
�
�
�#�&*�&6�&6�r�&:�&:�G�U�%K�L�	M�	M�	M��
�
�A�B�B�B��
�
�;��(�)�)�)��
�
�5�����rc�(�t|tj��r�|���r|jdkrd|�d|j�d�St|tj��rd|�d�S|jdkrV|���sB|j�dd��}|d	vr|�t��d
|�d|�d�Sd||�
|��fzSt|tjtjf��rd
||�
|��fzSt|tj
��r1d
||�
tj|j����fzSt|tj��rI|j�(t#d|����d|�d����d||�
|��fzSt|tj��rd||�
|��fzSt)|���)Nr)z_cffi_from_c_int(rrOz_cffi_from_c_double(�long doubler.r�r+�
_cffi_from_c_rz/_cffi_from_c_deref((char *)&%s, _cffi_type(%d))z0_cffi_from_c_pointer((char *)%s, _cffi_type(%d))r7z
' is used as z, but is opaquez0_cffi_from_c_struct((char *)&%s, _cffi_type(%d)))r�rr�r2rr3r1r5ryr6r'r�r��	ArrayTyperr��fldnames�	TypeErrorr
r�r3)rr��var�contextr=s     r�_convert_expr_from_czRecompiler._convert_expr_from_cXsP���b�%�1�2�2�	*��!�!�#�#�
/���7�(:�(:�(:�58�S�S�"�'�'�'�B�B��B�� 6�7�7�	
/�	
/�47�C�C�9�9���M�)�)�"�2D�2D�2F�2F�)������S�1�1���4�4�4��&�&�';�<�<�<��05���s�s�s�;�;�H���)�)�"�-�-�L/�/�/�
��U�.��0E�F�
G�
G�	*�E��T�%�%�b�)�)�I+�+�
+�
��E�O�
,�
,�
	*�E��T�%�%�e�&7���&@�&@�A�A�IC�C�
C�
��E�/�
0�
0�
	*��{�"��i��N�N�$�$�$�$�g�g�g�!/�0�0�0�E��T�%�%�b�)�)�I+�+�
+�
��E�N�
+�
+�	*�D��T�%�%�b�)�)�H+�+�
+�&�b�)�)�)rc�6�|�|d|�d���S)Nz(*(z *)0))�_global_type�rr�rs   r�
_typedef_typezRecompiler._typedef_type{s!��� � ���T�T�T�%;�<�<�<rc�X�|�|�||����dSr)r�rRrQs   r�!_generate_cpy_typedef_collecttypez,Recompiler._generate_cpy_typedef_collecttype~s,�����d�0�0��T�:�:�;�;�;�;�;rc��dSrr%rQs   r�_generate_cpy_typedef_declz%Recompiler._generate_cpy_typedef_decl�����rc�|�|j|}|jd�t||����dS)Nr�)r�r�r�ri)rr�rrAs    r�_typedef_ctxzRecompiler._typedef_ctx�s9���_�R�(�
��
�:��%�%�l�4��&D�&D�E�E�E�E�Erc�X�|�||��}|�||��t|dd��dkr|�||jd���dSt|tj��r/|�|j|jj|j|���dSdS)N�origin�unknown_type)�
approxname)r]�	named_ptr)	rRrYr��_struct_ctxrr�r�NamedPointerType�totyperQs   r�_generate_cpy_typedef_ctxz$Recompiler._generate_cpy_typedef_ctx�s���
�
�
��D�
)�
)�����"�d�#�#�#��2�x��&�&�.�8�8����R���T��:�:�:�:�:�
��E�2�
3�
3�	+����R�Y��	��2�7�')�
�
+�
+�
+�
+�
+�	+�	+rc��|�|�����|jr|js|�|��dSdSdSr)r�r��ellipsisrsrQs   r�"_generate_cpy_function_collecttypez-Recompiler._generate_cpy_function_collecttype�sd�����b�0�0�2�2�3�3�3�
�;�	&�t�4�	&��!�!�"�%�%�%�%�%�	&�	&�	&�	&rc
�,
�|jrJ�t|tj��sJ�|jr|�||��dS|j}t|j��}|dkrd}n|dkrd}nd}g}g}d|z}t|j��D]I\}	}
|�
|
�d|	z|����|�
d|	z���Jd	�|��}|pd
}|j
r|j
dz}nd}|�d
|�d|�d�}
|d|j�|
������|d��d	�|��}d}t|jtj��rd}|d|�|�d|�d���|d��|d��|d��|d|�d|�d���|d��d|z}t|j��D],\}	}
|
�d|	z|��}|d|z���-t!��}t!��}|jD]}
|�|
||���t%|��D]}|d|�d����t|jtj��s<d}d|z}d|j�d|��z}||��|d��nd}d}t|j��dkr�t't|j����}|D]}	|d |	z���|��|d!|t|��t|��d	�d"�|D����fz��|d#��|��t|j��D]-\}	}
|�|
d$|	zd|	zd%��|���.|d&��|d'��d(�t't|j����D��}d	�|��}|d)|�|�d|�d*���|d+��|d,��|��|d-��|dkr|d.��|rG|d/|�|jd0d1��z��|D]}|d|z���|d2��n)|D]}|d|z���|d3��|d4��|d��|d5��d6�}d7}g}g}d|z}t|j��D]`\}	}
d}||
��rd8}d9}|
�d:||	fz|��}|�
|��|�
d;||	fz���a|j}||��rCd|z}|�d<|��}|�d|��tj}d}d=}d9}|r�d	�|��}|pd
}|�d|�d|�d�}
|d|�|
������|d��|r||��d	�|��}|d)|�|�d|�d*���|r|d>��|d��n|d?|�d@|����|dA��|��dS)BNr�noargr�arg0r��argument of %sz x%d�x%dr�voidr.r5�_cffi_d_rrO�static r�zreturn r/r0rz#ifndef PYPY_VERSIONzstatic PyObject *�_cffi_f_z(PyObject *self, PyObject *z  %s;�;z	result = �result of %sz resultz  PyObject *pyresult;z  PyObject *arg%d;z1  if (!PyArg_UnpackTuple(args, "%s", %d, %d, %s))c��g|]}d|z��S)z&arg%dr%r!s  rrLz:Recompiler._generate_cpy_function_decl.<locals>.<listcomp>�s��5�5�5�A�8�a�<�5�5�5rr�zarg%dzreturn NULLz  Py_BEGIN_ALLOW_THREADSz  _cffi_restore_errno();c��g|]}d|z��S)rjr%r!s  rrLz:Recompiler._generate_cpy_function_decl.<locals>.<listcomp>�s��A�A�A��%�!�)�A�A�Ar�  { z); }z  _cffi_save_errno();z  Py_END_ALLOW_THREADSz  (void)self; /* unused */z  (void)noarg; /* unused */z  pyresult = %s;�resultzresult typez  return pyresult;z  Py_INCREF(Py_None);z  return Py_None;r�c��t|tj��p-t|tj��o|���Sr)r�rr��
PrimitiveTyper1)r&s r�need_indirectionz@Recompiler._generate_cpy_function_decl.<locals>.need_indirections@���t�U�%8�9�9�-���e�&9�:�:�,��)�)�+�+�
.rFrTz %sx%dz%sx%dz *resultz
*result = z  return result;z#  define _cffi_f_z	 _cffi_d_r�)rsr�rr�rd�_generate_cpy_constant_declr�r0r�r�r�r4rR�abirtr�r�rDr�r"r?rN�insert�	void_type)rr�rr�numargs�argname�	arguments�call_argumentsrMr�r&�repr_argumentsry�name_and_arguments�result_code�argrBrCr��result_decl�rng�freelinerw�
difference�indirection�	tp_results                          r�_generate_cpy_function_declz&Recompiler._generate_cpy_function_decl�sw���(�(�(�(��"�e�3�4�4�4�4�4�
�;�	�
�,�,�R��6�6�6��F��z���b�g�,�,���a�<�<��G�G�
��\�\��G�G��G��	���"�T�)�� ���)�)�	-�	-�G�A�t����T�_�_�V�a�Z��A�A�B�B�B��!�!�%�!�)�,�,�,�,����9�-�-��'�1�6��
�6�	��&�3�,�C�C��C�36�3�3����n�n�n�M�����B�I�0�0�1C�D�D�D�
F�G�G�G���S�	�	�	����>�2�2�����b�i���0�0�	��K����k�k�4�4�4����
@�A�A�A���S�	�	�	���
#�$�$�$���
 �!�!�!����4�4�4����
I�J�J�J���S�	�	�	�"�T�)�� ���)�)�	 �	 �G�A�t��/�/�&�1�*�g�6�6�C��D��3�������E�E�	��E�E�	��G�	D�	D�D��'�'��i��C�C�C�C��9�%�%�	$�	$�D��D�D�D�D�D�"�#�#�#�#��"�)�U�^�4�4�	�%�K�$�t�+�G�!�B�I�$8�$8��G�$L�$L�L�K��D������D�(�)�)�)�)��K��K��r�w�<�<�!�����B�G���%�%�C��
/�
/����)�A�-�.�.�.�.��D�F�F�F��D�D��c�#�h�h��C����	�	�5�5��5�5�5�6�6�H8�8�
9�
9�
9�
�D�#�$�$�$������ ���)�)�	�	�G�A�t��&�&�t�W�q�[�%�!�)�'4�
6�
6�
6��D�F�F�F�F���
'�(�(�(���
'�(�(�(�A�A�U�3�r�w�<�<�-@�-@�A�A�A�����>�2�2�����+�+�t�t�t�^�^�^�
D�E�E�E���
$�%�%�%���
%�&�&�&��������
)�*�*�*��a�<�<��D�.�/�/�/��
	&��D�#��*�*�2�9�h�
�N�N�O�
P�
P�
P�%�
&�
&����T�H�_�%�%�%�%��D�%�&�&�&�&�%�
&�
&����T�H�_�%�%�%�%��D�(�)�)�)��D�$�%�%�%���S�	�	�	���W�
�
�
�	.�	.�	.��
��	���"�T�)�� ���)�)�	>�	>�G�A�t��K����%�%�
"�!��!�
��/�/�(�k�1�-=�"=�w�G�G�C����S�!�!�!��!�!�'�[�!�,<�"<�=�=�=�=��I�	���I�&�&�	�$�t�+�G��&�&�z�7�;�;�C����Q��$�$�$���I��K�&�K��J��	C�!�Y�Y�y�1�1�N�+�5�v�N�7:�s�s�D�D�D�7E�~�~�"G���D�D�	� 4� 4�5G� H� H� H�J�K�K�K��D��I�I�I��
"���[�!�!�!�!�Y�Y�~�6�6�N��D�D�k�k�4�4�4����H�I�I�I��
)���'�(�(�(��D��I�I�I�I��D�D�d�d�d�D�D�A�B�B�B���X����������rc
��|jr|js|�||��dS|j|���}t|j��}|jrt}n#|dkrt}n|dkrt}nt}|jd�t|d|zt||��d|z�����dS)Nrrr�z
_cffi_f_%sz
_cffi_d_%s)r)rdrs�_generate_cpy_constant_ctxr�r�r0r��OP_DLOPEN_FUNC�OP_CPYTHON_BLTN_N�OP_CPYTHON_BLTN_O�OP_CPYTHON_BLTN_Vr�r�rr�)rr�rrAr|�	meth_kinds      r�_generate_cpy_function_ctxz%Recompiler._generate_cpy_function_ctx;s���
�;�	�t�4�	��+�+�B��5�5�5��F��_�R�%7�%7�%9�%9�:�
��b�g�,�,��� �	*�&�I�I�
��\�\�)�I�I�
��\�\�)�I�I�)�I��
�8��#�#��t�\�D�0��i��4�4�(�4�/�
1�
1�
1�	2�	2�	2�	2�	2rc��t|tj��r_|j}|dkr|�d��}d|�d|�d�}|�|d|z|j��}tj||��}|S)N�...rz_cffi_array_len(((�)0)->rO�%s[0])r�rrIr�r4r�r)r�	tp_struct�
field_name�tp_field�
actual_length�ptr_struct_name�tp_items       rr�zRecompiler._field_typeQs����h���0�0�	?�$�O�M���%�%�"+�"6�"6�s�";�";���#�O�O�Z�Z�Z�!1�
��&�&�y�'�J�2F�'/�}�6�6�G���w�
�>�>�H��rc��|�|��|jr,|���D]}|�|���dSdSr)r�rs�anonymous_struct_fields�_struct_collecttype)rr��fldtypes   rr�zRecompiler._struct_collecttype]sg�����b�!�!�!�� �	2��5�5�7�7�
2�
2���(�(��1�1�1�1�	2�	2�
2�
2rc
�$�|j�dS|j}d|��}|d��|d|�d|�d���|d��|d��|d��|�|��D]�\}}}}		|���s|d	kr|d
kr|d|�d|�d
|�d����>t	|t
j��rJ|j�|jdkr8|j}|dz}t	|t
j��r|j�-|jdk�8|d|�	dd|z|	����d|�d�����#t$r%}
|dt|
��z��Yd}
~
��d}
~
wwxYw|d��|d|�d|�d���|��dS)N�_cffi_checkfld_�_CFFI_UNUSED_FNzstatic void rz *p)r�z8  /* only to generate compile-time warnings or errors */z
  (void)p;rr5z
  (void)((p->z) | 0);  /* check that 'r�z' is an integer */r�z[0]rsz*tmpzfield %r�r�z = &p->z; (void)tmp; }z
  /* %s */rzstruct _cffi_align_z { char x; z y; };)r�r�r�r2r�rrIr�rr4rr�)rr�r=r]r�
checkfuncname�fname�ftyper+�fqualr�s           r�_struct_declzRecompiler._struct_declds;��
�;���F��z���/9�z�;�
���
�������
�
�
�u�u�u�
=�>�>�>���S�	�	�	���
G�H�H�H���\����-1�->�->�r�-B�-B�	,�	,�)�E�5�(�E�
,��(�(�*�*��h�!�m�m���{�{����05���u�u�u�e�e�e�E�F�F�F��"�%���9�9�*�!�L�0�E�L�E�4I�4I�!�J�E�!�E�M�E�"�%���9�9�*�!�L�0�E�L�E�4I�4I�����$�$�V�Z��-=�U�$�K�K�K�K��E�E�������%�
,�
,�
,���\�C��F�F�*�+�+�+�+�+�+�+�+�����
,������S�	�	�	����:�:�:�u�u�u�
M�N�N�N�������s�15D7�'BD7�7
E&�E!�!E&Nc��|j|}d}g}t|tj��r|�d��|j�|�d��d}||jjjvr�|�||jjjvr�|j�n>|j	s!t|�����rn|�d��|jr:|jdkrt|�d|j�d����|�d��n|�d	��d
}d�|��pd}g}|���t|�|����}	|	D�]\}
}}}
|�||
|��}|�|d
|j�d|
�d���t(}|dkr
t*}d|z}nK|�!t|tj��r
|j�d}n%d|�|�d��n|j�d|
�d�}|�|dkrd}n-|�d|j�d|
�d�}nd|�d���d|
�d�}|�t3|
|||t5||j|��������t7|jd��}|jd�|��|�d}d}d}n'|�d |j�d!�}d"}nd#|�d�}d$|�d%�}d}nd}d&}d&}|}|jd'�t=|j|||||||����|j� |��dS)(N�
_CFFI_F_UNION�_CFFI_F_OPAQUE�opaque�_CFFI_F_CHECK_FIELDSrz is declared with 'pack=zi'; only 0 or 1 are supported in API mode (try to use "...;", which does not require a 'pack' declaration)�_CFFI_F_PACKED�_CFFI_F_EXTERNAL�external�|�0zfield 'r�r7rz
%d /* bits */z
(size_t)-1z	sizeof(((rr�rOz((char *)&((z
) - (char *)0z	offsetof(r5rr�z
(size_t)-2����unnamedz	sizeof(*(z)0)z-1 /* unknown alignment */zsizeof(zoffsetof(struct _cffi_align_z, y)r�r�)!r�r�r�	UnionTyper�r�rqr�r��partial�anyr��packedr3rRrr�r��_check_not_opaquerr9r:rIr�r4r'r�r0r��extendr?r�rA)rr�r=r]r^rA�reason_for_not_expandingrBrFr��fldnamer�r+r�r8r�offsetrE�alignrDs                    rr_zRecompiler._struct_ctx�s���_�R�(�
�#'� ����b�%�/�*�*�	*��L�L��)�)�)�
�;���L�L�)�*�*�*�'/�$��d�h�&�=�=�=��"��$�(�"2�"I�I�I��{�"����
5�s�2�#=�#=�#?�#?�@�@�
5�����3�4�4�4��y�
/��9�q�=�=�-����R�Y�Y�Y�(�)�)�)�
���-�.�.�.���L�L�+�,�,�,�'1�$�������&�3����#�+��d�/�/��3�3�4�4�J�5?�
E�
E�1���(�E��*�*�2�w��@�@���&�&�w�w�:<�'�'�'�7�7�7�'K�M�M�M����q�=�=�$�B�*�X�5�D�D��]�"�7�E�O�<�<�#���.�'�D�D��/8�.?��
�
�c�*�*�*�09��?�?����!�D��=�H��M�M�)�F�F��*�*�!�������1�F�F�+�46�=�=��3D�3D�3D�3D�g�g�g�N�F�����g�v�t�X�$�R����)A�B�B�D�D�E�E�E�E�!$�D�J�w�$7� 8� 8���J�w��&�&�x�0�0�0��}�#����#����(�(�/8�~�~�~�?�D�8�E�E�)�,1�5�5�2�D�D�DN�J�J�P�E�����D��E� "��.�G��
�>�"�)�)��B�G�Z���e�W�-�x�
9�
9�	:�	:�	:�	
� �$�$�R�(�(�(�(�(rc���t|tj��r!|j}t|tj���!t|tj��r|j�t
d|z���dSdS)Nz0%s is of an opaque type (not declared in cdef()))r�rrIrr�r�rK)rr��locations   rr�zRecompiler._check_not_opaque�s����U�_�-�-�	���B���U�_�-�-�	��b�%�-�.�.�	O�2�;�3F��B�X�M�O�O�
O�	O�	O�3F�3Frc��t|j�����}|�d����|D]�\}}||jvr�|jrt
d|�d����|j�d��r1|jdd��	��r|jdd�}nA|jdkr$|j
dkrd}|�|d��nt
d|�����|�|d|����dS)	Nc��|dS)Nrr%)�tp_orders rr�z7Recompiler._add_missing_struct_unions.<locals>.<lambda>�s
��h�q�k�rr|zinternal inconsistency: z* is partial but was not seen at this point�$r�_IO_FILE�FILE)
rr�r�r�r�r�r3r�
startswith�isdigit�	forcenamerYr_)rr�r��orderr]s     rr�z%Recompiler._add_missing_struct_unions�sJ��
�4�&�,�,�.�.�/�/�����1�1��2�2�2��	7�	7�I�B����1�1�1��:�D�-�-�>@�b�b�/C�D�D�D��7�%�%�c�*�*�5�r�w�q�r�r�{�/B�/B�/D�/D�5�!#������J�J��W�
�*�*�r�|�v�/E�/E�!'�J��%�%�b�&�1�1�1�1�-�-�/1�r�/4�5�5�5�� � ��T�:�6�6�6��	7�	7rc�0�|�|��dSr)r�rQs   r� _generate_cpy_struct_collecttypez+Recompiler._generate_cpy_struct_collecttype�s��� � ��$�$�$�$�$rc�r�|�d��}d|vr||�dd��fS|d|zfS)Nr5r.r�)r4r5)rr�r=s   r�
_struct_nameszRecompiler._struct_names�sD���
�
�b�!�!���%�<�<��%�-�-��S�1�1�1�1��#��+�%�%rc�H�|j|g|�|���R�dSr)r�r�rQs   r�_generate_cpy_struct_declz$Recompiler._generate_cpy_struct_decls1�����"�6�t�1�1�"�5�5�6�6�6�6�6�6rc�H�|j|g|�|���R�dSr)r_r�rQs   r�_generate_cpy_struct_ctxz#Recompiler._generate_cpy_struct_ctx	s1������5�d�0�0��4�4�5�5�5�5�5�5rc��t|tj��r|�||��dS|�|��dSr)r�rr��_generate_cpy_enum_collecttyper�rQs   r�#_generate_cpy_anonymous_collecttypez.Recompiler._generate_cpy_anonymous_collecttypesL���b�%�.�)�)�	)��/�/��D�9�9�9�9�9��$�$�R�(�(�(�(�(rc��t|tj��r|�|��dS|�||d|z��dS�N�typedef_)r�rr��_generate_cpy_enum_declr�rQs   r�_generate_cpy_anonymous_declz'Recompiler._generate_cpy_anonymous_declsS���b�%�.�)�)�	;��(�(��,�,�,�,�,����b�$�
�T�(9�:�:�:�:�:rc��t|tj��r|�||��dS|�||d|z��dSr�)r�rr��	_enum_ctxr_rQs   r�_generate_cpy_anonymous_ctxz&Recompiler._generate_cpy_anonymous_ctxsS���b�%�.�)�)�	:��N�N�2�t�$�$�$�$�$����R��z�D�'8�9�9�9�9�9r�constc�B�||f|jvrtd|�d|�d����|j�||f��|j}d|�d|��}|ry|d|z��|d��|d|�d	���|d
|�d|�d���|�&|d
krd|fz}|d|�d���|d��|d��|d��nM|�J�|d|z��|d��|d|�d���d|�d���|d��|��dS)Nzduplicate declaration of z 'r7�_cffi_r�z$static int %s(unsigned long long *o)r�z  int n = (z) <= 0;z  *o = (unsigned long long)((z) | 0);  /* check that z is an integer */rz%dUz  if (!_cffi_check_int(*o, n, z))z    n |= 2;z  return n;rzstatic void %s(char *o)z  *(rz)o = ro)rrrAr�r4)r�is_intrr��categoryrr�funcnames        r�_generate_cpy_constzRecompiler._generate_cpy_const&s����d��t�3�3�3�#�#�6>�h�h����E�G�G�
G��� � �(�D�!1�2�2�2��z���$,�H�H�d�d�3���	��D�7�(�B�C�C�C��D��I�I�I��D�D�4�4�4�1�2�2�2��D�D�:>�$�$����F�
G�
G�
G��&���?�?�"'�;�.�"8�K����[�[�[�J�K�K�K���]�#�#�#��D������D��I�I�I�I��&�&�&��D�*�X�5�6�6�6��D��I�I�I��D�D�R�]�]�3�%7�%7�%7�%7����>�?�?�?��D��I�I�I�������rc�n�|���}|r|jr|�|��dSdSr)r2rsr��rr�rr�s    r�"_generate_cpy_constant_collecttypez-Recompiler._generate_cpy_constant_collecttypeDsI���#�#�%�%���	&��.�	&��!�!�"�%�%�%�%�%�	&�	&rc�\�|���}|�|||��dSr)r2r�r�s    rrxz&Recompiler._generate_cpy_constant_declIs1���#�#�%�%��� � ���r�2�2�2�2�2rc�2�|js*|���rttd��}n3|jrt}nt
}|j|}t||��}|jd�t|d|z|����dS)Nr�r��_cffi_const_%s)
rsr2r��OP_CONSTANT_INT�OP_DLOPEN_CONST�OP_CONSTANTr�r�r�r)rr�rr�
const_kindrAs      rr�z%Recompiler._generate_cpy_constant_ctxMs����$�	5��);�);�)=�)=�	5��_�b�1�1�G�G��$�
)�,�
�
�(�
����,�J��Z��4�4�G��
�8��#�#��t�-��4�g�>�>�	@�	@�	@�	@�	@rc�0�|�|��dSr)r�rQs   rr�z)Recompiler._generate_cpy_enum_collecttype]s�����b�!�!�!�!�!rc�F�|jD]}|�d|���dS)NT)�enumeratorsr�)rr�r�
enumerators    rr�z"Recompiler._generate_cpy_enum_decl`s6���.�	7�	7�J��$�$�T�:�6�6�6�6�	7�	7rc	���|j|}ttd��}|jr|���t|j|j��D]9\}}|jd�	t|d|z||������:|�d|vr|jsd|z}d|z}nn|�|jg��}	|j�
|	��}tt|j�|	d����dk��}d	�|j��}
|jd
�	t#|j||||
����dS)Nr�r�r��rr�z
sizeof(%s)z
((%s)-1) <= 0rrNr�)r�r��OP_ENUMrs�check_not_partial�zipr��
enumvaluesr�r�r�build_baseinttyperq�sizeof�int�castrRrUr)rr�r=rArr��	enumvaluerrX�basetprYs           rr�zRecompiler._enum_ctxds{���_�R�(�
���"�%�%��� �	#�� � �"�"�"�%(�����%G�%G�	3�	3�!�J�	��J�x� �'�'��:�'7�*�'D�g�'0�2�2�2�
3�
3�
3�
3����E�!1�!1�$�:O�!1��%�'�D�$�u�,�F�F��)�)�$�(�B�7�7�F��8�?�?�6�*�*�D���T�X�]�]�6�2�6�6�7�7�!�;�<�<�F��8�8�B�N�+�+���
�6��!�!��R�W�j�$���A�A�	C�	C�	C�	C�	Crc�V�|�||�����dSr)r�r
rQs   r�_generate_cpy_enum_ctxz!Recompiler._generate_cpy_enum_ctxys&�����r�2�>�>�+�+�,�,�,�,�,rc��dSrr%rQs   r�_generate_cpy_macro_collecttypez*Recompiler._generate_cpy_macro_collecttyperWrc�L�|dkrd}n|}|�d||���dS)Nr�Tr�)r�)rr�rrs    r�_generate_cpy_macro_declz#Recompiler._generate_cpy_macro_decl�s8��
��;�;��K�K��K�� � ��t�� �E�E�E�E�Erc���|dkr|jrtd|�d����d}n|}ttd��}|jd�t
|d|z||�����dS)Nr�z(cannot use the syntax '...' in '#define z ...' when using the ABI moder�r�r�r�)rsrr�r�r�r�r)rr�rrrs     r�_generate_cpy_macro_ctxz"Recompiler._generate_cpy_macro_ctx�s���
��;�;��$�
4�'�'�,0�D�D�3�4�4�4��K�K��K���"�-�-���
�8��#�#��t�-��4�g�#.�
0�
0�
0�	1�	1�	1�	1�	1rc���t|tj��rF|j}|dkrd|�d�}|�|jd|z��}tj||��}|S)Nr�z_cffi_array_len(rOr�)r�rrIr�rPr)rr��global_namer�r�s     rrPzRecompiler._global_type�si���b�%�/�*�*�	9��I�M���%�%�%�9D��� F�
��'�'����;�1F�G�G�G����-�8�8�B��	rc�X�|�|�||����dSr)r�rPrQs   r�"_generate_cpy_variable_collecttypez-Recompiler._generate_cpy_variable_collecttype�s,�����d�/�/��D�9�9�:�:�:�:�:rc�Z�|j}|�||��}t|tj��r|j�
|j}d}nd}d|�d�}|d|�||j���z��|d��|d|�d	|�d
���|d��|��dS)Nr5�&z*_cffi_var_rrmr�r�z	  return rr0r)	r�rPr�rrIr�rr4r�)rr�rr�	ampersandr�s      r�_generate_cpy_variable_declz&Recompiler._generate_cpy_variable_decl�s����z��
�
�
�r�4�
(�
(���b�%�/�*�*�	�r�y�/@���B��I�I��I��)-���.����Y����t�4�3F��G�G�
G�H�H�H���S�	�	�	����9�9�9�d�d�d�
3�4�4�4���S�	�	�	�������rc
��|�||��}|j|}|jrt}nt}|jd�t|d|zt||������dS)Nr�z_cffi_var_%s)	rPr�rs�
OP_GLOBAL_VAR�OP_GLOBAL_VAR_Fr�r�rr�)rr�rrAr8s     r�_generate_cpy_variable_ctxz%Recompiler._generate_cpy_variable_ctx�s���
�
�
�r�4�
(�
(���_�R�(�
�� �	!��B�B� �B��
�8��#�#��t�^�d�2�F�2�z�4J�4J�K�K�	M�	M�	M�	M�	Mrc�h�t|tj��sJ�|�|��dSr)r�rr�r�rQs   r�'_generate_cpy_extern_python_collecttypez2Recompiler._generate_cpy_extern_python_collecttype�s5���"�e�3�4�4�4�4�4����b�!�!�!�!�!rc	���|j}t|jtj��rd}n$d|z}d|j�d|���d�}|d|z��|d|j�d|�d	|�d
���|��g}d|z}t|j��D]3\}}	|	�d|z|��}
|�	|
���4d
�
|��}|pd}|�d|�d�}|jdkrd|z}d�}
tt|j��dzd��}|
|j��rt|d��}t|jtj��r9d|j�d��||j�d��|fz}||�|j�|������|d��|d|z��|d��t|j��D]o\}}	d|z}
t|	tj��s|
|	��rd|
z}
tj|	��}	|d|	�d��|dz|
fz���p|d|z��t|jtj��s'|d|j�d���d���|d ��|��|xjd!z
c_dS)"Nr�rpz(int)sizeof(r5rOz3static struct _cffi_externpy_s _cffi_externpy__%s =rr�r/z	, 0, 0 };riz a%drrkr�	__stdcallz_cffi_stdcall c�L�t|tj��o
|jdkS)NrG)r�rrvrr�s r�may_need_128_bitsz9Recompiler._extern_python_decl.<locals>.may_need_128_bits�s&���r�5�#6�7�7�-��G�}�,�
.rr^�z!sizeof(%s) > %d ? sizeof(%s) : %dr�z
  char a[%s];z  char *p = a;za%dr
z  *(%s)(p + %d) = %s;rz,  _cffi_call_python(&_cffi_externpy__%s, p);z  return *(z)p;rr)r�r�rtrr�r4rrr�r�r�rRryrwr0r�r�r)rr�r�
tag_and_spacer�size_of_resultrMr~r�r&r�r�r�r�	size_of_as               r�_extern_python_declzRecompiler._extern_python_decl�sl���z���b�i���0�0�	4� �N�N�$�t�+�G�G��	�$�$�R��1�1�1�1�4�N���
B�T�
I�J�J�J��������d�d�d�N�N�N�4�	5�	5�	5�������	�"�T�)�� ���)�)�	"�	"�G�A�t��/�/�&�1�*�g�6�6�C����S�!�!�!�!����9�-�-��'�1�6��)-���~�~�~�>��
�6�[� � �!1�4F�!F��	.�	.�	.���B�G���Q���*�*�	���R�Y�'�'�	+��I�r�*�*�I��b�i��!4�5�5�	5�;��	�$�$�R�(�(�)��	�$�$�R�(�(�)�?5�5�I�	
��}�}�b�i�&:�&:�;M�&N�&N�&N�
O�P�P�P���S�	�	�	���_�y�
(�)�)�)���
���� ���)�)�	M�	M�G�A�t��!�)�C��4��!4�5�5�
/�%�%�d�+�+�
/��C�i���(��.�.���D�(�D�O�O�C�,@�,@�!�A�#�s�+K�K�L�L�L�L���
;�d�
B�C�C�C��"�)�U�^�4�4�	D��D�D�r�y�';�';�C�'@�'@�'@�'@�B�C�C�C���S�	�	�	���������a�����rc�4�|�||d��dS)Nrm�rrQs   r� _generate_cpy_extern_python_declz+Recompiler._generate_cpy_extern_python_decls ��� � ��T�9�5�5�5�5�5rc�4�|�||d��dS)NzCFFI_DLLEXPORT r rQs   r�#_generate_cpy_dllexport_python_declz.Recompiler._generate_cpy_dllexport_python_decl
s!��� � ��T�+<�=�=�=�=�=rc�4�|�||d��dS)Nr5r rQs   r�'_generate_cpy_extern_python_plus_c_declz2Recompiler._generate_cpy_extern_python_plus_c_decl
s ��� � ��T�2�.�.�.�.�.rc��|jrtd���|jrtd���|j|}tt|��}|jd�t|d|z||����dS)Nz,cannot use 'extern "Python"' in the ABI modez$a vararg function is extern "Python"r�z&_cffi_externpy__%s)
rsrrdr3r�r��OP_EXTERN_PYTHONr�r�r)rr�rrArs     r�_generate_cpy_extern_python_ctxz*Recompiler._generate_cpy_extern_python_ctxs���� �	B�#�@�B�B�
B�
�;�	P�%�&N�O�O�O��_�R�(�
��)�:�6�6���
�8��#�#��t�2�T�9�7�D�I�I�	K�	K�	K�	K�	Krc�r�|j}|d��t|t��s|�d��}n|�d��	|�d��n#t
$rd|z}YnwxYw|�d��D]�}|}td��turtt|��}nt|��dd�}|d	|z�����d
}|D]+}t|��dkr
||��d
}|d|fzz
}�,||����dS)
Nz=// # NB. this is not a string because of a size limit in MSVCzutf-8�asciis# -*- encoding: utf8 -*-
Tz//rr�z// r5�Lz%d,)
r�r��bytes�encode�decode�UnicodeDecodeError�
splitlinesr&�map�ordr*�rstripr0)r�sr�linerD�printed_line�cs       rrz)Recompiler._print_string_literal_in_arraysu���z����
L�M�M�M��!�U�#�#�	�����!�!�A�A�
�H�H�W����	2�
�H�H�W������!�	2�	2�	2�-��1�A�A�A�	2�����L�L��&�&�	�	�D��G��D�z�z�U�"�"��3��~�~��� ��.�.��2��.���D�%�'�/�)�)�+�+�,�,�,��L��
-�
-���|�$�$��*�*��D��&�&�&�#%�L������,����D������	�	s�A*�*A<�;A<c�J�ttt��|j|<dSr)r��OP_PRIMITIVE�	PRIM_VOIDr��rr�rs   r�_emit_bytecode_VoidTypez"Recompiler._emit_bytecode_VoidType=s��!'��i�!@�!@������rc�d�t|j}tt|��|j|<dSr)�PRIMITIVE_TO_INDEXrr�r9r�)rr�rrgs    r�_emit_bytecode_PrimitiveTypez'Recompiler._emit_bytecode_PrimitiveType@s*��'���0�
�!'��j�!A�!A������rc�v�d|j�d|j�d|j�d�}tt|��|j|<dS)Nz_cffi_prim_int(sizeof(z), (
           ((z)-1) | 0 /* check that z' is an integer type */
         ) <= 0)�rr�r9r��rr�rr4s    r�!_emit_bytecode_UnknownIntegerTypez,Recompiler._emit_bytecode_UnknownIntegerTypeDsD���$&�7�7�7�B�G�G�G�R�W�W�W�>��"(��a�!8�!8������rc�f�d|j�d|j�d�}tt|��|j|<dS)Nz_cffi_prim_float(sizeof(z) *
           (((z6)1) / 2) * 2 /* integer => 0, float => 1 */
         )rArBs    r�_emit_bytecode_UnknownFloatTypez*Recompiler._emit_bytecode_UnknownFloatTypeJs<��� �W�W�W�b�g�g�g�/��"(��a�!8�!8������rc�
�tt|j|j��|j|<|dz
}|jD]h}|j|}||krNt
|tj��r|�	||��ntt|��|j|<|dz
}�it|j��}|j
�(|j
dkr|dz}ntd|j
�����tt|��|j|<dS)Nrrr\zabi=)r��OP_FUNCTIONr�rtr�r�r�rrvr?r9r�rdryr3�OP_FUNCTION_END)rr�rr��	realindexrBs      r�_emit_bytecode_RawFunctionTypez)Recompiler._emit_bytecode_RawFunctionTypePs��!'��T�_�R�Y�5O�!P�!P�����
��
���7�	�	�C����,�I��	�!�!��c�5�#6�7�7�H��5�5�c�5�A�A�A�A�-3�G�Y�-G�-G�D�O�E�*��Q�J�E�E��B�K� � ��
�6���v��$�$���
���)�)�b�f�f�*>�?�?�?�!'���!?�!?������rc�`�tt|j|j��|j|<dSr)r��
OP_POINTERr�rar�r;s   r�_emit_bytecode_PointerTypez%Recompiler._emit_bytecode_PointerTypecs'��!'�
�D�O�B�I�4N�!O�!O������rc�~�|���}tt|j|��|j|<dSr)r�r�rLr�r�)rr�r�raws    r�_emit_bytecode_FunctionPtrTypez)Recompiler._emit_bytecode_FunctionPtrTypeis6��� � �"�"��!'�
�D�O�C�4H�!I�!I������rc��|j|j}|j�tt|��|j|<dS|jdkr4t
dt|���dd���d����|j|dzdksJ�tt|��|j|<tdt|j����|j|dz<dS)Nr�ztype z/*...*/zb badly placed: the '...' array length can only be used on global arrays or on fields of structuresrr)
r�rr�r��
OP_OPEN_ARRAYr�rr�r5�OP_ARRAY)rr�r�
item_indexs    r�_emit_bytecode_ArrayTypez#Recompiler._emit_bytecode_ArrayTypems����_�R�W�-�
�
�9��%+�M�:�%F�%F�D�O�E�"�"�"�
�Y�%�
�
�#�#���G�G�O�O�I�u�5�5�5�5�8�9�9�
9�
�?�5�1�9�-��6�6�6�6�%+�H�j�%A�%A�D�O�E�"�)/��c�"�)�n�n�)E�)E�D�O�E�A�I�&�&�&rc�Z�|j|}tt|��|j|<dSr)r�r��OP_STRUCT_UNIONr�)rr�r�struct_indexs    r�_emit_bytecode_StructTypez$Recompiler._emit_bytecode_StructType{s+���*�2�.��!'���!F�!F������rc�Z�|j|}tt|��|j|<dSr)r�r�r�r�)rr�r�
enum_indexs    r�_emit_bytecode_EnumTypez"Recompiler._emit_bytecode_EnumType�s)���[��_�
�!'���!<�!<������r�F)r5r)Nr�N)Vr"r#r$rrryr�r�r�r�r�r�r�r�r�r�rr�r'r?rDr7rNrRrTrVrYrbrer�r�r�r�r�r_r�r�r��_generate_cpy_union_collecttyper�r��_generate_cpy_union_declr��_generate_cpy_union_ctxr�r�r�r�r�rxr�r�r�r�rrrrrPrrrr�*_generate_cpy_dllexport_python_collecttype�._generate_cpy_extern_python_plus_c_collecttyperr!r#r%r(�"_generate_cpy_dllexport_python_ctx�&_generate_cpy_extern_python_plus_c_ctxrr<r?rCrErJrM�_emit_bytecode_ConstPointerType�_emit_bytecode_NamedPointerTyperPrUrY�_emit_bytecode_UnionTyper\r%rrroro~s��������M�%�%�%�%�0�0�0�81�81�81�t	<�	<�	<�-�-�-�&���&H�G�G�I�,�,�,�>#�#�#�#�2�2�2����k�k�k�Z"�"�"�0�0�0�h%�%�%�+(�+(�+(�ZK�K�K����*�*�*�F=�=�=�<�<�<�
�
�
�F�F�F�+�+�+�&�&�&�
`�`�`�D2�2�2�,
�
�
�2�2�2� � � �DT)�T)�T)�T)�lO�O�O�7�7�7�.%�%�%�&F�#�&�&�&�7�7�7�8��6�6�6�6��)�)�)�;�;�;�:�:�:�CJ�(,�����<&�&�&�
3�3�3�@�@�@� "�"�"�7�7�7�7�C�C�C�*-�-�-�
�
�
�F�F�F�1�1�1�"���;�;�;����.M�M�M�"�"�"�
.�.�.�4�4 �4 �4 �l6�6�6�>�>�>�/�/�/�	K�	K�	K�&�&�&�,����<A�A�A�B�B�B�9�9�9�9�9�9�@�@�@�&P�P�P�'A�#�&@�#�J�J�J�F�F�F�G�G�G� 9��=�=�=�=�=rro)r	c���eZdZ�fd�Z�xZS)�NativeIOc���t|t��r|�d��}tt|���|��dS)Nr*)r��unicoder-�superrir�)rr4r�s  �rr�zNativeIO.write�sJ����!�W�%�%�
&��H�H�W�%�%���(�D�!�!�'�'��*�*�*�*�*r)r"r#r$r��
__classcell__)r�s@rriri�s8�������	+�	+�	+�	+�	+�	+�	+�	+�	+rric�X�|rtd|����t|||du���}|���|���t	��}|�||��|���}	t|d��5}|�t|��dz��|krt�	ddd��n#1swxYwY|rtd��dS#t$r�d|tj��fz}	t|	d��5}|�
|��ddd��n#1swxYwY	tj|	|��n9#t$r,tj|��tj|	|��YnwxYwYd	SwxYw)
Nzgenerating )rsr�rz(already up-to-date)Fz%s.~%d�wT)�printror�r�rir��getvaluer��readr0�IOErrorr��getpidr��rename�OSError�unlink)
rqrrr��target_file�verbose�
recompilerr��output�f1�tmp_files
          r�_make_c_or_py_sourcer~�sL���0�
����.�/�/�/��C��.6�$�.>�A�A�A�J��!�!�#�#�#��"�"�$�$�$��
�
�A�� � ��H�-�-�-�
�Z�Z�\�\�F��
�+�s�
#�
#�	�r��w�w�s�6�{�{�Q��'�'�6�1�1��
�2�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��	*��(�)�)�)��u���	�	�	��{�B�I�K�K�8�8��
�(�C�
 �
 �	�B��H�H�V����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	-��I�h��,�,�,�,���	-�	-�	-��I�k�"�"�"��I�h��,�,�,�,�,�	-�����t�t�	���s~�
C6�1C�C6�C�C6�C� C6�62F)�(E
�>F)�
E	�F)�E	�F)�E,�+F)�,3F"�F)�!F"�"F)�(F)Fc�0�|�J�t|||||��Sr�r~)rqrrr��
target_c_filerys     r�
make_c_sourcer��s+��������[�(�M� '�)�)�)rc�(�t||d||��Srr�)rqrr�target_py_filerys    r�make_py_sourcer��s����[�$�� '�)�)�)rc��|�d��}	tjtjj|g|dd��R���n#t
$rYnwxYw|dxx|z
cc<tjj|g|�R�|fS)Nr�r�)r�r��makedirsr�rRrv)�	outputdir�modname�	extension�partss    r�_modname_to_filer��s����M�M�#���E�
�
��B�G�L��8�U�3�B�3�Z�8�8�8�9�9�9�9���
�
�
���
����	�"�I�I�I���I�I�I�
�7�<�	�*�E�*�*�*�E�1�1s�1A	�	
A�Ac�x�t||��}|�|||f��t|||��|Sr)r�r��setattr)�	patchlist�clsr�new_meth�olds     r�_patch_methr��sC��
�#�t�
�
�C�
���c�4��%�&�&�&��C��x� � � ��Jrc�T�t|��D]\}}}t|||���dSr)�reversedr�)r�r�r�old_meths    r�_unpatch_methsr��s?��'�	�2�2�%�%���T�8���T�8�$�$�$�$�%�%rc���tjdkrddlm}t	||dd���tjdkrddlm}�fd�}t	||d	|���dSdS)
Nrr)�MSVCCompiler�_remove_visual_c_refc��|Srr%)r�
manifest_files  rr�z&_patch_for_embedding.<locals>.<lambda>�s��
�r�darwin)�	CCompilerc���d|jvr=t|j��|_|j�d��}d|j|<�|g|�Ri|��S)Nz-bundlez-dynamiclib)�	linker_sorr)rr��kwdsr��old_link_shared_objects    �r�my_link_shared_objectz3_patch_for_embedding.<locals>.my_link_shared_object�sc����D�N�*�*�!%�d�n�!5�!5����N�(�(��3�3��$1���q�!�)�)�$�>��>�>�>��>�>�>r�link_shared_object)�sys�platform�distutils.msvc9compilerr�r��distutils.ccompilerr�)r�r�r�r�r�s    @r�_patch_for_embeddingr��s����
�|�w���8�8�8�8�8�8��I�|�-C�=�=�	?�	?�	?��|�x���1�1�1�1�1�1�	?�	?�	?�	?�	?�"-�Y�	�-A�-B�"D�"D���� �rc����ddlm}��d��r;�dd��tjdkr�dz
�ntjdkr�dz
�n�d	z
�t||d
�fd���dS)Nr)�	build_extz.*r�rz.dllr�z.dylibz.so�get_ext_filenamec����Srr%)r�ext_name�targets  �rr�z#_patch_for_target.<locals>.<lambda>�s���v�r)�distutils.command.build_extr��endswithr�r�r�)r�r�r�s ` r�_patch_for_targetr��s����5�5�5�5�5�5����t�����������<�7�"�"��f��F�F�
�\�X�
%�
%��h��F�F��e�O�F��	�9�&8�-�-�-�-�/�/�/�/�/rr�T�.cc��t|t��s|�d��}|jr|�|��|���|jdu}|r|�|��|�0t|||��\}}
|r|g|
z}
tj	j
|
�}n|}|	�
|rd|z}	nd}	tj||fi|��}t|||||���}|r�g}tj��}	|rt|��|	dkrt!||	��|r<|dkrd}nd}t#|�dtj	�|������tj|��tjd|||
��}tj|��t+|��n(#tj|��t+|��wxYw|S||fS|�t||d	��\}}t-||||���}|r|Sd|fS)
Nr*z%s.*r)ryr�zthe current directory isz setting the current directory tor.z.py)r�r�r-�_windows_unicode�_apply_windows_unicoder�_apply_embedding_fixr�r�r�rRr�
get_extensionr��getcwdr�r�rp�abspath�chdir�compiler�r�)rqrrr��tmpdir�call_c_compiler�c_file�source_extension�extradir�compiler_verboser��debugr��	embeddingr��
ext_c_file�ext�updatedr��cwd�msg�outputfilenamer�s                      r�	recompiler��sv���k�3�'�'�2�!�(�(��1�1��
��)��"�"�4�(�(�(����^�4�/�	��	+��$�$�T�*�*�*��>�,�V�[�-=�?�?�M�F�E��
+�!�
�U�*�����u�-�J�J��J��>��
��+�-������'�
�K�H�H�4�H�H����[�(�F�(8�:�:�:���	 ��I��)�+�+�C�
*��4�(��3�3�3��S�=�=�%�i��8�8�8�#�D���}�}�8���@���S�S�S�"�'�/�/�&�*A�*A�*A�B�C�C�C���� � � �!,�!4�S�#�5E�u�"N�"N�����
�
�
��y�)�)�)�)�����
�
�
��y�)�)�)�)����!�!���<���>�(���e�D�D�I�F�A� ��k�6�)9�;�;�;���	!��M���=� s
�)BF�%Gr])r�TNr�NrNN)!r�r��ior5rr�errorr�cffi_opcodertrr6r��version_inforrr'r?rUriro�StringIOri�BytesIOr~r�r�r�r�r�r�r�r�r%rr�<module>r�s��������������� � � � � � � � �$�$�$�$�$�$������������<�7�*�.�c�.>��.G�.��#�v�-��1�1�1�1�1�1�1�1� )�)�)�)�)�)�)�)�8#�#�#�#�#�#�#�#�:?�?�?�?�?�?�?�?�0	K�	K�	K�	K�	K�	K�	K�	K�D=�D=�D=�D=�D=�D=�D=�D=�N(��t����{�H�H�+�+�+�+�+�2�:�+�+�+����8)�)�)�)�
)�)�)�)�2�2�2����%�%�%�D�D�D�(/�/�/�"GK�;?�59�<!�<!�<!�<!�<!�<!r

?>