Endian specific read/write interfaces
[Global/general functions]

Defines

Functions


Detailed Description

The endian specific read/write functions read and write data of the specified endianness, dynamically translating to the host machine endianness.

e.g.: If you want to read a 16 bit value on big-endian machine from an opened file containing little endian values, you would use:

  value = MGUI_ReadLE16(rp);
See also:
General read/write operations

Example:

    int fd, len_header;

...

    if (read (fd, &len_header, sizeof (int)) == -1)
        goto error;
#if MGUI_BYTEORDER == MGUI_BIG_ENDIAN
    /* If the native system is big endian, calling ArchSwap32 to
     * swap the bytes.
     */
    len_header = ArchSwap32 (len_header);
#endif

...

Define Documentation

#define ArchSwapBE16 (  )     ArchSwap16(X)

Swaps a 16-bit big endian integer to the native endianness.

Definition at line 435 of file endianrw.h.

#define ArchSwapBE32 (  )     ArchSwap32(X)

Swaps a 32-bit big endian integer to the native endianness.

Definition at line 437 of file endianrw.h.

#define ArchSwapBE64 (  )     ArchSwap64(X)

Swaps a 64-bit big endian integer to the native endianness.

Definition at line 439 of file endianrw.h.

#define ArchSwapLE16 (  )     (X)

Swaps a 16-bit little endian integer to the native endianness.

Definition at line 429 of file endianrw.h.

#define ArchSwapLE32 (  )     (X)

Swaps a 32-bit little endian integer to the native endianness.

Definition at line 431 of file endianrw.h.

#define ArchSwapLE64 (  )     (X)

Swaps a 64-bit little endian integer to the native endianness.

Definition at line 433 of file endianrw.h.


Function Documentation

Uint16 MGUI_ReadBE16 ( MG_RWops src  ) 

Reads a 16-bit big endian integer from a MG_RWops object.

This function reads a 16-bit big endian integer from the data source pointed to by src, and return it in native format.

Parameters:
src The pointer to the MG_RWops object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteBE16
Uint32 MGUI_ReadBE32 ( MG_RWops src  ) 

Reads a 32-bit big endian integer from a MG_RWops object.

This function reads a 32-bit big endian integer from the data source pointed to by src, and return it in native format.

Parameters:
src The pointer to the MG_RWops object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteBE32
Uint64 MGUI_ReadBE64 ( MG_RWops src  ) 

Reads a 64-bit big endian integer from a MG_RWops object.

This function reads a 64-bit big endian integer from the data source pointed to by src, and return it in native format.

Parameters:
src The pointer to the MG_RWops object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteBE64
Uint16 MGUI_ReadLE16 ( MG_RWops src  ) 

Reads a 16-bit little endian integer from a MG_RWops object.

This function reads a 16-bit little endian integer from the data source pointed to by src, and return it in native format.

Parameters:
src The pointer to the MG_RWops object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteLE16
Uint16 MGUI_ReadLE16FP ( FILE *  src  ) 

Reads a 16-bit little endian integer from a stdio FILE object.

This function reads a 16-bit little endian integer from the stdio FILE object pointed to by src, and return it in native format.

Parameters:
src The pointer to the stdio FILE object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteLE16FP, MGUI_ReadLE16
Uint32 MGUI_ReadLE32 ( MG_RWops src  ) 

Reads a 32-bit little endian integer from a MG_RWops object.

This function reads a 32-bit little endian integer from the data source pointed to by src, and return it in native format.

Parameters:
src The pointer to the MG_RWops object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteLE32
Uint32 MGUI_ReadLE32FP ( FILE *  src  ) 

Reads a 32-bit little endian integer from a stdio FILE object.

This function reads a 32-bit little endian integer from the stdio FILE object pointed to by src, and return it in native format.

Parameters:
src The pointer to the stdio FILE object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteLE32FP, MGUI_ReadLE32
Uint64 MGUI_ReadLE64 ( MG_RWops src  ) 

Reads a 64-bit little endian integer from a MG_RWops object.

This function reads a 64-bit little endian integer from the data source pointed to by src, and return it in native format.

Parameters:
src The pointer to the MG_RWops object.
Returns:
The integer in native endianness.
See also:
MGUI_WriteLE64
int MGUI_WriteBE16 ( MG_RWops src,
Uint16  value 
)

Writes an 16-bit integer of native format to a MG_RWops object in big endianness.

This function writes a 16-bit integer of native format to the data source pointed to by src in big endiannes.

Parameters:
src The pointer to the MG_RWops object.
value The 16-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE16
int MGUI_WriteBE32 ( MG_RWops src,
Uint32  value 
)

Writes an 32-bit integer of native format to a MG_RWops object in big endianness.

This function writes a 32-bit integer of native format to the data source pointed to by src in big endiannes.

Parameters:
src The pointer to the MG_RWops object.
value The 32-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE32
int MGUI_WriteBE64 ( MG_RWops src,
Uint64  value 
)

Writes an 64-bit integer of native format to a MG_RWops object in big endianness.

This function writes a 64-bit integer of native format to the data source pointed to by src in big endiannes.

Parameters:
src The pointer to the MG_RWops object.
value The 64-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE64
int MGUI_WriteLE16 ( MG_RWops src,
Uint16  value 
)

Writes an 16-bit integer of native format to a MG_RWops object in littlen endianness.

This function writes a 16-bit integer of native format to the data source pointed to by src in littlen endiannes.

Parameters:
src The pointer to the MG_RWops object.
value The 16-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE16
int MGUI_WriteLE16FP ( FILE *  dst,
Uint16  value 
)

Writes an 16-bit integer of native format to a stdio FILE object in littlen endianness.

This function writes a 16-bit integer of native format to the stdio FILE object pointed to by src in littlen endiannes.

Parameters:
dst The pointer to the MG_RWops object.
value The 16-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE16FP, MGUI_WriteLE16
int MGUI_WriteLE32 ( MG_RWops src,
Uint32  value 
)

Writes an 32-bit integer of native format to a MG_RWops object in littlen endianness.

This function writes a 32-bit integer of native format to the data source pointed to by src in littlen endiannes.

Parameters:
src The pointer to the MG_RWops object.
value The 32-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE32
int MGUI_WriteLE32FP ( FILE *  dst,
Uint32  value 
)

Writes an 32-bit integer of native format to a stdio FILE object in littlen endianness.

This function writes a 32-bit integer of native format to the stdio FILE object pointed to by src in littlen endiannes.

Parameters:
dst The pointer to the MG_RWops object.
value The 32-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE32FP, MGUI_WriteLE32
int MGUI_WriteLE64 ( MG_RWops src,
Uint64  value 
)

Writes an 64-bit integer of native format to a MG_RWops object in littlen endianness.

This function writes a 64-bit integer of native format to the data source pointed to by src in littlen endiannes.

Parameters:
src The pointer to the MG_RWops object.
value The 64-bit integer in native endianness.
Returns:
Returns 1 on success, else indicates an error.
See also:
MGUI_ReadLE64
Generated on Thu Apr 7 16:01:47 2011 for MiniGUI V3.0.12 API Reference by  doxygen 1.6.3