BinaryParser v1.0.0
Parse binary files with ease.
Loading...
Searching...
No Matches
parser.h File Reference

Parser for binary files. More...

#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include "binaryparser/version.h"

Go to the source code of this file.

Data Structures

class  bparser_bool_funcs_t
 A small struct that keeps track of the handler function and the actual function to run, as specified by bparser_read_bool_and_run. More...
class  bparser_seek_data_t
 A small struct keeping track of the parsers position in the file. More...
class  bparser_read_t
 Describes a read rule. More...
class  bparser_data_t
 Stores parsed data. More...
class  bparser_parser_t
 The parser. More...

Macros

#define BPARSER_UINT8
 Enum value for an uint8 value.
#define BPARSER_UINT16
 Enum value for an uint16 value.
#define BPARSER_UINT24
 Enum value for an uint24 value.
#define BPARSER_UINT32
 Enum value for an uint32 value.
#define BPARSER_UINT64
 Enum value for an uint64 value.
#define BPARSER_UINT128
 Enum value for an uint128 value.
#define BPARSER_INT8
 Enum value for an int8 value.
#define BPARSER_INT16
 Enum value for an int16 value.
#define BPARSER_INT24
 Enum value for an int24 value.
#define BPARSER_INT32
 Enum value for an int32 value.
#define BPARSER_INT64
 Enum value for an int64 value.
#define BPARSER_INT128
 Enum value for an int128 value.
#define BPARSER_STR
 Enum value for a string datatype.
#define BPARSER_N_BYTES
 Enum value for a byte array.
#define BPARSER_FIXED_STR
 Enum value for a string datatype of a set length.
#define BPARSER_FLOAT
 Enum value for a float datatype.
#define BPARSER_DOUBLE
 Enum value for a double datatype.
#define BPARSER_UNIX_TIME
 Enum value for the unix timestamp.
#define BPARSER_UNICODE_FROM_UTF8_STR
 Enum value for reading unicode codepoints from a null-terminated UTF8 string.
#define BPARSER_UNICODE_FROM_UTF8_F_STR
 Enum value for reading unicode codepoints from a fixed length UTF8 string.
#define BPARSER_UTF8_STR
 Enum value for reading a null-terminated UTF8 string.
#define BPARSER_UTF8_F_STR
 Enum value for reading a fixed length UTF8 string.
#define BPARSER_BOOLS
 Enum value for a boolean array.
#define BPARSER_BOOL_RUN
 Enum value for reading a boolean and running a function if it's true.
#define BPARSER_SEEK_TO
 Enum value used to specify seeking to a certain position.
#define BPARSER_SEEK_FORWARD
 Enum value used to specify seeking forward.
#define BPARSER_SEEK_BACKWARD
 Enum value used to specify seeking backward.
#define BPARSER_SEEK_FROM_END
 Enum value used to specify seeking from the end.
#define BPARSER_NO_SEEK
 Internal value, don't use.
#define BPARSER_RO_ARRAY_ERROR
 Error code for when reallocating the RO array failed.
#define BPARSER_MALLOC_ERROR
 Returned when malloc (or the user-defined function replacing malloc) fails.
#define BPARSER_NO_FUNC_PASSED
 Error code for when bparser_read_bytes_and_run or bparser_read_bool_and_run have no function given.
#define BPARSER_SPRINTF_ERROR
 Error code for when sprintf fails.
#define BPARSER_BACKWARD_SEEK_ERROR
 Error code for when seeking backwards beyond the beginning of the file.
#define BPARSER_SEEK_FROM_END_ERROR
 Error code for when seeking from the end goes beyond the beginning of the file.
#define BPARSER_EOF_ERROR
 Error code for when the parser reaches EOF.
#define BPARSER_CALLOC_ERROR
 Error code for when calloc fails.
#define BPARSER_UNKNOWN_ENDIAN
 Error code for when the parser encounters an unknown endianess.
#define BPARSER_UNKNOWN_READ_TYPE
 Error code for when the parser encounters an unknown data type.
#define BPARSER_FOPEN_ERROR
 Error code for when fopen errors out in bparser_fread.
#define BPARSER_FSEEK_ERROR
 Error code for when fseek errors out in bparser_fread.
#define BPARSER_FTELL_ERROR
 Error code for when ftell errors out in bparser_fread.
#define BPARSER_FREAD_EOF_ERROR
 Error code for when fread errors out on an unexpected EOF in bparser_fread.
#define BPARSER_SEEK_ERROR
 Error code for when an invalid seeking mode is specified to bparser_seek.
#define BPARSER_BAD_INTEGRAL_TYPE
 Error code for bparser_read_integral was given a bad integral type.
#define BPARSER_BAD_REALLOC_METHOD
 Error code for when bparser_parser_set_realloc_method is fed a bad / unknown realloc method.
#define BPARSER_REALLOC_FACTOR_TOO_SMALL
 Error code for when bparser_parser_set_realloc_method N arg is smaller than 1.
#define BPARSER_RENAME_NOT_FOUND
 Error code for when bparser_rename cannot find a data object of name Src.
#define BPARSER_PDC_INIT_ERROR
 Error code for when bparser_init fails from within bparser_parser_deep_copy.
#define BPARSER_PDC_RO_COPY_ERROR
 Error code for when bparser_read_order_deep_copy fails from within bparser_parser_deep_copy.
#define BPARSER_NULL_NAME
 Error code for when a bparser_read_* function recieves a NULL pointer for its' Name argument.
#define BPARSER_SHORT_NAME
 Error code for when a bparser_read_* function recieves a string shorter than 1 char for its' Name argument.
#define BPARSER_NO_PARSER
 Error code for when a function that changes or reads a parser instance, has no parser instance specified.
#define BPARSER_ZERO_LENGTH
 Error code for when an argument passed to a function is not of satisfactory length.
#define BPARSER_NAME_IS_NOT_UNIQUE
 Error code for when a name of a read rule that is about to be created is not unique.
