error/except.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 END_TRY
#define CATCH(e)

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:
if (Nps_exc_flag == Nps_exc_entered) Nps_exc_stack = Nps_exc_stack->prev; \
  } else if (Nps_exc_stack->exc == &(e)) {                              \
  Nps_exc_flag = Nps_exc_handled;                                       \
#define END_TRY
Value:
if (Nps_exc_flag == Nps_exc_entered) {                                \
    if (Nps_exc_stack != &curr_layer)                                   \
      MSG(DIE-1,"Exception Stack Corruption.\n");                       \
    if (Nps_exc_stack->msg) free(Nps_exc_stack->msg);                   \
    Nps_exc_stack = Nps_exc_stack->prev;                                \
  }                                                                     \
  } if (Nps_exc_flag == Nps_exc_thrown) THROW(*(Nps_exc_stack->exc));   \
  } while(0)
#define RETHROW
#define THROW ( e,
...   )     nps_throw(&(e),__FILE__,__LINE__,"" __VA_ARGS__)
#define TRY
Value:
do {                                                        \
  volatile int Nps_exc_flag;                                            \
  Nps_exc_frame_t  curr_layer;                                          \
  curr_layer.msg = NULL; /* non-null is a signal */                     \
  curr_layer.prev  = Nps_exc_stack;                                     \
  Nps_exc_stack    = &curr_layer;                                       \
  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