Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_exceptions.c
Go to the documentation of this file.
1
9#include <pthread.h>
10#include "nilorea/n_common.h"
11#include "nilorea/n_log.h"
13
15
19void push_exception(void) {
21
22 if (_new) {
23 _new->head = __Exceptions;
24 __Exceptions = _new;
25 } else {
26 n_log(LOG_ERR, "Cannot even add a new exception context !!");
27 }
28} /* push_exception() */
29
34void pop_exception(int ex) {
35 ExceptionContextList* head = NULL;
36 head = __Exceptions->head;
38 __Exceptions = head;
39
40 if (ex != NO_EXCEPTION) {
41 if (__Exceptions) {
42 longjmp(__Exceptions->context, ex);
43 }
44 }
45} /* pop_exception */
#define Free(__ptr)
Free Handler to get errors.
Definition n_common.h:240
jmp_buf context
saving the current context
struct ExceptionContextList * head
pointer to the next stacked exception
void pop_exception(int ex)
Function to pop an exception in the list.
ExceptionContextList * __Exceptions
Globale variable for exception stack management.
#define NO_EXCEPTION
Possibly Throwed value, everything is fine.
void push_exception(void)
Function to push an exception in the list.
Exception stack structure.
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
Definition n_log.h:70
#define LOG_ERR
error conditions
Definition n_log.h:57
Common headers and low-level functions & define.
Exception management for C.
Generic log system.