Back to index

python3.2  3.2.2
Classes | Functions | Variables
ctypes._endian Namespace Reference

Classes

class  _swapped_meta
class  BigEndianStructure
class  LittleEndianStructure

Functions

def _other_endian

Variables

tuple _array_type = type(c_int * 3)
string _OTHER_ENDIAN = "__ctype_be__"
 LittleEndianStructure = Structure
 BigEndianStructure = Structure

Function Documentation

def ctypes._endian._other_endian (   typ) [private]
Return 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.

Definition at line 6 of file _endian.py.

00006 
00007 def _other_endian(typ):
00008     """Return the type with the 'other' byte order.  Simple types like
00009     c_int and so on already have __ctype_be__ and __ctype_le__
00010     attributes which contain the types, for more complicated types
00011     arrays and structures are supported.
00012     """
00013     # check _OTHER_ENDIAN attribute (present if typ is primitive type)
00014     if hasattr(typ, _OTHER_ENDIAN):
00015         return getattr(typ, _OTHER_ENDIAN)
00016     # if typ is array
00017     if isinstance(typ, _array_type):
00018         return _other_endian(typ._type_) * typ._length_
00019     # if typ is structure
00020     if issubclass(typ, Structure):
00021         return typ
00022     raise TypeError("This type does not support other endian: %s" % typ)

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 4 of file _endian.py.

Definition at line 42 of file _endian.py.

Definition at line 53 of file _endian.py.

Definition at line 44 of file _endian.py.