HOME


Mini Shell 1.0
DIR: /snap/certbot/4482/lib64/python3.12/site-packages/cffi/__pycache__/
Upload File :
Current File : //snap/certbot/4482/lib64/python3.12/site-packages/cffi/__pycache__/cparser.cpython-312.pyc
�

�S�g������ddlmZddlmZmZddlmZmZ	ddlmZ	ddlZddlZddl
Z
	e
jdkrddlZnddlZej"�Zd�Zd	Zej*d
ej,ej.z�Zej*dej,ej.z�Zej*dej.�Zej*d
�Zej*d�Zej*d�Zej*d�Zdaej*dej@�Z!ej*d�Z"ej*d�Z#ej*d�Z$ej*d�Z%ej*d�Z&ej*d�Z'ej*d�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d �Z0d!�Z1Gd"�d#e2�Z3y#e
$rddl	Z	Y���wxYw#e
$rdZY���wxYw)$�)�model)�COMMON_TYPES�resolve_common_type)�FFIError�	CDefError)�
_pycparser�N)�c��ddl}ddl}y�Nr	)�pycparser.yacctab�pycparser.lextab)�	pycparsers �|/build/snapcraft-certbot-29b1212f749eeba2f1dece1adfe9a83a/parts/certbot/install/lib/python3.12/site-packages/cffi/cparser.py�%_workaround_for_static_import_findersrs
����z<cdef source string>z/\*.*?\*/|//([^\n\\]|\\.)*?$z?^\s*#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)\b((?:[^\n\\]|\\.)*?)$z^[ \t]*#[ \t]*(?:line|\d+)\b.*$z=\s*\.\.\.\s*[,}]|\.\.\.\s*\}z__dotdotdot\d+__$z\[\s*\.\.\.\s*\]z\w+|\Sz-?0?x?[0-9a-f]+[lu]*$z\b(__stdcall|WINAPI)\bz[(]\s*(__stdcall|WINAPI)\bz\b__cdecl\bz9\bextern\s*"(Python|Python\s*\+\s*C|C\s*\+\s*Python)"\s*.z'[*]\s*((const|volatile|restrict)\b\s*)+z3(\b(int|long|short|signed|unsigned|char)\s*)+\.\.\.z\b(double|float)\s*\.\.\.c�B�t�tj�atS�N)�
_parser_cacher�CParser�rr�_get_parserr2s����!�)�)�+�
��rc�V�g}	tj|�}|sn�|j|d|j��|jd�d}|j|j	��|j�}|j
d|�r|jd�|dz
}d}|}|t|�kr?||}|dk(r|dz
}n|dk(r|dk(rn$|dz}n
|dvr|dk(rn|dz
}|t|�kr�?||||z||dz}��|j|�dj|�S)N�(�)�*r	rz,;=�)	�_r_star_const_space�search�append�start�group�end�
startswith�len�join)�csource�parts�match�closing�endpos�level�i�cs        r�_workaround_for_old_pycparserr/8s<��
�E�
�#�*�*�7�3����
���W�^�e�k�k�m�,�-�
���S��S�7�
���U�[�[�]�#���������c�6�*��L�L���w�#�~�w������#�g�,����
�A��C�x���
���c���A�:����
���e���A�:��
��F�A��#�g�,���&��#�g�-�����;��3�6
�L�L���
�7�7�5�>�rc���g}	tj|�}|s�n-|j�dz
}|j|d|j	��d|jd�vr|jd�n|jd�||dk(rf|j
d|�}|dkrtd��|j
d|dz|�dk\rtd	��|j||dz|�||dzd}nA|j
d
|�}|dkrtd��|j|||dz�||dzd}|jd���F|j|�d
j|�S)Nr�Cz(void __cffi_extern_python_plus_c_start; z!void __cffi_extern_python_start; �{�}r	z!'extern "Python" {': no '}' foundz7cannot use { } inside a block 'extern "Python" { ... }'�;z'extern "Python": no ';' foundz  void __cffi_extern_python_stop;r)
�_r_extern_pythonrr#r r!r"�findr�NotImplementedErrorr&)r'r(r)r+r*�	semicolons      r�_preprocess_extern_pythonr9bsu��
�E�
� �'�'��0��������q���	���W�^�e�k�k�m�,�-��%�+�+�a�.� ��L�L�C�D��L�L�<�=��6�?�c�!��l�l�3��/�G���{�� E�F�F��|�|�C��!��W�5��:�)�+H�I�I��L�L�����'�2�3��g�a�i�j�)�G� ���S�&�1�I��1�}�� B�C�C��L�L���	�!��4�5��i��k�l�+�G�
���7�8�=�B
�L�L���
�7�7�5�>�rc��d|vry|j�D]=}d|vs�|j�jd�r�(ddl}|j	d�yy)N�"�#r	z�String literal found in cdef() or type source. String literals are ignored here, but you should remove them anyway because some character sequences confuse pre-parsing.)�
splitlines�lstripr$�warnings�warn)r'�liner?s   r�_warn_for_string_literalrB�sX��
�'����"�"�$����$�;�t�{�{�}�7�7��<���M�M�1�
2�
�rc�d�|js$ddl}|jd|j�d��yy)Nr	zGlobal variable 'z_' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern'))�storager?r@�name)�declr?s  r�/_warn_for_non_extern_non_static_global_variablerG�s)���<�<���
�
�.2�i�i�:�	;�rc�F��g��fd�}tj||�}|�fS)Nc�b��t��}�j|j��d|zS)Nz#line@%d)r%r r")�mr-�line_directivess  �r�replacez(_remove_line_directives.<locals>.replace�s+����� �����q�w�w�y�)��A�~�r��_r_line_directive�sub)r'rLrKs  @r�_remove_line_directivesrP�s.���
�O�� �#�#�G�W�5�G��O�#�#rc�:���fd�}tj||�S)Nc�~��|j�}|jd�std���t|dd�S)Nz#line@zBunexpected #line directive (should have been processed and removed�)r"r$�AssertionError�int)rJ�srKs  �rrLz*_put_back_line_directives.<locals>.replace�sD���
�G�G�I���|�|�H�%� �"K�L�
L��s�1�Q�R�5�z�*�*rrM)r'rKrLs ` r�_put_back_line_directivesrW�s���+�� � ��'�2�2rc�,�t|�\}}d�}tj||�}i}tj	|�D]:}|j�\}}|j
dd�j�}|||<�<tjd|�}tjdkrt|�}tjd|�}tjd|�}tjd|�}t|�}t|�t jd|�}t#t$j	|��}t't)|��D]u\}}|j+�}	||	d	k(r:|j-d
|	|j/��}
|
|	kDsJ�d|d|	|||
dzdfz}�X||	|	dzd
k(sJ�d
|d|	|||	dzdfz}�wt0jd|�}t2jd|�}|j
d
d�}t5||�}||fS)Nc�L�d|j�jd�dzzS)N� �
)r"�count)rJs r�replace_keeping_newlinesz-_preprocess.<locals>.replace_keeping_newlines�s!���Q�W�W�Y�_�_�T�*�T�1�1�1rz\
rz2.14z volatile volatile const(z volatile volatile const rZz[__dotdotdotarray__]�=�...z%s,__dotdotdot%d__ %sr
z%s __dotdotdot%d__ %sz __dotdotdotint__ z __dotdotdotfloat__ z __dotdotdot__ )rP�
_r_commentrO�	_r_define�finditer�groupsrL�stripr�__version__r/�_r_stdcall2�_r_stdcall1�_r_cdeclr9rB�_r_partial_array�list�_r_partial_enum�	enumerate�reversedr!r6r#�_r_int_dotdotdot�_r_float_dotdotdotrW)r'rKr]�macrosr)�	macroname�
macrovalue�matches�number�p�p2s           r�_preprocessrw�s1�� 7�w�?��G�_�2��n�n�5�w�?�G�
�F��#�#�G�,�'�� %�����	�:��'�'���3�9�9�;�
�&��y��'��m�m�B��(�G����v�%�/��8���o�o�9�7�C�G��o�o�9�7�C�G��l�l�3��(�G�(��0�G��W�%��"�"�#9�7�C�G��?�+�+�G�4�5�G�"�8�G�#4�5�
@�
����K�K�M���1�:������e�Q��	�	��4�B���6�M�6�-���!��f�18��A����1A�A�G��1�Q�q�S�>�U�*�*�*�-���!��f�18��1����1@�@�G�
@��"�"�#7��A�G� �$�$�%;�W�E�G��o�o�e�%6�7�G�'���A�G��F�?�rc�F�tt�}|jd�|jd�|jd�|jd�|jd�t�}d}d}d}tj	|�D]�}||vr�|dk(r'|r�|j|�|j|�d}n`|dk(rd	}d}nV|dk(r|d
z
}nK|dk(r|d
z}n@|dk(r*|r9|dk(r4|j|�|j|�n|j|�|}��|S)Nr4�,rr�typedefFr	rTr)�setr�add�_r_words�findall�discard)r'�look_for_words�
words_used�
is_typedef�paren�
previous_word�words       r�_common_type_namesr��s.����&�N����s�����s�����s�����s�����y�!���J��J�
�E��M�� � ��)����>�!��s�{���&�&�}�5�"�*�*�=�9�!&�J���"�!�
��������
�������
������%�1�*��&�&�}�5�"�*�*�=�9����t�$��
�)�*�rc���eZdZd�Zd�Zd�Zd�Z		dd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zdd�Zd�Zdd�Z		d d�Zdd�Zd�Zd!d�Zd�Zd"d�Zd�Zd�Zd�Zd�Zd�Zy)#�Parserc��i|_t�|_d|_t	j
�|_i|_i|_g|_	d|_
yr)�
_declarationsr{�_included_declarations�_anonymous_counter�weakref�WeakKeyDictionary�_structnode2type�_options�_int_constants�_recomplete�_uses_new_feature)�selfs r�__init__zParser.__init__)sL�����&)�e��#�"#��� '� 9� 9� ;�����
� ������!%��rc�p�t|�\}}t|�}g}t|j�D];}|j	d�s�|dd}|j|�|j
|��=|t|�z
}g}|jd�|D]}|jd|z��|jd�|jdt�d��|j|�|jd�d	j|�}t�tj�	t�j|�}	t�tj#�		||fS#tjj$r}
|j!|
|�Yd}
~
�Td}
~
wwxYw#t�tj#�wwxYw)
N�typedef �z*# 1 "<cdef automatic initialization code>"ztypedef int %s;z@typedef int __dotdotdotint__, __dotdotdotfloat__, __dotdotdot__;z# 1 "r;rr[)rwr��sortedr�r$r r�CDEF_SOURCE_STRINGr&�lock�acquirer�parser�c_parser�
ParseError�convert_pycparser_error�release)r�r'rp�ctn�	typenamesrE�csourcelines�typename�fullcsource�ast�es           r�_parsez
Parser._parse3s���%�g�.����
!��)���	��4�-�-�.�	"�D����z�*��A�B�x��� � ��&����D�!�		"�
	�V�C�[� �	������H�I�!�	>�H���� 1�H� <�=�	>����.�	/�	���*<�>�?����G�$����B���i�i��-�����L�L�N�	��-�%�%�k�2�C��������F�G�#�#��
�!�!�,�,�	5��(�(��G�4�4��	5�������� �s*�#E�F�9F�F�F�F�F5c���d}t|�}tjt�d�|�}|rKt	|jd�d�}|j
�}d|cxkrt|�krn|S||dz
}|S)Nz:(\d+):r�
)�str�rer)r�rUr"r=r%)r�r�r'rA�msgr)�linenumr�s        r�_convert_pycparser_errorzParser._convert_pycparser_errorZsw�����!�f�����);�=�s�C����%�+�+�a�.�"�-�G�"�-�-�/�L��G�0�s�<�0�0���$�G�A�I�.���rc��|j||�}t|�}|r!d|j��d|��}t|��d|��}t|��)Nzcannot parse "z"
zparse error
)r�r�rdr)r�r�r'rAr�s     rr�zParser.convert_pycparser_errorhsU���,�,�Q��8���!�f���-1�Z�Z�\�3�?�C���n��	�(+�,�C���n�rNc���|r |dk7rtd��|rtd��d}n|r||dz
zrtd|����d}|j}	|||d�|_|j|�||_y#||_wxYw)NTzB'packed' should be False or True; use 'pack' to give another valuez$cannot give both 'pack' and 'packed'rz#'pack' must be a power of two, not r	)�override�packed�	dllexport)�
ValueErrorr��_internal_parse)r�r'r�r��packr��prev_optionss       rr�zParser.parsers������~� �"@�A�A�� �!G�H�H��D�
��t�a�x� � ��"����D��}�}��	)�)1�'+�*3�5�D�M�
� � ��)�(�D�M��L�D�M�s�
A.�.	A7c	��|j|�\}}}|j|�t|j�}|D]}|jdk(s�nJ�d}	d|_|D�]�}|}t
|tjj�r|j|��<t
|tjj��r�|jstd|��d}t
|jjtjj�rE|jjjdj!d�r|j#|�}�n0t
|jtjj$�r�t
|jjtjj&�r�t
|jjjtjj�rN|jjjjdj!d�r|j)|�}n:|j+|j|jdd|j�d	��
�\}}|j-d|jz||����K|j.j0d
k(rddl}	|	j5d���{td|j.j0z|��y#t$r3}
t7|
j8�dk(r|
j8|fz|
_�d}
~
wt:$r5}
|j=|
|�}|r|
j8dd|zzf|
_�d}
~
wwxYw)N�
__dotdotdot__r	�__cffi_extern_python_stopz!typedef does not declare any name����__dotdotdotTz*(z *)0)rE�partial_length_ok�typedef_exampler���quals�Pragmaa#pragma in cdef() are entirely ignored. They should be removed for now, otherwise your code might behave differently in a future version of CFFI if #pragma support gets added. Note that '#pragma pack' needs to be replaced with the 'packed' keyword argument to cdef().zBunexpected <%s>: this construct is valid C but not valid in cdef()rz
    *** Err: %s)r��_process_macros�iter�extrE�_inside_extern_python�
isinstancer�c_ast�Decl�_parse_decl�Typedefr�type�IdentifierType�namesr$�_get_unknown_type�PtrDecl�TypeDecl�_get_unknown_ptr_type�_get_type_and_quals�_declare�	__class__�__name__r?r@r%�argsrr�)r�r'r�rp�iteratorrF�current_declr��realtyper?r�r�s            rr�zParser._internal_parse�s���#�{�{�7�3���V�W����V�$�����=���	�D��y�y�O�+��	�
�1���/	�)D�D�&� �$
C��#���d�I�O�O�$8�$8�9��$�$�T�*���i�o�o�&=�&=�>��9�9�'�(K�(,�.�.��E�"�4�9�9�>�>�9�?�?�3Q�3Q�R� �I�I�N�N�0�0��4�?�?�
�N�#'�#9�#9�$�#?��$�T�Y�Y�	���0G�0G�H�$�T�Y�Y�^�^�Y�_�_�5M�5M�N�$�T�Y�Y�^�^�%8�%8�%.�_�_�%C�%C�E��)�)�.�.�-�-�3�3�B�7�B�B�=�Q�#'�#=�#=�d�#C��*.�*B�*B� �I�I�D�I�I��:>�)�)�,E�+C�+G���%��M�M�*�t�y�y�"8�(�%�M�P��^�^�,�,��8�#��M�M�?�@�$�%@�$(�N�N�$;�$;�%<�=A�C�C�E$
C��J�	��1�6�6�{�a�����<�/�1������	��/�/��7�;�C���&�&��)�&9�C�&?�?�A�����		�s%�J(L�	M:�.L9�9M:�0M5�5M:c��||jvr!|j||k(rytd|����||j|<y)Nz#multiple declarations of constant: )r�r)r��key�vals   r�_add_constantszParser._add_constants�sK���$�%�%�%��"�"�3�'�3�.���;>�@�B�
B�#&����C� rc�@�|j�jd�}|jd�}|r|dd}|jd�r|dk7r|jd�sd|ddz}t|d�}|r|}|j	||�|jd|z|�y)	N�ul�-r�0�0x�0or	�macro )�lower�rstripr$rUr�r�)r�rE�int_str�neg�pyvalues     r�_add_integer_constantzParser._add_integer_constant�s����-�-�/�(�(��.��� � ��%����a�b�k�G����s�#��3���*�*�4�0��W�Q�R�[�(�G��g�q�/����h�G����D�'�*��
�
�h��o�w�/rc��|j�D]n\}}|j�}tj|�r|j	||��>|dk(r|jd|z|��Yt
d|�d|�d|�d|����y)Nr_r�z5only supports one of the following syntax:
  #define z+ ...     (literally dot-dot-dot)
  #define zM NUMBER  (with NUMBER an integer constant, decimal/hex/octal)
