10int array_exception(
int boolean )
22int divzero_exception(
int boolean )
34int overflow_exception(
int boolean )
46int parsing_exception(
int boolean )
58int all_exception(
int boolean )
76 puts(
"ArrayNoCatch" );
99 puts(
"DivZeroNoCatch" );
103 divzero_exception( 0 );
105 divzero_exception( 1 );
108 puts(
"DivZeroCatch" );
112 divzero_exception( 0 );
114 divzero_exception( 1 );
125 overflow_exception( 0 );
127 overflow_exception( 1 );
133 overflow_exception( 0 );
135 overflow_exception( 1 );
146 parsing_exception( 0 );
148 parsing_exception( 1 );
154 parsing_exception( 0 );
156 parsing_exception( 1 );
188 n_log(
LOG_NOTICE,
"Trying mixed Try-Catch blocks, we are inside block 1" );
197 n_log(
LOG_NOTICE,
"Caught signal matching GENERAL_EXCEPTION inside block 2" );
204 n_log(
LOG_NOTICE,
"Caught signal matching GENERAL_EXCEPTION inside block 1" );
#define Throw(X)
Macro helper for adding exception throwing in custom functions.
#define OVERFLOW_EXCEPTION
Possibly Throwed value, we checked an overflow in our arrays.
#define Try
Macro for replacing try.
#define GENERAL_EXCEPTION
General exception, we just detected an error an decided to go back where we're safe.
#define PARSING_EXCEPTION
Possibly Throwed value, we checked an error during a char * parsing.
#define ARRAY_EXCEPTION
Possibly Throwed value, we checked an out of bound operation.
#define Catch(X)
Macro for replacing catch.
#define DIVZERO_EXCEPTION
Possibly Throwed value, we check a divide by zero operation.
#define EndTry
Macro helper for closing the try-catch block.
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_DEBUG
debug-level messages
#define LOG_STDERR
internal, default LOG_TYPE
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL )
#define LOG_NOTICE
normal but significant condition
#define LOG_INFO
informational
Exception management for C.