#define BPARSER_NO_BOOLS_TO_READ
 Error code for _bparser_bool's argument A is equal to zero.
#define BPARSER_PDC_DATA_COPY_ERROR
 Error code for when bparser_data_deep_copy fails from within bparser_parser_deep_copy.
#define BPARSER_FREAD_ERROR
 Error code for when fread() errored out.
#define BPARSER_FREAD_UNKNOWN_ERROR
 Error code for when fread() errored out with an unknown reason.
#define BPARSER_NULL_DATA
 Error code for when bparser_read's Data arg is null.
#define BPARSER_NOTHING_TO_PARSE
 Error code for when bparser_read's Size arg is zero.
#define BPARSER_EMPTY_FILE
 Error code for when bparser_fread tries to read an empty file.
#define BPARSER_BAD_OVERRIDE
 Error code for when bparser_set_override has been specified with an unknown override method.
#define BPARSER_OK(expr)
 Use this on any bparser_ function that can return an error code to check if it didn't error out.
#define BPARSER_LITTLE_ENDIAN
 Used internally, tells us to read an integer in little endian mode.
#define BPARSER_BIG_ENDIAN
 Used internally, tells us to read an integer in big endian mode.
#define BPARSER_DEFAULT_ENDIAN
 Use with bparser_read_integral, to use the currently set endianess of the parser.
#define BPARSER_REALLOC_METHOD_PLUS
 Tells the parser to calculate new size to realloc as: new_size = old_size + N.
#define BPARSER_REALLOC_METHOD_MULT
 Tells the parser to calculate new size to realloc as: new_size = old_size * N a.k.a. default behaviour.
#define bparser_read_uint8(Parser, Name)
 Shortcut for reading an uint8.
#define bparser_read_int8(Parser, Name)
 Shortcut for reading an int8.
#define bparser_read_uint16(Parser, Name)
 Shortcut for reading an uint16.
#define bparser_read_int16(Parser, Name)
 Shortcut for reading an int16.
#define bparser_read_uint24(Parser, Name)
 Shortcut for reading an uint24.
#define bparser_read_int24(Parser, Name)
 Shortcut for reading an int24.
#define bparser_read_uint32(Parser, Name)
 Shortcut for reading an uint32.
#define bparser_read_int32(Parser, Name)
 Shortcut for reading an int32.
#define bparser_read_uint64(Parser, Name)
 Shortcut for reading an uint64.
#define bparser_read_int64(Parser, Name)
 Shortcut for reading an int64.
#define bparser_read_uint128(Parser, Name)
 Shortcut for reading an uint128.
#define bparser_read_int128(Parser, Name)
 Shortcut for reading an int128.
#define BPARSER_BYTES_F_ARGS
 Shortcut for argument list of bparser_bytes_f function. You can use it while making your own.
#define BPARSER_BYTES_SEQ_F_ARGS
 Shortcut for argument list of bparser_bytes_seq_f function. You can use it while making your own.
#define BPARSER_OVERRIDE_ERROR
 When a read rule has a name that is already used by some other, error out.
#define BPARSER_OVERRIDE_TRUE
 When a read rule has a name that is already used by some other, override it.
#define BPARSER_OVERRIDE_SKIP
 When a read rule has a name that is already used by some other, simply do not create it.
#define BPARSER_OVERRIDE_DO_NOTHING
 When a read rule has a name that is already used by some other, the library does not care. Use wisely.
#define BPARSER_BOOL_HANDLER_F_ARGS
 Shortcut for argument list of bparser_bool_handler_f function. You can use it while making your own.
#define BPARSER_BOOL_F_ARGS
 Shortcut for argument list of bparser_bool_f function. You can use it while making your own.

Typedefs

typedef void(* bparser_bytes_f) (BPARSER_BYTES_F_ARGS)
 Shortcut for the function to run as specified by bparser_read_bytes_and_run.
typedef void(* bparser_bytes_seq_f) (BPARSER_BYTES_SEQ_F_ARGS)
 Shortcut for the function to run as specified by bparser_read_bytes_and_run_sequential.
typedef char(* bparser_bool_handler_f) (BPARSER_BOOL_HANDLER_F_ARGS)
 Shortcut for handler function that controls whether bparser_bool_f runs.
typedef void(* bparser_bool_f) (BPARSER_BOOL_F_ARGS)
 Shortcut for the function that runs as specified by bparser_read_bool_and_run.
typedef void *(* bparser_calloc_like_f) (size_t num, size_t size)
 Shortcut for a custom callback for a calloc-like function.
typedef void(* bparser_free_like_f) (void *ptr)
 Shortcut for a custom callback for a free-like function.
typedef void *(* bparser_malloc_like_f) (size_t size)
 Shortcut for a custom callback for a malloc-like function.
typedef void *(* bparser_realloc_like_f) (void *ptr, size_t size)
 Shortcut for a custom callback for a realloc-like function.

Functions

bparser_parser_tbparser_init (bparser_malloc_like_f MallocLikeFunc, bparser_calloc_like_f CallocLikeFunc, bparser_realloc_like_f ReallocLikeFunc, bparser_free_like_f FreeLikeFunc)
 Create a new parser instance.
void bparser_destroy (bparser_parser_t *MParser)
 Destroy a parser instance.
void bparser_shallow_destroy (bparser_parser_t *MParser)
 Destroys a shallow copy of a parser instance.
void * bparser_set_malloc (bparser_parser_t *MParser, bparser_malloc_like_f Malloc)
 Override the malloc function used internally by the parser.
void * bparser_set_calloc (bparser_parser_t *MParser, bparser_calloc_like_f Calloc)
 Override the calloc function used internally by the parser.
void * bparser_set_realloc (bparser_parser_t *MParser, bparser_realloc_like_f Realloc)
 Override the realloc function used internally by the parser.
void * bparser_set_free (bparser_parser_t *MParser, bparser_free_like_f Free)
 Override the free function used internally by the parser.
