MiniGUI API Reference (MiniGUI-Processes)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Macros | Functions
Endian specific read/write interfaces

Macros

#define ArchSwapLE16(X)   (X)
 
#define ArchSwapLE32(X)   (X)
 
#define ArchSwapLE64(X)   (X)
 
#define ArchSwapBE16(X)   ArchSwap16(X)
 
#define ArchSwapBE32(X)   ArchSwap32(X)
 
#define ArchSwapBE64(X)   ArchSwap64(X)
 

Functions

Uint16 MGUI_ReadLE16 (MG_RWops *src)
 Reads a 16-bit little endian integer from a MG_RWops object. More...
 
Uint16 MGUI_ReadBE16 (MG_RWops *src)
 Reads a 16-bit big endian integer from a MG_RWops object. More...
 
Uint32 MGUI_ReadLE32 (MG_RWops *src)
 Reads a 32-bit little endian integer from a MG_RWops object. More...
 
Uint32 MGUI_ReadBE32 (MG_RWops *src)
 Reads a 32-bit big endian integer from a MG_RWops object. More...
 
Uint64 MGUI_ReadLE64 (MG_RWops *src)
 Reads a 64-bit little endian integer from a MG_RWops object. More...
 
Uint64 MGUI_ReadBE64 (MG_RWops *src)
 Reads a 64-bit big endian integer from a MG_RWops object. More...
 
int MGUI_WriteLE16 (MG_RWops *dst, Uint16 value)
 Writes an 16-bit integer of native format to a MG_RWops object in littlen endianness. More...
 
int MGUI_WriteBE16 (MG_RWops *dst, Uint16 value)
 Writes an 16-bit integer of native format to a MG_RWops object in big endianness. More...
 
int MGUI_WriteLE32 (MG_RWops *dst, Uint32 value)
 Writes an 32-bit integer of native format to a MG_RWops object in littlen endianness. More...
 
int MGUI_WriteBE32 (MG_RWops *dst, Uint32 value)
 Writes an 32-bit integer of native format to a MG_RWops object in big endianness. More...
 
int MGUI_WriteLE64 (MG_RWops *dst, Uint64 value)
 Writes an 64-bit integer of native format to a MG_RWops object in littlen endianness. More...
 
int MGUI_WriteBE64 (MG_RWops *dst, Uint64 value)
 Writes an 64-bit integer of native format to a MG_RWops object in big endianness. More...
 
Uint16 MGUI_ReadLE16FP (FILE *src)
 Reads a 16-bit little endian integer from a stdio FILE object. More...
 
Uint32 MGUI_ReadLE32FP (FILE *src)
 Reads a 32-bit little endian integer from a stdio FILE object. More...
 
int MGUI_WriteLE16FP (FILE *dst, Uint16 value)
 Writes an 16-bit integer of native format to a stdio FILE object in littlen endianness. More...
 
int MGUI_WriteLE32FP (FILE *dst, Uint32 value)
 Writes an 32-bit integer of native format to a stdio FILE object in littlen endianness. More...
 

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
...

Macro Definition Documentation

#define ArchSwapBE16 (   X)    ArchSwap16(X)

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

Definition at line 456 of file endianrw.h.

#define ArchSwapBE32 (   X)    ArchSwap32(X)

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

Definition at line 458 of file endianrw.h.

#define ArchSwapBE64 (   X)    ArchSwap64(X)

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

Definition at line 460 of file endianrw.h.

#define ArchSwapLE16 (   X)    (X)

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

Definition at line 450 of file endianrw.h.

#define ArchSwapLE32 (   X)    (X)

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

Definition at line 452 of file endianrw.h.

#define ArchSwapLE64 (   X)    (X)

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

Definition at line 454 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
srcThe 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
srcThe 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
srcThe 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
srcThe 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
srcThe 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
srcThe 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
srcThe 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
srcThe 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
srcThe pointer to the MG_RWops object.
valueThe 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
srcThe pointer to the MG_RWops object.
valueThe 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
srcThe pointer to the MG_RWops object.
valueThe 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
srcThe pointer to the MG_RWops object.
valueThe 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
dstThe pointer to the MG_RWops object.
valueThe 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
srcThe pointer to the MG_RWops object.
valueThe 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
dstThe pointer to the MG_RWops object.
valueThe 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
srcThe pointer to the MG_RWops object.
valueThe 64-bit integer in native endianness.
Returns
Returns 1 on success, else indicates an error.
See also
MGUI_ReadLE64