Nilorea Library
C utilities for networking, threading, graphics
n_exceptions.c
Go to the documentation of this file.
1
8#include <pthread.h>
9#include "nilorea/n_common.h"
10#include "nilorea/n_log.h"
12
13
15
16
17
22{
23 ExceptionContextList *_new = ( ExceptionContextList * )malloc( sizeof( ExceptionContextList ) );
24
25 if( _new )
26 {
27 _new->head = __Exceptions;
28 __Exceptions = _new;
29 }
30 else
31 {
32 n_log( LOG_ERR, "Cannot even add a new exception context !!" );
33 }
34} /* push_exception() */
35
36
37
42void pop_exception( int ex )
43{
44 ExceptionContextList *head = NULL ;
45 head = __Exceptions -> head;
47 __Exceptions = head;
48
49 if( ex != NO_EXCEPTION )
50 {
51 if( __Exceptions )
52 {
53 longjmp( __Exceptions -> context, ex );
54 }
55 }
56} /* pop_exception */
57
#define Free(__ptr)
Free Handler to get errors.
Definition: n_common.h:256
struct ExceptionContextList * head
pointer to the next stacked exception
Definition: n_exceptions.h:45
void pop_exception(int ex)
Function to pop an exception in the list.
Definition: n_exceptions.c:42
ExceptionContextList * __Exceptions
Globale variable for exception stack management.
Definition: n_exceptions.c:14
#define NO_EXCEPTION
Possibly Throwed value, everything is fine.
Definition: n_exceptions.h:26
void push_exception(void)
Function to push an exception in the list.
Definition: n_exceptions.c:21
Exception stack structure.
Definition: n_exceptions.h:41
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
Definition: n_log.h:74
#define LOG_ERR
error conditions
Definition: n_log.h:58
Common headers and low-level hugly functions & define.
Exception management for C.
Generic log system.