char bparser_read_integral (bparser_parser_t *MParser, const char *Name, uint8_t Type, uint8_t Endian)
 Read an integral from the file.
char bparser_read_null_str (bparser_parser_t *MParser, const char *Name)
 Read a null-terminated string from the file.
char bparser_read_unicode_from_utf8_null_str (bparser_parser_t *MParser, const char *Name)
 Read unicode codepoints (uint32) from an UTF8 null terminated string from the file.
char bparser_read_utf8_null_str (bparser_parser_t *MParser, const char *Name)
 Read an UTF8 null terminated string from the file.
char bparser_read_fixed_len_str (bparser_parser_t *MParser, const char *Name, size_t Length)
 Read a string of specified length from the file.
char bparser_read_unicode_from_utf8_fixed_str (bparser_parser_t *MParser, const char *Name, size_t Length)
 Read unicode codepoints (uint32) from an UTF8 string of specified length from the file.
char bparser_read_utf8_fixed_len_str (bparser_parser_t *MParser, const char *Name, size_t Length)
 Read an UTF8 string of specified length from the file.
char bparser_read_bytes (bparser_parser_t *MParser, const char *Name, size_t NBytes)
 Read a specified amount of bytes from the file and store as a simple uint8 array.
char bparser_read_bytes_and_run (bparser_parser_t *MParser, size_t NBytes, bparser_bytes_f Func)
 Read a specified amount of bytes from the file and run a function on them.
char bparser_read_bytes_and_run_sequential (bparser_parser_t *MParser, size_t NBytes, bparser_bytes_seq_f Func)
 Read a specified amount of bytes and run a function on each one.
char bparser_read_array (bparser_parser_t *MParser, const char *Name, size_t Items, uint8_t ItemType)
 Read an array with N items of specified type.
char bparser_read_2d_array (bparser_parser_t *MParser, const char *Name, size_t Cols, size_t Rows, uint8_t ItemType)
 Read a 2D array of size NxM items of specified type.
char bparser_read_float (bparser_parser_t *MParser, const char *Name)
 Read a float from the file.
char bparser_read_double (bparser_parser_t *MParser, const char *Name)
 Read a double from the file.
char bparser_read_unix_time (bparser_parser_t *MParser, const char *Name)
 Read a 4 byte unsigned integer number and parse it as an Unix timestamp.
char bparser_read_8_booleans (bparser_parser_t *MParser, const char *Name)
 Read 8bits from the file and store each bit as boolean.
char bparser_read_16_booleans (bparser_parser_t *MParser, const char *Name)
 Read 16bits from the file and store each bit as boolean.
char bparser_read_24_booleans (bparser_parser_t *MParser, const char *Name)
 Read 24bits from the file and store each bit as boolean.
char bparser_read_32_booleans (bparser_parser_t *MParser, const char *Name)
 Read 32bits from the file and store each bit as boolean.
char bparser_read_64_booleans (bparser_parser_t *MParser, const char *Name)
 Read 64bits from the file and store each bit as boolean.
char bparser_read_128_booleans (bparser_parser_t *MParser, const char *Name)
 Read 128bits from the file and store each bit as boolean.
char bparser_read_bool_and_run (bparser_parser_t *MParser, bparser_bool_handler_f HFunc, bparser_bool_f Func)
 Read a single byte and run a function on it.
char bparser_read (bparser_parser_t *MParser, uint8_t *Data, size_t Size)
 Read data and parse according to saved rules.
char bparser_fread (bparser_parser_t *MParser, const char *Filename)
 Read file and parse according to saved rules.
char bparser_check_magic_num (const uint8_t *Data, const uint8_t *MagicNum, size_t Length)
 Check magic number.
char bparser_check_magic_num_char (const uint8_t *Data, const char *MagicNum, size_t Length)
 Check magic number.
void * bparser_get (const bparser_parser_t *MParser, const char *Name)
 Get parsed data.
void bparser_use_little_endian (bparser_parser_t *MParser)
 Instruct the parser to use little endian when reading multibyte integral values.
void bparser_use_big_endian (bparser_parser_t *MParser)
 Instruct the parser to use big endian when reading multibyte integral values.
char bparser_seek (bparser_parser_t *MParser, uint64_t Pos, uint8_t Mode)
 Seek to a position in the file.
char bparser_rewind (bparser_parser_t *MParser)
 Seek to beginning of the file.
char bparser_unwind (bparser_parser_t *MParser)
 Seek to the end of the file.
const char * bparser_error_str (char Error)
 Translate BPARSER_*_ERROR codes into strings.
size_t bparser_get_data_count (const bparser_parser_t *MParser)
 Get how many data entries have been stored so far.
size_t bparser_get_read_order_count (const bparser_parser_t *MParser)
 Get how many entries have been stored so far in the RO array.
bparser_read_tbparser_get_read_order_at (const bparser_parser_t *MParser, size_t Index)
 Get an entry from RO array.
void * bparser_read_order_shallow_copy (const bparser_parser_t *MParser, bparser_read_t *Dest)
 Shallowly copies the RO array.
void * bparser_read_order_deep_copy (const bparser_parser_t *MParser, bparser_read_t *Dest)
 Deeply copies the RO array.
char bparser_parser_set_realloc_method (bparser_parser_t *MParser, double N, uint8_t ReallocMethod)
 Set the realloc method.
void * bparser_data_shallow_copy (const bparser_parser_t *MParser, bparser_data_t *Dest)
 Shallowly copies the data array.
void * bparser_data_deep_copy (const bparser_parser_t *MParser, bparser_data_t *Dest, char *Failure)
 Deeply copies the data array.
const bparser_data_tbparser_get_data_at (const bparser_parser_t *MParser, size_t Indx)
 Get the raw bparser_data_t object from the parser.
void bparser_destroy_read_order (bparser_read_t *Array, size_t Length, bparser_free_like_f FreeCallback)
 Unallocates a read order (bparser_read_t) array.
