error/exc.h File Reference

#include <setjmp.h>
#include "../msg.h"

Go to the source code of this file.

Classes

struct  Nps_exc_t
struct  Nps_exc_frame_t

Defines

#define THROW(e,...)   nps_throw(&(e),__FILE__,__LINE__,"" __VA_ARGS__)
#define RETHROW
#define TRY
#define CATCH
#define ON(e)
#define END_TRY
#define RETURN   switch (Nps_exc_stack = Nps_exc_stack->prev,0) default: return

Typedefs

typedef struct Nps_exc_t Nps_exc_t
typedef struct Nps_exc_frame_t Nps_exc_frame_t

Enumerations

enum  { Nps_exc_entered = 0, Nps_exc_thrown, Nps_exc_handled }

Functions

void nps_throw (const Nps_exc_t *e, const char *file, long line, const char *,...)

Variables

Nps_exc_frame_tNps_exc_stack

Define Documentation

#define CATCH
Value:
} /* Exiting TRY block */                                             \
    if (Nps_exc_stack != &_exc_top) {                                   \
      fprintf(stderr,"Exception stack is corrupted!\n");  exit(1);      \
    }                                                                   \
    Nps_exc_stack=Nps_exc_stack->prev;                                  \
    for (long nps_exc_catch_block=0; !nps_exc_catch_block && (Nps_exc_flag == Nps_exc_thrown); \
         nps_exc_catch_block=(Nps_exc_flag == Nps_exc_thrown ? RETHROW , 1 : \
                              free(_exc_top.msg),_exc_top.msg=NULL,1 ))
#define END_TRY
Value:
if (_exc_top.msg) fprintf(stderr,"Corrupted exception stack\n"),exit(1); \
  } while (0);
#define ON (  ) 
Value:
for (long _nps_exc_on_block=0; (!_nps_exc_on_block && &(e) == _exc_top.exc); \
       ++_nps_exc_on_block,Nps_exc_flag=Nps_exc_handled)                \
#define RETHROW
Value:
nps_throw(_exc_top.exc,_exc_top.file,  \
                               _exc_top.line, _exc_top.msg)
#define RETURN   switch (Nps_exc_stack = Nps_exc_stack->prev,0) default: return
#define THROW ( e,
...   )     nps_throw(&(e),__FILE__,__LINE__,"" __VA_ARGS__)
#define TRY
Value:
do {                                                        \
  volatile int Nps_exc_flag;                                            \
  Nps_exc_frame_t  _exc_top;                                            \
  _exc_top.msg   = NULL; /* non-null is a signal */                     \
  _exc_top.prev  = Nps_exc_stack;                                       \
  Nps_exc_stack    = &_exc_top;                                         \
  Nps_exc_flag     = setjmp(Nps_exc_stack->target);                     \
  if (Nps_exc_flag == Nps_exc_entered) {

Typedef Documentation

typedef struct Nps_exc_t Nps_exc_t

Enumeration Type Documentation

anonymous enum
Enumerator:
Nps_exc_entered 
Nps_exc_thrown 
Nps_exc_handled 

Function Documentation

void nps_throw ( const Nps_exc_t e,
const char *  file,
long  line,
const char *  ,
  ... 
)

Variable Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Sun Sep 11 09:40:46 2011 for NPSML by  doxygen 1.6.3