![]() |
GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
Commmon functions to parse data. More...
#include <loaders/gp_io.h>
Go to the source code of this file.
Enumerations | |
enum | gp_io_fmt_types { GP_IO_CONST = 0x0000 , GP_IO_BYTE = 0x0100 , GP_IO_L2 = 0x0200 , GP_IO_L4 = 0x0300 , GP_IO_B2 = 0x0400 , GP_IO_B4 = 0x0500 , GP_IO_ARRAY = 0x0600 , GP_IO_IGN = 0x0700 , GP_IO_I1 = GP_IO_IGN | 1 , GP_IO_I2 = GP_IO_IGN | 2 , GP_IO_I3 = GP_IO_IGN | 3 , GP_IO_I4 = GP_IO_IGN | 4 , GP_IO_PPSTR = 0x0800 , GP_IO_END = 0xff00 } |
Formatted binary read and write types. More... | |
Functions | |
int | gp_io_readf (gp_io *self, const uint16_t *types,...) |
Parses a data accodingly to the array of types. | |
int | gp_io_writef (gp_io *self, const uint16_t *types,...) |
Writes a data accodingly to the array of types. | |
int | gp_io_read_b4 (gp_io *self, uint32_t *val) |
Reads a single 32bit big endian integer. | |
int | gp_io_read_b2 (gp_io *self, uint16_t *val) |
Reads a single 16bit big endian integer. | |
char * | gp_io_read_b2_utf16 (gp_io *io, size_t nchars) |
Reads unicode string stored in big endian utf16 format. | |
Commmon functions to parse data.
Definition in file gp_io_parser.h.
enum gp_io_fmt_types |
Formatted binary read and write types.
This interface is a bit similar to a printf and scanf but instead of format string we have an array of 16bit unsigned integers describing the data.
Definition at line 22 of file gp_io_parser.h.
int gp_io_read_b2 | ( | gp_io * | self, |
uint16_t * | val ) |
Reads a single 16bit big endian integer.
The integer is read as a big endian from the I/O and stored into the ppointer in the machine endianity.
self | A readable I/O. |
val | A pointer to store the integer value into. |
char * gp_io_read_b2_utf16 | ( | gp_io * | io, |
size_t | nchars ) |
Reads unicode string stored in big endian utf16 format.
io | A readable I/O. |
nbytes | Number of characters, the number of bytes is twice the number of the characters for utf16. |
int gp_io_read_b4 | ( | gp_io * | self, |
uint32_t * | val ) |
Reads a single 32bit big endian integer.
The integer is read as a big endian from the I/O and stored into the ppointer in the machine endianity.
self | A readable I/O. |
val | A pointer to store the integer value into. |
int gp_io_readf | ( | gp_io * | self, |
const uint16_t * | types, | ||
... ) |
Parses a data accodingly to the array of types.
Example usage:
self | A readable I/O. |
types | An array of enum gp_io_fmt_types terminated by GP_IO_END describing the values to be read. |
... | Pointers to data describes in the types array. |
int gp_io_writef | ( | gp_io * | self, |
const uint16_t * | types, | ||
... ) |
Writes a data accodingly to the array of types.
Example usage:
self | A writeable I/O. |
types | An array of enum gp_io_fmt_types terminated by GP_IO_END describing the values to be written. |
... | Pointers to data describes in the types array. |