void bparser_destroy_data (bparser_data_t *Array, size_t Length, bparser_free_like_f FreeCallback)
 Unallocates a data (bparser_data_t) array.
char bparser_rename (bparser_parser_t *MParser, const char *Src, const char *New)
 Renames an object in the data array.
void * bparser_parser_shallow_copy (bparser_parser_t *Src, bparser_parser_t *Dest)
 Shallowly copies Src parser instance into Dest parser instance.
void * bparser_parser_deep_copy (bparser_parser_t *Src, bparser_parser_t *Dest, char *Error)
 Deeply copies Src parser instance into Dest parser instance.
void * bparser_parser_move (bparser_parser_t *Src, bparser_parser_t *Dest)
 Using memmove, moves a parser instance.
char bparser_set_override (bparser_parser_t *MParser, uint8_t Override)
 Set custom override behaviour.

Detailed Description

Parser for binary files.

Includes the API for reading and parsing binary files.

Author
NorbCodes

Macro Definition Documentation

◆ BPARSER_BACKWARD_SEEK_ERROR

#define BPARSER_BACKWARD_SEEK_ERROR

Error code for when seeking backwards beyond the beginning of the file.

For example doing bparser_seek(MyParser, 80, BPARSER_SEEK_BACKWARD) on a 20 byte file. However, this is a runtime error, bparser_seek() has no way to return this error itself.

◆ BPARSER_BAD_INTEGRAL_TYPE

#define BPARSER_BAD_INTEGRAL_TYPE

Error code for bparser_read_integral was given a bad integral type.

This happens when you supply the Type argument with an enum other than: BPARSER_UINT8 to BPARSER_INT64, BPARSER_UINT128, BPARSER_INT128, BPARSER_UINT24 or BPARSER_INT24.

◆ BPARSER_BAD_REALLOC_METHOD

#define BPARSER_BAD_REALLOC_METHOD

Error code for when bparser_parser_set_realloc_method is fed a bad / unknown realloc method.

This happens when you supply the ReallocMethod arg with anything other than BPARSER_REALLOC_METHOD_PLUS or BPARSER_REALLOC_METHOD_MULT.

◆ BPARSER_BOOL_RUN

#define BPARSER_BOOL_RUN

Enum value for reading a boolean and running a function if it's true.

Used internally to specify a boolean and running a function if it's true.

◆ BPARSER_BOOLS

#define BPARSER_BOOLS

Enum value for a boolean array.

Used internally to specify a boolean array.

◆ BPARSER_CALLOC_ERROR

#define BPARSER_CALLOC_ERROR

Error code for when calloc fails.

Returned when calloc (or the user-defined function replacing calloc) fails.

◆ BPARSER_DOUBLE

#define BPARSER_DOUBLE

Enum value for a double datatype.

Used internally to specify a 64bit floating point number.

◆ BPARSER_EOF_ERROR

#define BPARSER_EOF_ERROR

Error code for when the parser reaches EOF.

This happens when the parser is told to read more data but it has already reached the end of the file.

◆ BPARSER_FIXED_STR

#define BPARSER_FIXED_STR

Enum value for a string datatype of a set length.

Used internally to specify a string with a fixed size (in characters).

◆ BPARSER_FLOAT

#define BPARSER_FLOAT

Enum value for a float datatype.

Used internally to specify a 32bit floating point number.

◆ BPARSER_FSEEK_ERROR

#define BPARSER_FSEEK_ERROR

Error code for when fseek errors out in bparser_fread.

It is important to catch this function erroring out because it is required to get the file size of the specified file.

◆ BPARSER_FTELL_ERROR

#define BPARSER_FTELL_ERROR

Error code for when ftell errors out in bparser_fread.

It is important to catch this function erroring out because it is required to get the file size of the specified file.

◆ BPARSER_INT128

#define BPARSER_INT128

Enum value for an int128 value.

Used to specify an 128bit signed integer number to be read using bparser_read_integral.

◆ BPARSER_INT16

#define BPARSER_INT16

Enum value for an int16 value.

Used to specify an 16bit signed integer number to be read using bparser_read_integral.

◆ BPARSER_INT24

#define BPARSER_INT24

Enum value for an int24 value.

Used to specify an 24bit signed integer number to be read using bparser_read_integral. Internally the 24bit read value is still stored as 32bit!

◆ BPARSER_INT32

#define BPARSER_INT32

Enum value for an int32 value.

Used to specify an 32bit signed integer number to be read using bparser_read_integral.

◆ BPARSER_INT64

#define BPARSER_INT64

Enum value for an int64 value.

Used to specify an 64bit signed integer number to be read using bparser_read_integral.

◆ BPARSER_INT8

#define BPARSER_INT8

Enum value for an int8 value.

Used to specify an 8bit signed integer number to be read using bparser_read_integral.

◆ BPARSER_N_BYTES

#define BPARSER_N_BYTES

Enum value for a byte array.

Used internally to specify a byte array.

◆ BPARSER_NAME_IS_NOT_UNIQUE

#define BPARSER_NAME_IS_NOT_UNIQUE

Error code for when a name of a read rule that is about to be created is not unique.

Note
Only returns if the parsers' Override property is equal to BPARSER_OVERRIDE_ERROR.

◆ BPARSER_RO_ARRAY_ERROR

#define BPARSER_RO_ARRAY_ERROR

Error code for when reallocating the RO array failed.

RO (Read Order) array is what stores what data to read, in what order, what endianess and etc. This is a dynamic array and when it is unable to be expanded (using realloc or the user-defined function replacing realloc) this error code will be returned.

◆ BPARSER_SEEK_BACKWARD

#define BPARSER_SEEK_BACKWARD

Enum value used to specify seeking backward.

When used in bparser_seek, it will seek by the given amount backward from the current position.

◆ BPARSER_SEEK_ERROR

#define BPARSER_SEEK_ERROR

Error code for when an invalid seeking mode is specified to bparser_seek.

