|
|
1.1 ! root 1: /* ! 2: * except.h ! 3: * ! 4: * Definitions and macros for C exception mechanism ! 5: * ! 6: (c) Jeffrey Mogul Stanford 18 February 1983 ! 7: */ ! 8: ! 9: #include <setjmp.h> ! 10: ! 11: typedef struct _Except_buf_x { ! 12: struct _Except_buf_x *Prev; /* exception chain back-pointer */ ! 13: jmp_buf Environ; /* saved environment */ ! 14: char *Message; /* Human-readable cause */ ! 15: int Code; /* Exception code */ ! 16: } _Except_Buf; ! 17: ! 18: extern _Except_Buf *_Except_Header; /* global exception chain header */ ! 19: ! 20: /* ! 21: * "syntax": ! 22: * DURING statement HANDLER statement END_HANDLER ! 23: */ ! 24: ! 25: #define _E_RESTORE _Except_Header = Exception.Prev ! 26: ! 27: #define DURING {_Except_Buf Exception;\ ! 28: Exception.Prev=_Except_Header;\ ! 29: _Except_Header= &Exception;\ ! 30: if (!setjmp(Exception.Environ)) { ! 31: ! 32: #define HANDLER _E_RESTORE;} else ! 33: ! 34: #define END_HANDLER } ! 35: ! 36: #define E_RETURN(x) {_E_RESTORE; return(x);} ! 37: ! 38: #define E_RETURN_VOID {_E_RESTORE; return;} ! 39: ! 40: #define RERAISE raise(Exception.Code, Exception.Message) ! 41: ! 42: /* ! 43: * Exception modes (combined with ||): ! 44: */ ! 45: #define EX_MODE_REPORT 1 /* report uncaught errors on stderr */ ! 46: #define EX_MODE_ABORT 2 /* abort if uncaught error */ ! 47: ! 48: extern int ExceptMode;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.