LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
|
Functions | |
int | big_error (int big_error_code, const char *format,...) |
void | warning (int block, const char *format,...) |
long long | lg_log_time () |
void | lg_set_error_context (const char *file, unsigned int line, const char *func, const char *txt, int code) |
int | lg_get_error_context_code () |
const char * | lg_get_full_error_context () |
void | lg_clear_error_context () |
void | lg_save_error_context (LG_ErrorContext *err_ctx) |
void | lg_restore_error_context (LG_ErrorContext *err_ctx) |
int | lg_push_error_context (LG_ErrorContext *err_ctx) |
LG_ErrorContext * | lg_pop_error_context () |
void * | malloc2_plus (size_t size, const char *file, unsigned int line, const char *func) |
void | free2_plus (void *mem, const char *file, unsigned int line, const char *func) |
int | mkdir_plus (const char *path, mode_t mode, const char *file, unsigned int line, const char *func) |
FILE * | fopen_plus (const char *path, const char *mode, const char *file, unsigned int line, const char *func) |
void | sig_handler (int sig_num, siginfo_t *sig_info, void *context) |
void | set_sig_handler () |
void | test_big_error (int test) |
=== Errors handling === Mem alloc funcs: - malloc3() - free3() TODO: complete the doc
int big_error | ( | int | big_error_code, |
const char * | format, | ||
... | |||
) |
This func's prototype is in libetm/error.h. This func is not defined in Libetm but in application and it handles CRITICAL ERRORS from both Libetm and application.
NUA: "*** CRITICAL ERROR ***" if (big_error_code > LIBETM_LASTERRORCODE && big_error_code <= LG_LASTERRORCODE) { bla bla } else if (big_error_code > LG_LASTERRORCODE) { bla bla }
void warning | ( | int | block, |
const char * | format, | ||
... | |||
) |
This func's prototype is in libetm/error.h. This func is not defined in Libetm but in application and it handles WARNINGS from both Libetm and application.
Will popup and wait for WARNING_TIMEOUT ms if no_block == TRUE, then close. Otherwise, will block until an appropriate keyboard/mouse action happens.
You can use BLOCK/NO_BLOCK helpers.
long long lg_log_time | ( | ) |
Log time
void lg_set_error_context | ( | const char * | file, |
unsigned int | line, | ||
const char * | func, | ||
const char * | txt, | ||
int | code | ||
) |
Set error context
Trying to find a way to trace back error origin
int lg_get_error_context_code | ( | ) |
Get error context code
const char* lg_get_full_error_context | ( | ) |
Get full error context code
void lg_clear_error_context | ( | ) |
Clear error context
void lg_save_error_context | ( | LG_ErrorContext * | err_ctx | ) |
Save error context
void lg_restore_error_context | ( | LG_ErrorContext * | err_ctx | ) |
Restore error context
int lg_push_error_context | ( | LG_ErrorContext * | err_ctx | ) |
Push error context
LG_ErrorContext* lg_pop_error_context | ( | ) |
Pop error context
void* malloc2_plus | ( | size_t | size, |
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
This is experimental - invoked by malloc3() macro
Test with malloc3((size_t)1024 * (size_t)(1024 * 1024 * 1024)), ie requiring 1 TiB of mem
void free2_plus | ( | void * | mem, |
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
This is experimental - invoked by free3() macro
int mkdir_plus | ( | const char * | path, |
mode_t | mode, | ||
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
This is experimental - invoked by mkdir_2() macro
=== BUGGY SO NOT USED SO FAR ===
FILE* fopen_plus | ( | const char * | path, |
const char * | mode, | ||
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
This is experimental - invoked by fopen_2() macro
=== BUGGY SO NOT USED SO FAR ===
void sig_handler | ( | int | sig_num, |
siginfo_t * | sig_info, | ||
void * | context | ||
) |
Set up the Unix signals handler
Unix signals (from signal(7) man page) LG_BUSERR // SIGBUS Bus error (bad memory access) LG_FPE // SIGFPE Floating-point exception LG_ILL // SIGILL Illegal Instruction LG_SEGFAULT // SIGSEGV Invalid memory reference
void set_sig_handler | ( | ) |
Handling a few Unix signals
void test_big_error | ( | int | test | ) |
Testing big_error()