This happens when the seeking mode is not BPARSER_SEEK_TO, BPARSER_SEEK_FORWARD, BPARSER_SEEK_BACKWARD or BPARSER_SEEK_FROM_END.

◆ BPARSER_SEEK_FORWARD

#define BPARSER_SEEK_FORWARD

Enum value used to specify seeking forward.

When used in bparser_seek, it will seek by the given amount forward from the current position.

◆ BPARSER_SEEK_FROM_END

#define BPARSER_SEEK_FROM_END

Enum value used to specify seeking from the end.

When used in bparser_seek, it will seek to the specified position from the end.

◆ BPARSER_SEEK_FROM_END_ERROR

#define BPARSER_SEEK_FROM_END_ERROR

Error code for when seeking from the end goes beyond the beginning of the file.

Same as BPARSER_BACKWARD_SEEK_ERROR.

◆ BPARSER_SEEK_TO

#define BPARSER_SEEK_TO

Enum value used to specify seeking to a certain position.

When used in bparser_seek, it will seek to the specified position.

◆ BPARSER_STR

#define BPARSER_STR

Enum value for a string datatype.

Used internally to specify a normal null-terminated string.

◆ BPARSER_UINT128

#define BPARSER_UINT128

Enum value for an uint128 value.

Used to specify an 128bit unsigned integer number to be read using bparser_read_integral.

◆ BPARSER_UINT16

#define BPARSER_UINT16

Enum value for an uint16 value.

Used to specify an 16bit unsigned integer number to be read using bparser_read_integral.

◆ BPARSER_UINT24

#define BPARSER_UINT24

Enum value for an uint24 value.

Used to specify an 24bit unsigned integer number to be read using bparser_read_integral. Internally the 24bit read value is still stored as 32bit!

◆ BPARSER_UINT32

#define BPARSER_UINT32

Enum value for an uint32 value.

Used to specify an 32bit unsigned integer number to be read using bparser_read_integral.

◆ BPARSER_UINT64

#define BPARSER_UINT64

Enum value for an uint64 value.

Used to specify an 64bit unsigned integer number to be read using bparser_read_integral.

◆ BPARSER_UINT8

#define BPARSER_UINT8

Enum value for an uint8 value.

Used to specify an 8bit unsigned integer number to be read using bparser_read_integral.

◆ BPARSER_UNICODE_FROM_UTF8_F_STR

#define BPARSER_UNICODE_FROM_UTF8_F_STR

Enum value for reading unicode codepoints from a fixed length UTF8 string.

Used internally to specify to decode a fixed length UTF8 string and return unicode codepoints (uint32 array).

◆ BPARSER_UNICODE_FROM_UTF8_STR

#define BPARSER_UNICODE_FROM_UTF8_STR

Enum value for reading unicode codepoints from a null-terminated UTF8 string.

Used internally to specify to decode an UTF8 string and return unicode codepoints (uint32 array).

◆ BPARSER_UNIX_TIME

#define BPARSER_UNIX_TIME

Enum value for the unix timestamp.

Used internally to specify to read a 32bit signed integer as unix timestamp.

◆ BPARSER_UNKNOWN_ENDIAN

#define BPARSER_UNKNOWN_ENDIAN

Error code for when the parser encounters an unknown endianess.

This shouldn't happen normally unless you tamper with class variables. This error happens when the parser encounters an endiannes that is not BPARSER_LITTLE_ENDIAN or BPARSER_BIG_ENDIAN.

◆ BPARSER_UNKNOWN_READ_TYPE

#define BPARSER_UNKNOWN_READ_TYPE

Error code for when the parser encounters an unknown data type.

This shouldn't happen normally unless you tamper with class members. This happens when the parser is told to read a datatype that is not an enum value from BPARSER_UINT8 to BPARSER_BOOL_RUN.

◆ BPARSER_UTF8_F_STR

#define BPARSER_UTF8_F_STR

Enum value for reading a fixed length UTF8 string.

Used internally to specify to decode a fixed length UTF8 string.

◆ BPARSER_UTF8_STR

#define BPARSER_UTF8_STR

Enum value for reading a null-terminated UTF8 string.

Used internally to specify to decode a null-terminated UTF8 string.

Function Documentation

◆ bparser_check_magic_num()

char bparser_check_magic_num ( const uint8_t * Data,
const uint8_t * MagicNum,
size_t Length )

Check magic number.

Parameters
[in]DataData.
[in]MagicNumMagic number.
[in]LengthLength of the magic number.
Returns
Returns 1 if it matches, else '0'.

◆ bparser_check_magic_num_char()

char bparser_check_magic_num_char ( const uint8_t * Data,
const char * MagicNum,
size_t Length )

Check magic number.

Parameters
[in]DataData.
[in]MagicNumMagic number.
[in]LengthLength of the magic number.
Returns
Returns 1 if it matches, else '0'. It may also return an error code, for which you can use BPARSER_OK to catch.

◆ bparser_data_deep_copy()

void * bparser_data_deep_copy ( const bparser_parser_t * MParser,
bparser_data_t * Dest,
char * Failure )

Deeply copies the data array.

Just like bparser_data_shallow_copy, if Dest is NULL, it is allocated for you, using MParsers' calloc callback function.

Parameters
[in]MParserParser instance to copy from.
[in]DestDestination bparser_data_t array.
[out]FailureError code is written here upon failure. Leave as NULL to ignore.
Returns
Returns Dest pointer. Returns NULL if the function fails, and sets Failure to the appropriate error code.

◆ bparser_data_shallow_copy()

void * bparser_data_shallow_copy ( const bparser_parser_t * MParser,
bparser_data_t * Dest )

Shallowly copies the data array.

Despite being similar to memcpy, if Dest is NULL, it allocates it for you. Note however, if you wish for this function to allocate it for you, it will use the MParsers' calloc callback function.

