Nilorea Library

- Main Page
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Macros Groups
Data Structures | Macros | Typedefs | Functions | Variables
EXCEPTION: C++ style try,catch,endtry,throw

## Data Structures

struct | ExceptionContextList

## Macros

#define | NO_EXCEPTION 0
#define | ARRAY_EXCEPTION 2
#define | DIVZERO_EXCEPTION 4
#define | OVERFLOW_EXCEPTION 8
#define | PARSING_EXCEPTION 16
#define | GENERAL_EXCEPTION ARRAY_EXCEPTION|DIVZERO_EXCEPTION|OVERFLOW_EXCEPTION|PARSING_EXCEPTION
#define | Try
#define | Catch(X)
#define | EndTry
#define | Throw(X) longjmp( __Exceptions -> context , (X) )

## Typedefs

typedef struct ExceptionContextList | ExceptionContextList

## Functions

void | push_exception (void)
| Function to push an exception in the list. More...
void | pop_exception (int)
| Function to pop an exception in the list. More...

## Variables

ExceptionContextList * | __Exceptions

## Detailed Description

## Macro Definition Documentation

#define ARRAY_EXCEPTION 2

Possibly Throwed value, we checked an out of bound operation

Definition at line 28 of file n_exceptions.h.

#define Catch | ( |  | X | ) |

Value:
} \
if( __exc_ & (X) ) \
{ \
__exc_ = 0 ;

Macro for replacing catch

Definition at line 64 of file n_exceptions.h.

#define DIVZERO_EXCEPTION 4

Possibly Throwed value, we check a divide by zero operation

Definition at line 30 of file n_exceptions.h.

#define EndTry

Value:
} \
pop_exception( __exc_ );\
}

Macro helper for closing the try-catch block

Definition at line 71 of file n_exceptions.h.

#define GENERAL_EXCEPTION ARRAY_EXCEPTION|DIVZERO_EXCEPTION|OVERFLOW_EXCEPTION|PARSING_EXCEPTION

General exception, we just detected an error an decided to go back where we're safe

Definition at line 36 of file n_exceptions.h.

#define NO_EXCEPTION 0

Possibly Throwed value, everything is fine

Definition at line 26 of file n_exceptions.h.

#define OVERFLOW_EXCEPTION 8

Possibly Throwed value, we checked an overflow in our arrays

Definition at line 32 of file n_exceptions.h.

#define PARSING_EXCEPTION 16

Possibly Throwed value, we checked an error during a char * parsing

Definition at line 34 of file n_exceptions.h.

#define Throw | ( |  | X | ) | longjmp( __Exceptions -> context , (X) )

Macro helper for adding exception throwing in custom functions

Definition at line 77 of file n_exceptions.h.

#define Try

Value:
{ \
int __exc_ ; \
push_exception(); \
__exc_ = setjmp( __Exceptions -> context ); \
if( __exc_ == NO_EXCEPTION ) \
{

Macro for replacing try

Definition at line 56 of file n_exceptions.h.

## Typedef Documentation

typedef struct ExceptionContextList ExceptionContextList

Exception stack structure

## Function Documentation

void pop_exception | ( | int | ex | ) |

Function to pop an exception in the list.

Parameters

  ex | Type of exception to pop

Definition at line 40 of file n_exceptions.c.

void push_exception | ( | void |  | ) |

Function to push an exception in the list.

Definition at line 18 of file n_exceptions.c.

## Variable Documentation

ExceptionContextList* __Exceptions

Globale variable for exception stack management

Definition at line 12 of file n_exceptions.c.