got:
  #define rZ)�itemsrd�_r_int_literalr)r�r�r)r�rpr��values    rr�zParser._process_macros�sz�� �,�,�.�	.�J�C���K�K�M�E��#�#�E�*��*�*�3��6��%���
�
�h��n�e�4���C��e�
-�.�.�	.rc���|j||�}|jjd�rd}n&|jdk(rd}n|jdk(rd}nd}|j	||j
z|�y)Nr�zdllexport_python �__cffi_extern_python_startzextern_python �!__cffi_extern_python_plus_c_startzextern_python_plus_c z	function )�_get_type_pointerr��getr�r�rE)r��tpr�rF�tags     r�_declare_functionzParser._declare_function�sn��
�
#�
#�B��
.���=�=���[�)�%�C�
�
'�
'�+G�
G�"�C�
�
'�
'�+N�
N�)�C��C��
�
�c�D�I�I�o�r�*rc�z�|j}t|tjj�rP|j||j��\}}t|tj�sJ�|j|||�yt|tjj�r|jd|�n�t|tjj�r|jd|�nOt|tjj�r|jd|�n|jstd|��|j�rq|j|d��\}}|jr|j|||�y|j!�r|t#|d�rpt#|j$d	�rZt&j)|j$j*�r1|j-|j|j$j*�y|j!�r�t|j$tjj.�r�|j$j0d
k(r�t#|j$j2d	�rqt&j)|j$j2j*�r>|j-|jd
|j$j2j*z�y|tj4ur-|jj7d�r|j|_y|j8dk7rtd
��|tj:zr.|j<s"|j?d|jz||��ytA|�|j?d|jz||��yy)N)rE�struct�union�enumz'construct does not declare any variableT�r��initr�r��__cffi_extern_python_r�z<cannot declare constants or variables with 'extern "Python"'z	constant r�z	variable )!r�r�rr��FuncDeclr�rEr�RawFunctionTyper��Struct�_get_struct_union_enum_type�Union�Enumr�is_raw_function�is_integer_type�hasattrr�r�r)r�r��UnaryOp�op�expr�	void_typer$r��Q_CONST�
is_array_typer�rG)r�rF�noder�r�s     rr�zParser._parse_decl�s����y�y���d�I�O�O�4�4�5��0�0��D�I�I�0�F�I�B���b�%�"7�"7�8�8�8��"�"�2�u�d�3��$�	��� 6� 6�7��0�0��4�@��D�)�/�/�"7�"7�8��0�0��$�?��D�)�/�/�"6�"6�7��0�0���>��Y�Y�� I� $�&�&��y�y� �4�4�T�GK�5�M�	��E��%�%��*�*�2�u�d�;��(�(�*���f�-���	�	�7�3�&�,�,�T�Y�Y�_�_�=��.�.�t�y�y�$�)�)�/�/�J��(�(�*�"�4�9�9�i�o�o�.E�.E�F��	�	����+���	�	����8�&�,�,�T�Y�Y�^�^�-A�-A�B��.�.�t�y�y�/2�T�Y�Y�^�^�5I�5I�/I�K��E�O�O�+��i�i�*�*�+B�C�26���D�.��1�1�4O�O�'�A�B�B���
�
�-�r�7G�7G��
�
�k�D�I�I�&=�r��
�O�G��M��
�
�k�D�I�I�&=�r��
�O�Arc�*�|j|�dSr)�parse_type_and_quals)r��cdecls  r�
parse_typezParser.parse_type0s���(�(��/��2�2rc�N�|jd|z�dd\}}|rJ�|jdjjjd}t|tjj�rtd|j�d���|j|j�S)Nzvoid __dummy(
%s
);�r�r	zunknown identifier '�')r�r�r�r��paramsr�rr��IDrrEr�)r�rr�rp�exprnodes     rrzParser.parse_type_and_quals3s����k�k�"9�E�"A�B�2�A�F���V���z��7�7�2�;�#�#�(�(�/�/��2���h�	��� 2� 2�3�����H�I�I��'�'��
�
�6�6rc�2�||jvrF|j|\}}||ur||k(ry|jjd�std|�d���d|j	�vsJ�||f|j|<|r|j
j
|�yy)Nr�zmultiple declarations of z5 (for interactive usage, try cdef(xx, override=True))r�)r�r�r�r�splitr�r|)r�rE�obj�includedr��prevobj�	prevqualss       rr�zParser._declare;s����4�%�%�%�!%�!3�!3�D�!9��G�Y��#�~�)�u�"4���=�=�$�$�Z�0��6:�=�>�>��d�j�j�l�2�2�2�$'��<����4� ���'�'�+�+�C�0�rc�L�d}t|tjjtjjf�rcd|j
vr|tjz}d|j
vr|tjz}d|j
vr|tjz}|S)Nr	�const�volatile�restrict)
r�rr�r�r�r�rr
�
Q_VOLATILE�
Q_RESTRICT�r�r�r�s   r�_extract_qualszParser._extract_qualsIs������d�Y�_�_�5�5�&�_�_�4�4�6�7��$�*�*�$�����&���T�Z�Z�'���)�)�)���T�Z�Z�'���)�)�)���rc�p�t|tj�r|j�St|tj�r]|j
j
d�rB|j
ddj�r%|j�|�tj|||�Stj||�S)N�$r)r�rr�as_function_pointer�StructOrUnionOrEnumrEr$�isdigit�	forcename�NamedPointerType�PointerType)r�r�r��declnames    rr�zParser._get_type_pointerUs����d�E�1�1�2��+�+�-�-��t�U�6�6�7��	�	�$�$�S�)�d�i�i���m�.C�.C�.E����&�8�+?��)�)�$��%�@�@�� � ��u�-�-rc�	�t|tjj�r�t|jtjj
�r�t
|jj�dk(rld|jjdz|jvrD|jd|jjdz\}}||j|�z}||fSt|tjj�rw|j�d}n|j|j|��}|�|dk(rd|�d�}d|z}|j|j||�	�\}}tj||�|fSt|tjj �rG|j|j�\}}	|j#||	|�
�}|j|�}||fSt|tjj��r�|j|�}|j}
t|
tjj
��rt%|
j�}|ddgk7r�i}|r)|d}|d
vr|j'|d�dz||<|d=nn|r�)g}
dD]3}t)|j'|d��D]}|
j+|���5|sdg}|dgk(r
d|vsd|vrg}|
|z}dj-|�}|dk(rtj.|fS|dk(r"t1d|j2j4z��t7||�\}}|||zfSt|
tjj8�r|j;d|
|�}||fSt|
tjj<�r|j;d|
|�}||fSt|
tjj>�r|j;d|
|�}||fSt|tjj@�r|jC||�dfSt|tjj8�r|j;d||d��dfSt|tjj<�r|j;d||d��dfSt1d|j2j4z��)Nrr�r	r�r_z_cffi_array_len(rr)r�r�)r0�signed�char)�short�longr2�unsigned)r6r4r5rUr4r5rZ�voidr�z:%d: bad usage of "..."r�r�r�T)�nestedz(:%d: bad or unsupported type declaration)"r�rr�r�r�r�r%r�r�r'�	ArrayDecl�dim�_parse_constantr�r�	ArrayTyper�r�rjr��ranger r&rr�coordrArrrrrr�_parse_function_type)r��typenoderEr�r�r�r��length�itemtype�	itemqualsr�r��prefixes�newnames�prefixr-�ident�tp0�quals0s                   rr�zParser._get_type_and_quals^s���
�x����!9�!9�:��x�}�}�i�o�o�&D�&D�E���
�
�#�#�$��)�
�(�-�-�-�-�a�0�
0�T�5G�5G�G��*�*�:��
�
�8K�8K�A�8N�+N�O�I�B���T�(�(��2�2�E��u�9���h�	��� 9� 9�:��|�|�#����-�-��L�L�4E�.�G���*��U�?�6E�G�F�"%��"7���0�0����2C�0?�1�A�I�B���?�?�2�v�.��5�5��h�	��� 7� 7�8�"&�":�":�8�=�=�"I��H�i��'�'��)�d�'�K�B��'�'��1�E��u�9���h�	��� 8� 8�9��'�'��1�E��=�=�D��$�	��� >� >�?��T�Z�Z�(���X�v�.�.�!�H��$�Q�x���#J�J�-5�\�\�$��-B�Q�-F�H�T�N� %�a��!�
 � "�H�"?�4��!&�x�|�|�F�A�'>�!?�4�A�$�O�O�F�3�4�4�!�!&������'�"�h�.�&�H�2D�$&�E�$�u�,�E��������F�?� �?�?�E�1�1��O�+�"�#<�$�N�N�/�/�$0�1�1�1�$��>���V��U�V�^�,�,��$�	��� 6� 6�7��5�5�h��d�K���5�y� ��$�	��� 5� 5�6��5�5�g�t�T�J���5�y� ��$�	��� 4� 4�5��5�5�f�d�D�I���5�y� ��h�	��� 8� 8�9��,�,�X�t�<�a�?�?��h�	��� 6� 6�7��3�3�H�h��;?�4�A�BC�D�
D��h�	��� 5� 5�6��3�3�G�X�t�;?�4�A�BC�D�
D��A����#�#�$�%�	%rc���tt|jdg��}t|�D]4\}}t	|d�r�td|xsd|dzt|dd�fz��t
|�dkDxr�t|d	jtjj�xrdt|d	jjtjj�xr'|d	jjjd
gk(}|r$|j�|std|xsdz��|D�cgc]*}|j|j!|j����,}}|s|t"j$gk(rg}|j!|j�\}	}
d}t	|jd�r |jj&d
dgd�k(rd}t#j(t+|�|	||�Scc}w)Nrr�zt%s arg %d: unknown type '%s' (if you meant to use the old C syntax of giving untyped arguments, it is not supported)z
in expressionrrE�?r	r�r�z=%s: a function with only '(...)' as argument is not correct Cr����)r"r"r!�	__stdcall)rj�getattrr�rlrrr%r�r�rr�r�r�r��pop�_as_func_argr�rrr�r�tuple)r�r@�funcnamerr-�arg�ellipsis�argdeclnoder��resultr��abis            rr?zParser._parse_function_type�s����g�h�m�m�X�r�:�;����'�	3�F�A�s��3��'��!?� �2�?�A��E��s�F�C�0�2�!2�3�3�	3�
��K�!�O�
<��v�b�z���	���(@�(@�A�
<��v�b�z���+�+� ���5�5�
7�
<�
�2�J�O�O� � �&�&�?�*;�;�	���J�J�L���(�+3�+F��H�I�I�$*�+��"��!�!�4�#;�#;�K�<L�<L�#M�N�+��+��D�U�_�_�$5�5��D��0�0����?�
������8�=�=�'�*��}�}�"�"�2�3�'�+L�L�!���$�$�U�4�[�&�(�C�H�H��+s�4/G4c���t|tj�r tj|j|�St|tj
�r|j
�S|Sr)r�rr<r/�itemrr*r&s   rrPzParser._as_func_arg�sK���d�E�O�O�,��$�$�T�Y�Y��6�6�
��e�3�3�
4��+�+�-�-��Krc�@�	|j|S#t$rYnwxYw|}|j}|�/|�d|z}n$|xjdz
c_d|jz}d}n(|}|�d|��}|jj|d�\}}	|��|dk(rt
j|ddd�}n^|dk(rt
j|ddd�}n@|dk(r-|d	k(rtd
��|j||j�}ntd|����|�2|j|�n|dk(r|j�td|z��|js|j!|�|jr-d
|jvr|jd|jz|�||j|<|dk(r|S|j"�|S|j$�td|z��g}
g}g}g}
|j"D�]e}t'|j(t*j,j.�r;dj1|j(j2�d	k(r|j5||��m|j6�d}n|j9|j6�}d|_|j=|j(d��\}}|j:r|j5||�t'|tj�r|j>r|j5||�|
jA|jxsd�|jA|�|jA|�|
jA|���htC|
�|_tC|�|_"tC|�|_#tC|
�|_$|dgtK|�zk7r4t'|tj�r|j>rt|�d���|jLjd�|_'|jPr"d|_(|jRjA|�|S)Nz$%srz$%drZ)NNr�r�r�r�z!Enums cannot be declared with ...zkind = z^enum %s: the '{}' declaration should appear on the first time the enum is mentioned, not laterr)zanonymous %sz"duplicate declaration of struct %srr�FTr�z!: using both bitfields and '...;'r�r	)*r��KeyErrorrEr�r�r�r�
StructType�	UnionTyper�_build_enum_type�valuesrTr�r7r-�force_the_name�decls�fldnamesr�r�rr�r�r&r��
_make_partial�bitsizer;�_partial_lengthr��partialr rQ�fldtypes�
fldbitsize�fldqualsr%r�r��	completedr�)r��kindr�rEr8�
force_name�
explicit_namer�r��_rbrgrhrirFrd�fquals                 rrz"Parser._get_struct_union_enum_type�s���	��(�(��.�.���	��	���
��y�y���<��%� %�
� 2�
��'�'�1�,�'� %��(?�(?� ?�
��B� �M�!�4�(�C��&�&�*�*�3��=�E�B��
�:��x���%�%�m�T�4��F������_�_�]�D�$��E����� �O�3�#�$G�H�H��*�*�=�$�+�+�F��$�D�%:�;�;����
�
�c�2�&��v�~�$�+�+�"9�)�<�>K�L�M�M��|�|����j�)�
�<�<�C�2�7�7�N��M�M�.�2�<�<�7��<�&(����d�#��6�>��I�
�:�:���I�
�;�;�"��@�4�G�H�H������
����J�J�	#�D��4�9�9�i�o�o�&D�&D�E��G�G�D�I�I�O�O�,��?��"�"�2�v�.���|�|�#����.�.�t�|�|�<��#(�D� ��2�2�4�9�9�EI�3�K�K�D�%��#�#��"�"�2�v�.��$�� 0� 0�1�d�l�l��"�"�2�v�.��O�O�D�I�I�O��,��O�O�D�!����g�&��O�O�E�"�-	#�.�H�o����H�o����j�)��
��H�o����"���J��/�/��"�e�.�.�/�B�J�J�)�-/�+2�3�3��M�M�%�%�h�/��	�
�<�<��B�L����#�#�B�'��	s��	�c��t|tj�st|�d���|j	�s|st|�d���d|_y)Nz cannot be partialz is partial but has no C nameT)r�r�
StructOrUnionr�
has_c_namer7rf)r�r�r8s   rrczParser._make_partialhs@���"�e�1�1�2��b�:�;�;��}�}��v�%�"�&N�O�O���
rc���t|tjj�r�|j}d|dcxkrdkr>nn;|jd�}	|j
d�rt|d�St|d�S|dd
k(r:|dd
k(r2t|�dk(st|�dk(r|ddk(rt|d�Std|����t|tjj�r*|jdk(r|j|j �St|tjj�r+|jdk(r|j|j �St|tjj"�r1|j$|j&vr|j&|j$St|tjj"�r;|j$dk(r,|rd|_yt+d|j,j.z��t|tjj0��r|j|j2�}|j|j4�}|jdk(r||zS|jdk(r||z
S|jdk(r||zS|jdk(r|j7||�S|jdk(r||j7||�|zz
S|jdk(r||zS|jdk(r||z	S|jdk(r||zS|jdk(r||zS|jd k(r||zSt+d!|j,j.z��#t$rYt|�dkDrH|j�ddd	k(rt|d
�cYS|j�dddk(rt|d�cYSYnwxYwtd|����)"Nr�r	�9�uUlLr�r�rrr���0bzinvalid constant rr�r
��\����+r��__dotdotdotarray__Tr_zT:%d: unsupported '[...]' here, cannot derive the actual array length in this contextr�/�%z<<z>>�&�|�^z?:%d: unsupported expression: expected a simple numeric constant)r�rr��Constantr�r�r$rUr�r%r�r�ordr	r
r;rrrEr�rerr>rA�BinaryOp�left�right�_c_div)r�rr�rVr�r�s      rr;zParser._parse_constantos~���h�	��� 8� 8�9����A��a��d�!�c�!��H�H�V�$��
-��|�|�C�(�"�1�a�y�(�"�1�b�z�)��1�����2��#����F�a�K�C��F�a�K�A�a�D�D�L��1�R�5�z�!��� <�=�=��x����!8�!8�9����s�"��'�'��
�
�6�6��x����!8�!8�9����s�"��(�(����7�7�7��x����!3�!3�4��
�
��!4�!4�4��&�&�x�}�}�5�5��x����!3�!3�4��M�M�%9�9� �'+��$���E�%�^�^�0�0�1�2�
2��h�	��� 8� 8�9��'�'��
�
�6�D��(�(����8�E��{�{�c�!��e�|�#�����#��e�|�#�����#��e�|�#�����#��{�{�4��/�/�����#��d�k�k�$��6��>�>�>�����$��u�}�$�����$��u�}�$�����#��e�|�#�����#��e�|�#�����#��e�|�#��1�3;�>�>�3F�3F�G�H�	H��u"�-��1�v��z��7�7�9�Q�q�>�T�1�#&�q�"�:�-��W�W�Y�q��^�t�3�#&�q�!�9�,��-�� �� <�=�=s�N�1N�9O%�>"O%�$O%c�@�||z}|dk|dkzr
||zdk7r|dz
}|S)Nr	rr)r��a�brVs    rr�z
Parser._c_div�s3���a���
��U�q�1�u��A��E�a�<��a�K�F��
rc��|��d}g}g}d}|jD]�}tj|j�rd}�%|j�|j|j�}|j
|j�|j
|�|j|j|�|dz
}��t|�}t|�}tj|||�}||_|Stj|dd�}|S)NFr	Trr)�enumerators�_r_enum_dotdotdotr)rEr�r;r r�rQr�EnumTyperf)	r�rmrarfr��
enumvalues�
nextenumvaluer�r�s	         rr^zParser._build_enum_type�s������G��K��J��M��)�)�	
#��$�*�*�4�9�9�5�"�G���:�:�)�$(�$8�$8����$D�M��"�"�4�9�9�-��!�!�-�0��#�#�D�I�I�}�=���"�
�	
#� ��,�K��z�*�J����
�{�J�G�B� �B�J��	����
�r�2�6�B��	rc�8�|jj�D]I\}\}}|jd�r�|jdd�d}|dvs�5|j	||d|���K|j
j�D]\}}|j
||��y)Nzanonymous $enum_$rZrr	)r�r�r��	anonymousrzT)rr�)r�r�r$rr�r�r�)r��otherrEr�r�rk�k�vs        r�includezParser.include�s���!&�!4�!4�!:�!:�!<�	D��D�+�2�u����2�3���:�:�c�1�%�a�(�D��J�J��
�
�d�B��U�
�C�	D��(�(�.�.�0�	&�D�A�q�����1�%�	&rc���|jjj}|dgk(rtj|j�S|dgk(r?|j
�d|jz|_tj|j�S|dgk(r?|j
�d|jz|_tj|j�Std|jjz��)Nr��__dotdotdotint__z'typedef int... %s'�__dotdotdotfloat__z'typedef float... %s'�*:%d: unsupported usage of "..." in typedef)r�r�r�unknown_typerEr��UnknownIntegerType�UnknownFloatTyperr>rA)r�rFr�s   rr�zParser._get_unknown_type�s����I�I�N�N�(�(�	���)�)��%�%�d�i�i�0�0��+�,�,��%�%�-�)>����)J��&��+�+�D�I�I�6�6��-�.�.��%�%�-�)@�4�9�9�)L��&��)�)�$�)�)�4�4��C������)�*�	*rc���|jjjjdgk(rtj|j�Std|jjz��)Nr�r�)r�r�r�unknown_ptr_typerErr>rA)r�rFs  rr�zParser._get_unknown_ptr_type�sV���9�9�>�>���$�$��(9�9��)�)�$�)�)�4�4��C������)�*�	*r)FFNF)Fr	r)NFN)NF)F)r��
__module__�__qualname__r�r�r�r�r�r�r�r�r�r�r�rrr�r'r�r�r?rPrrcr;r�r^r�r�r�rrrr�r�'s���&�%$�N��AE�#�)�0=�~'�
0�.�"
+�1P�f3�7�1�
�.�JO�,0�g%�R!I�F�t�l�GH�R��0&�*�&*rr�)4rr�commontypesrr�errorrrrr�ImportErrorr�r��sys�version_info�thread�_thread�
allocate_lockr�rr��compile�DOTALL�	MULTILINEr`rarNrkr�rir}r�
IGNORECASEr�rgrfrhr5rrnrorr/r9rBrGrPrWrwr��objectr�rrr�<module>r�s���:�&��)����
���$�� �� �7� � �"�D��,��
�R�Z�Z�7��	�	�B�L�L�0�2�
�
�R�Z�Z�2��	�	�B�L�L�0�2�	��B�J�J�A�2�<�<�P���"�*�*�=�>���B�J�J�3�4���2�:�:�1�2���2�:�:�i� ���
�����4�b�m�m�D���b�j�j�2�3���b�j�j�6�7���2�:�:�n�%���2�:�:�O�P�� �b�j�j�.�0���2�:�:�(�)���R�Z�Z� <�=���(�T0�d
�;�$�3�@�D%�PP*�V�P*��C	��������D��s"�G�)G&�	G#�"G#�&G1�0G1