Warning
DO NOT use this to copy a data array between parser instances! Use bparser_data_deep_copy for that.
Parameters
[in]MParserParser instance to copy from.
[in]DestDestination bparser_data_t array.
Returns
Returns Dest pointer. Returns NULL if MParsers' calloc callback function failed.

◆ bparser_destroy()

void bparser_destroy ( bparser_parser_t * MParser)

Destroy a parser instance.

Parameters
[in]MParserThe parser to destroy.
Warning
Do not use on a shallow copy! Use bparser_shallow_destroy on those!

◆ bparser_destroy_data()

void bparser_destroy_data ( bparser_data_t * Array,
size_t Length,
bparser_free_like_f FreeCallback )

Unallocates a data (bparser_data_t) array.

Parameters
[in]ArrayThe array to destroy.
[in]LengthLength of the array.
[in]FreeCallbackSet to NULL to use default stdc free function, otherwise supply your own callback for freeing memory.

◆ bparser_destroy_read_order()

void bparser_destroy_read_order ( bparser_read_t * Array,
size_t Length,
bparser_free_like_f FreeCallback )

Unallocates a read order (bparser_read_t) array.

Parameters
[in]ArrayThe array to destroy.
[in]LengthLength of the array.
[in]FreeCallbackSet to NULL to use default stdc free function, otherwise supply your own callback for freeing memory.

◆ bparser_error_str()

const char * bparser_error_str ( char Error)

Translate BPARSER_*_ERROR codes into strings.

Parameters
[in]ErrorError code.
Returns
String.

◆ bparser_fread()

char bparser_fread ( bparser_parser_t * MParser,
const char * Filename )

Read file and parse according to saved rules.

Parameters
[in]MParserParser instance.
[in]FilenameThe file to read.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_get()

void * bparser_get ( const bparser_parser_t * MParser,
const char * Name )

Get parsed data.

Parameters
[in]MParserParser instance.
[in]NameName of the variable to get.
Returns
Returns a pointer to the variable, if it didn't find the variable, returns NULL.

◆ bparser_get_data_at()

const bparser_data_t * bparser_get_data_at ( const bparser_parser_t * MParser,
size_t Indx )

Get the raw bparser_data_t object from the parser.

Parameters
[in]MParserParser instance.
[in]IndxIndex.
Returns
Returns NULL if Indx is out of bounds.

◆ bparser_get_data_count()

size_t bparser_get_data_count ( const bparser_parser_t * MParser)

Get how many data entries have been stored so far.

Parameters
[in]MParserParser instance.
Returns
Count. As size_t.

◆ bparser_get_read_order_at()

bparser_read_t * bparser_get_read_order_at ( const bparser_parser_t * MParser,
size_t Index )

Get an entry from RO array.

Parameters
[in]MParserParser instance.
[in]IndexInstance.
Returns
bparser_read_t. Returns NULL if Index is outside the array.

◆ bparser_get_read_order_count()

size_t bparser_get_read_order_count ( const bparser_parser_t * MParser)

Get how many entries have been stored so far in the RO array.

Parameters
[in]MParserParser instance.
Returns
Count. As size_t.

◆ bparser_init()

bparser_parser_t * bparser_init ( bparser_malloc_like_f MallocLikeFunc,
bparser_calloc_like_f CallocLikeFunc,
bparser_realloc_like_f ReallocLikeFunc,
bparser_free_like_f FreeLikeFunc )

Create a new parser instance.

Parameters
[in]MallocLikeFuncUse it to override malloc. Leave as NULL to use default functions.
[in]CallocLikeFuncUse it to override calloc. Leave as NULL to use default functions.
[in]ReallocLikeFuncUse it to override realloc. Leave as NULL to use default functions.
[in]FreeLikeFuncUse it to override free. Leave as NULL to use default functions.
Returns
Pointer to the new parser instance. Returns NULL if either malloc or calloc fails.

◆ bparser_parser_deep_copy()

void * bparser_parser_deep_copy ( bparser_parser_t * Src,
bparser_parser_t * Dest,
char * Error )

Deeply copies Src parser instance into Dest parser instance.

Under the hood, bparser_read_order_deep_copy and bparser_data_deep_copy are used. Safe to say this is quite a hefty operation. If Dest is NULL, it uses bparser_init to make a new parser instance, to which the Src one is copied into. Note that when bparser_init is called, callbacks for malloc, calloc, realloc and free are copied from Src.

Parameters
[in]SrcParser instance to copy.
[in]DestDestination.
[out]ErrorError code is written here upon failure.
Returns
Returns Dest. Returns NULL on failure and sets Error to appropriate error code.

◆ bparser_parser_move()

void * bparser_parser_move ( bparser_parser_t * Src,
bparser_parser_t * Dest )

Using memmove, moves a parser instance.

Parameters
[in]SrcParser instance to move.
[in]DestWhere to move it.
Returns
Returns Dest. Returns NULL if memmove failed.

◆ bparser_parser_set_realloc_method()

char bparser_parser_set_realloc_method ( bparser_parser_t * MParser,
double N,
uint8_t ReallocMethod )

Set the realloc method.

As in, how to resize stuff with realloc. By default, for example with the RO array, the new size is determined by old_size * N. You can use this function to change that * to a + or to change N to however number you like. N here is a double, but obviously it's gonna get floor rounded before fed into realloc.

Parameters
[in]MParserParser instance.
[in]NFactor.
[in]ReallocMethodEither BPARSER_REALLOC_METHOD_PLUS or BPARSER_REALLOC_METHOD_MULT.
Returns
1 on success. Otherwise returns an error code. You can use BPARSER_OK macro to check this function.

◆ bparser_parser_shallow_copy()

void * bparser_parser_shallow_copy ( bparser_parser_t * Src,
bparser_parser_t * Dest )

Shallowly copies Src parser instance into Dest parser instance.

Despite being a glorified memcpy, if Dest is null, it uses bparser_init to make a new parser instance, to which the Src one is copied into. Note that when bparser_init is called, callbacks for malloc, calloc, realloc and free are copied from Src.

