B
    w2[                 @   s   d dl Z d dlT eeZdd ZG dd deeZe jdkr\dZ	eZ
G d	d
 d
eedZn0e jdkrdZ	eZG dd deedZ
neddS )    N)*c             C   sL   t | trt| tS t| tr.t| j| j S t| t	r<| S t
d|  dS )zReturn the type with the 'other' byte order.  Simple types like
    c_int and so on already have __ctype_be__ and __ctype_le__
    attributes which contain the types, for more complicated types
    arrays and structures are supported.
    z+This type does not support other endian: %sN)hasattr_OTHER_ENDIANgetattr
isinstance_array_type_other_endian_type_Z_length_
issubclass	Structure	TypeError)typ r   (/root/Python-3.7.0/Lib/ctypes/_endian.pyr      s    



r   c                   s   e Zd Z fddZ  ZS )_swapped_metac                sb   |dkrPg }x>|D ]6}|d }|d }|dd  }| |t|f|  qW |}t || d S )NZ_fields_r         )appendr   super__setattr__)selfattrnamevaluefieldsdescnamer   rest)	__class__r   r   r      s    
z_swapped_meta.__setattr__)__name__
__module____qualname__r   __classcell__r   r   )r   r   r      s   r   little__ctype_be__c               @   s   e Zd ZdZdZdZdS )BigEndianStructurez$Structure with big endian byte orderr   N)r   r   r    __doc__	__slots___swappedbytes_r   r   r   r   r$   .   s   r$   )	metaclassbig__ctype_le__c               @   s   e Zd ZdZdZdZdS )LittleEndianStructurez'Structure with little endian byte orderr   N)r   r   r    r%   r&   r'   r   r   r   r   r+   7   s   r+   zInvalid byteorder)sysctypestypeArrayr   r   r   r   	byteorderr   r+   r$   RuntimeErrorr   r   r   r   <module>   s   

