MiniGUI API Reference (MiniGUI-Threads)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Go to the documentation of this file.
69 #ifndef _MGUI_ENDIAN_RW_H
70 #define _MGUI_ENDIAN_RW_H
77 #define ArchSwap16 __arch__swab16
80 #define ArchSwap32 __arch__swab32
111 #define RWAREA_TYPE_UNKNOWN 0
112 #define RWAREA_TYPE_STDIO 1
113 #define RWAREA_TYPE_MEM 2
141 #ifdef _MGUSE_OWN_STDIO
143 int (*ungetc)(
struct _MG_RWops *context,
unsigned char c);
295 #define MGUI_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
310 #define MGUI_RWtell(ctx) (ctx)->seek(ctx, 0, SEEK_CUR)
327 #define MGUI_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
344 #define MGUI_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
359 #define MGUI_RWclose(ctx) (ctx)->close(ctx)
374 #define MGUI_RWeof(ctx) (ctx)->eof(ctx)
425 return((D<<8)|(D>>8));
430 return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
433 #ifdef MGUI_HAS_64BIT_TYPE
439 lo = (
Uint32)(val&0xFFFFFFFF);
441 hi = (
Uint32)(val&0xFFFFFFFF);
442 val = ArchSwap32(lo);
444 val |= ArchSwap32(hi);
454 #define ArchSwap64(X) (X)
459 #if MGUI_BYTEORDER == MGUI_LIL_ENDIAN
461 #define ArchSwapLE16(X) (X)
463 #define ArchSwapLE32(X) (X)
465 #define ArchSwapLE64(X) (X)
467 #define ArchSwapBE16(X) ArchSwap16(X)
469 #define ArchSwapBE32(X) ArchSwap32(X)
471 #define ArchSwapBE64(X) ArchSwap64(X)
473 #define ArchSwapLE16(X) ArchSwap16(X)
474 #define ArchSwapLE32(X) ArchSwap32(X)
475 #define ArchSwapLE64(X) ArchSwap64(X)
476 #define ArchSwapBE16(X) (X)
477 #define ArchSwapBE32(X) (X)
478 #define ArchSwapBE64(X) (X)
721 static inline Uint16 MGUI_ReadLE16Mem (
const Uint8** data)
726 h1 = *(*data); (*data)++;
727 h2 = *(*data); (*data)++;
731 memcpy (&u, *data,
sizeof (
Uint16));
738 static inline Uint32 MGUI_ReadLE32Mem (
const Uint8** data)
743 q1 = *(*data); (*data)++;
744 q2 = *(*data); (*data)++;
745 q3 = *(*data); (*data)++;
746 q4 = *(*data); (*data)++;
747 return ((q4<<24)|(q3<<16)|(q2<<8)|(q1));
750 memcpy (&u, *data,
sizeof (
Uint32));
757 static inline Uint16 MGUI_ReadBE16Mem (
const Uint8** data)
762 h1 = *(*data); (*data)++;
763 h2 = *(*data); (*data)++;
767 memcpy (&u, *data,
sizeof (
Uint16));
774 static inline Uint32 MGUI_ReadBE32Mem (
const Uint8** data)
779 q1 = *(*data); (*data)++;
780 q2 = *(*data); (*data)++;
781 q3 = *(*data); (*data)++;
782 q4 = *(*data); (*data)++;
783 return ((q1<<24)|(q2<<16)|(q3<<8)|(q4));
786 memcpy (&u, *data,
sizeof (
Uint32));
int MGUI_WriteBE64(MG_RWops *dst, Uint64 value)
Writes an 64-bit integer of native format to a MG_RWops object in big endianness.
MG_EXPORT void MGUI_InitMemRW(MG_RWops *area, void *mem, size_t size)
Initializes an MG_RWops object from a block of memory.
MG_EXPORT void MGUI_FreeRW(MG_RWops *area)
Frees an MG_RWops object.
Uint16 MGUI_ReadBE16(MG_RWops *src)
Reads a 16-bit big endian integer from a MG_RWops object.
MG_EXPORT MG_RWops * MGUI_RWFromMem(void *mem, size_t size)
Creates an MG_RWops object from a block of memory.
int MGUI_WriteBE16(MG_RWops *dst, Uint16 value)
Writes an 16-bit integer of native format to a MG_RWops object in big endianness.
Uint64 MGUI_ReadLE64(MG_RWops *src)
Reads a 64-bit little endian integer from a MG_RWops object.
MG_EXPORT MG_RWops * MGUI_RWFromFile(const char *file, const char *mode)
Creates an MG_RWops object from a file.
Uint16 MGUI_ReadLE16FP(FILE *src)
Reads a 16-bit little endian integer from a stdio FILE object.
Uint16 MGUI_ReadLE16(MG_RWops *src)
Reads a 16-bit little endian integer from a MG_RWops object.
int MGUI_WriteLE64(MG_RWops *dst, Uint64 value)
Writes an 64-bit integer of native format to a MG_RWops object in littlen endianness.
unsigned long long Uint64
A type definition for a 64-bit unsigned integer.
int MGUI_WriteBE32(MG_RWops *dst, Uint32 value)
Writes an 32-bit integer of native format to a MG_RWops object in big endianness.
unsigned short Uint16
A type definition for a 16-bit unsigned integer.
int MGUI_WriteLE16(MG_RWops *dst, Uint16 value)
Writes an 16-bit integer of native format to a MG_RWops object in littlen endianness.
unsigned char Uint8
A type definition for an 8-bit unsigned character.
Uint64 MGUI_ReadBE64(MG_RWops *src)
Reads a 64-bit big endian integer from a MG_RWops object.
Uint32 MGUI_ReadBE32(MG_RWops *src)
Reads a 32-bit big endian integer from a MG_RWops object.
int(* read)(struct _MG_RWops *context, void *ptr, int objsize, int num)
int MGUI_WriteLE16FP(FILE *dst, Uint16 value)
Writes an 16-bit integer of native format to a stdio FILE object in littlen endianness.
Uint32 MGUI_ReadLE32FP(FILE *src)
Reads a 32-bit little endian integer from a stdio FILE object.
int MGUI_WriteLE32FP(FILE *dst, Uint32 value)
Writes an 32-bit integer of native format to a stdio FILE object in littlen endianness.
Uint32 MGUI_ReadLE32(MG_RWops *src)
Reads a 32-bit little endian integer from a MG_RWops object.
int(* seek)(struct _MG_RWops *context, int offset, int whence)
int(* close)(struct _MG_RWops *context)
unsigned int Uint32
A type definition for a 32-bit unsigned integer.
int MGUI_WriteLE32(MG_RWops *dst, Uint32 value)
Writes an 32-bit integer of native format to a MG_RWops object in littlen endianness.
MG_EXPORT MG_RWops * MGUI_RWFromFP(FILE *fp, int autoclose)
Creates an MG_RWops object from an opened stdio FILE object.
MG_EXPORT MG_RWops * MGUI_AllocRW(void)
Allocates an uninitialized MG_RWops object.
struct _MG_RWops MG_RWops
MG_EXPORT int MGUI_RWgetc(MG_RWops *area)
Reads the next character from an data source.
int(* write)(struct _MG_RWops *context, const void *ptr, int objsize, int num)
int(* eof)(struct _MG_RWops *context)