Parameters
[in]SrcParser instance to copy.
[in]DestDestination.
Returns
Returns Dest. Returns NULL only if Dest is NULL and bparser_init fails.

◆ bparser_read()

char bparser_read ( bparser_parser_t * MParser,
uint8_t * Data,
size_t Size )

Read data and parse according to saved rules.

Parameters
[in]MParserParser instance.
[in]DataArray of bytes.
[in]SizeLength of said array of bytes.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_128_booleans()

char bparser_read_128_booleans ( bparser_parser_t * MParser,
const char * Name )

Read 128bits from the file and store each bit as boolean.

Parameters
[in]MParserParser instance.
[in]NameName prefix. Individual boolean values can be accessed as {Name}[{index}].
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_16_booleans()

char bparser_read_16_booleans ( bparser_parser_t * MParser,
const char * Name )

Read 16bits from the file and store each bit as boolean.

Parameters
[in]MParserParser instance.
[in]NameName prefix. Individual boolean values can be accessed as {Name}[{index}].
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_24_booleans()

char bparser_read_24_booleans ( bparser_parser_t * MParser,
const char * Name )

Read 24bits from the file and store each bit as boolean.

Parameters
[in]MParserParser instance.
[in]NameName prefix. Individual boolean values can be accessed as {Name}[{index}].
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_2d_array()

char bparser_read_2d_array ( bparser_parser_t * MParser,
const char * Name,
size_t Cols,
size_t Rows,
uint8_t ItemType )

Read a 2D array of size NxM items of specified type.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this 2D array.
[in]ColsNumber of columns.
[in]RowsNumber of rows.
[in]ItemTypeType of each item.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_32_booleans()

char bparser_read_32_booleans ( bparser_parser_t * MParser,
const char * Name )

Read 32bits from the file and store each bit as boolean.

Parameters
[in]MParserParser instance.
[in]NameName prefix. Individual boolean values can be accessed as {Name}[{index}].
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_64_booleans()

char bparser_read_64_booleans ( bparser_parser_t * MParser,
const char * Name )

Read 64bits from the file and store each bit as boolean.

Parameters
[in]MParserParser instance.
[in]NameName prefix. Individual boolean values can be accessed as {Name}[{index}].
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_8_booleans()

char bparser_read_8_booleans ( bparser_parser_t * MParser,
const char * Name )

Read 8bits from the file and store each bit as boolean.

Parameters
[in]MParserParser instance.
[in]NameName prefix. Individual boolean values can be accessed as {Name}[{index}].
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_array()

char bparser_read_array ( bparser_parser_t * MParser,
const char * Name,
size_t Items,
uint8_t ItemType )

Read an array with N items of specified type.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this array.
[in]ItemsHow many items in the array.
[in]ItemTypeType of each item.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_bool_and_run()

char bparser_read_bool_and_run ( bparser_parser_t * MParser,
bparser_bool_handler_f HFunc,
bparser_bool_f Func )

Read a single byte and run a function on it.

HFunc can be left as NULL, in that case, if the boolean is higher than 0, Func will be ran.

Parameters
[in]MParserParser instance.
[in]HFuncHandler function. Decides if Func runs. Leave as NULL for default behaviour.
[in]FuncFunction to run when the boolean is true.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_bytes()

char bparser_read_bytes ( bparser_parser_t * MParser,
const char * Name,
size_t NBytes )

Read a specified amount of bytes from the file and store as a simple uint8 array.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this uint8 array.
[in]NBytesAmount of bytes to read.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_bytes_and_run()

char bparser_read_bytes_and_run ( bparser_parser_t * MParser,
size_t NBytes,
bparser_bytes_f Func )

Read a specified amount of bytes from the file and run a function on them.

Does not store the uint8 array afterward.

Parameters
[in]MParserParser instance.
[in]NBytesAmount of bytes to read.
[in]FuncFunction to run on the read bytes.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_bytes_and_run_sequential()

char bparser_read_bytes_and_run_sequential ( bparser_parser_t * MParser,
size_t NBytes,
bparser_bytes_seq_f Func )

Read a specified amount of bytes and run a function on each one.

Does not store the uint8 array afterward.

Parameters
[in]MParserParser instance.
[in]NBytesAmount of bytes to read.
[in]FuncFunction to run on the read bytes.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_double()

char bparser_read_double ( bparser_parser_t * MParser,
const char * Name )

Read a double from the file.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this double.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_fixed_len_str()

char bparser_read_fixed_len_str ( bparser_parser_t * MParser,
const char * Name,
size_t Length )

Read a string of specified length from the file.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this string.
[in]LengthLength of the string, in bytes.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_float()

char bparser_read_float ( bparser_parser_t * MParser,
const char * Name )

Read a float from the file.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this float.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_integral()

char bparser_read_integral ( bparser_parser_t * MParser,
const char * Name,
uint8_t Type,
uint8_t Endian )

Read an integral from the file.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this integral.
[in]TypeIntegral type.
[in]EndianEndianess to use.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_null_str()

char bparser_read_null_str ( bparser_parser_t * MParser,
const char * Name )

Read a null-terminated string from the file.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this string.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_order_deep_copy()

void * bparser_read_order_deep_copy ( const bparser_parser_t * MParser,
bparser_read_t * Dest )

Deeply copies the RO array.

Like bparser_read_order_shallow_copy, if Dest is NULL, it is allocated for you. It will use the provided MParsers' calloc callback function for it.

Parameters
[in]MParserParser instance to copy from.
[in]DestDestination bparser_read_t array.
Returns
Returns Dest pointer. Returns NULL if MParsers' calloc callback function fails.

◆ bparser_read_order_shallow_copy()

void * bparser_read_order_shallow_copy ( const bparser_parser_t * MParser,
bparser_read_t * Dest )

Shallowly copies the RO array.

Despite being similar to memcpy, if Dest is NULL, it allocates it for you. Note however, if you wish for this function to allocate it for you, it will use the MParsers' calloc callback function.

