3
�
�^� � @ s� d dl Z d dlT ee�Zdd� ZG dd� dee��Ze jdkr\dZ eZ
G d d
� d
eed�Zn0e jdkr�d
Z eZG dd� deed�Z
ned��dS )� N)�*c C sL t | t�rt| t�S t| t�r.t| j�| j S t| t �r<| S t
d| ��d S )Nz+This type does not support other endian: %s)�hasattr�
_OTHER_ENDIAN�getattr�
isinstance�_array_type�
_other_endianZ_type_Z_length_�
issubclass� Structure� TypeError)�typ� r
�&/usr/lib64/python3.6/ctypes/_endian.pyr s
r c s e Zd Z� fdd�Z� ZS )�
_swapped_metac sb |dkrPg }x>|D ]6}|d }|d }|dd � }|j |t|�f| � qW |}t� j||� d S )NZ_fields_r � � )�appendr �super�__setattr__)�selfZattrname�valueZfieldsZdesc�namer �rest)� __class__r
r r s
z_swapped_meta.__setattr__)�__name__�
__module__�__qualname__r �
__classcell__r
r
)r r r s r �littleZ__ctype_be__c @ s e Zd Zf ZdZdS )�BigEndianStructureN)r r r � __slots__�_swappedbytes_r
r
r
r r . s r )� metaclassZbigZ__ctype_le__c @ s e Zd Zf ZdZdS )�LittleEndianStructureN)r r r r r! r
r
r
r r# 7 s r# zInvalid byteorder)
�sysZctypes�typeZArrayr r r
r � byteorderr r# r �RuntimeErrorr
r
r
r �<module> s