Warning
DO NOT use this to copy an RO array between parser instances. Use bparser_read_order_deep_copy for that.
Parameters
[in]MParserParser instance to copy from.
[in]DestDestination bparser_read_t array.
Returns
Returns Dest pointer. Returns NULL if MParsers' calloc callback function failed.

◆ bparser_read_unicode_from_utf8_fixed_str()

char bparser_read_unicode_from_utf8_fixed_str ( bparser_parser_t * MParser,
const char * Name,
size_t Length )

Read unicode codepoints (uint32) from an UTF8 string of specified length from the file.

Due to UTF8 encoded codepoints being 1 up to 4 bytes long, Length is given in characters. The library then calculates how many actual bytes will be read and processed.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this uint32 array.
[in]LengthLength of the string, in characters.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_unicode_from_utf8_null_str()

char bparser_read_unicode_from_utf8_null_str ( bparser_parser_t * MParser,
const char * Name )

Read unicode codepoints (uint32) from an UTF8 null terminated string from the file.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this uint32 array.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_unix_time()

char bparser_read_unix_time ( bparser_parser_t * MParser,
const char * Name )

Read a 4 byte unsigned integer number and parse it as an Unix timestamp.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this timestamp.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_utf8_fixed_len_str()

char bparser_read_utf8_fixed_len_str ( bparser_parser_t * MParser,
const char * Name,
size_t Length )

Read an UTF8 string of specified length from the file.

Due to UTF8 encoded codepoints being 1 up to 4 bytes long, Length is given in characters. The library then calculates how many actual bytes will be read and processed.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this UTF8 string.
[in]LengthLength of the string, in characters.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_read_utf8_null_str()

char bparser_read_utf8_null_str ( bparser_parser_t * MParser,
const char * Name )

Read an UTF8 null terminated string from the file.

Parameters
[in]MParserParser instance.
[in]NameName of the variable later used to get this UTF8 string.
Returns
Returns 1 on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_rename()

char bparser_rename ( bparser_parser_t * MParser,
const char * Src,
const char * New )

Renames an object in the data array.

Parameters
[in]MParserParser instance.
[in]SrcSource name to rename.
[in]NewNew name.
Returns
Returns '1' on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_rewind()

char bparser_rewind ( bparser_parser_t * MParser)

Seek to beginning of the file.

Parameters
[in]MParserParser instance.
Returns
Returns '1' on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_seek()

char bparser_seek ( bparser_parser_t * MParser,
uint64_t Pos,
uint8_t Mode )

Seek to a position in the file.

Parameters
[in]MParserParser instance.
[in]PosPosition.
[in]ModeSeeking mode.
Returns
Returns '1' on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_set_calloc()

void * bparser_set_calloc ( bparser_parser_t * MParser,
bparser_calloc_like_f Calloc )

Override the calloc function used internally by the parser.

Parameters
[in]MParserParser instance.
[in]CallocYour function of type bparser_calloc_like_f, or NULL to use the standard library calloc.
Returns
Returns back the function that it is using for the callback. Returns NULL on failure.

◆ bparser_set_free()

void * bparser_set_free ( bparser_parser_t * MParser,
bparser_free_like_f Free )

Override the free function used internally by the parser.

Parameters
[in]MParserParser instance.
[in]FreeYour function of type bparser_free_like_f, or NULL to use the standard library free.
Returns
Returns back the function that it is using for the callback. Returns NULL on failure.

◆ bparser_set_malloc()

void * bparser_set_malloc ( bparser_parser_t * MParser,
bparser_malloc_like_f Malloc )

Override the malloc function used internally by the parser.

Parameters
[in]MParserParser instance.
[in]MallocYour function of type bparser_malloc_like_f, or NULL to use the standard library malloc.
Returns
Returns back the function that it is using for the callback. Returns NULL on failure.

◆ bparser_set_override()

char bparser_set_override ( bparser_parser_t * MParser,
uint8_t Override )

Set custom override behaviour.

This is used to tell the parser what to do to fix an issue with two read rules having the same name.

Parameters
[in]MParserParser instance.
[in]OverrideEnum value either BPARSER_OVERRIDE_ERROR, BPARSER_OVERRIDE_TRUE, BPARSER_OVERRIDE_SKIP or BPARSER_OVERRIDE_DO_NOTHING.
Returns
1 on success. You can use BPARSER_OK macro to check if this function succeeds.

◆ bparser_set_realloc()

void * bparser_set_realloc ( bparser_parser_t * MParser,
bparser_realloc_like_f Realloc )

Override the realloc function used internally by the parser.

Parameters
[in]MParserParser instance.
[in]ReallocYour function of type bparser_realloc_like_f, or NULL to use the standard library realloc.
Returns
Returns back the function that it is using for the callback. Returns NULL on failure.

◆ bparser_shallow_destroy()

void bparser_shallow_destroy ( bparser_parser_t * MParser)

Destroys a shallow copy of a parser instance.

ONLY use this on shallow copies. This effectively destroys the copy without freeing the RO and Data pointers. If you have parser B that is a deep copy of parser A, use bparser_destroy on parser A, and bparser_shallow_destroy on parser B, to avoid both memory leaks and double free-ing!

Parameters
[in]MParserParser instance.

◆ bparser_unwind()

char bparser_unwind ( bparser_parser_t * MParser)

Seek to the end of the file.

Parameters
[in]MParserParser instance.
Returns
Returns '1' on success. You can use BPARSER_OK macro to check if this function succeeded.

◆ bparser_use_big_endian()

void bparser_use_big_endian ( bparser_parser_t * MParser)

Instruct the parser to use big endian when reading multibyte integral values.

Parameters
[in]MParserParser instance.

◆ bparser_use_little_endian()

void bparser_use_little_endian ( bparser_parser_t * MParser)

Instruct the parser to use little endian when reading multibyte integral values.

Parameters
[in]MParserParser instance.