parent
d0a793c353
commit
b46c4dd535
|
@ -1,6 +1,8 @@
|
|||
#ifndef __EXCEPTIONS_H__
|
||||
#define __EXCEPTIONS_H__
|
||||
|
||||
/* $Id $ */
|
||||
|
||||
#ifndef XCEPT_H
|
||||
#include "except.h"
|
||||
#endif
|
||||
|
@ -74,7 +76,6 @@
|
|||
#define OutOfMemoryError 6
|
||||
|
||||
|
||||
|
||||
/* Usage:
|
||||
*
|
||||
* TRY {
|
||||
|
@ -172,17 +173,7 @@
|
|||
* RETHROW, and don't reenter FINALLY if a
|
||||
* different exception is thrown */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define WINTRY __try {
|
||||
#define WINENDTRY_BEGIN } __finally {
|
||||
#define WINENDTRY_END }
|
||||
#else
|
||||
#define WINTRY
|
||||
#define WINENDTRY_BEGIN
|
||||
#define WINENDTRY_END
|
||||
#endif
|
||||
|
||||
#define TRY /**/\
|
||||
#define TRY \
|
||||
{\
|
||||
except_t *exc; \
|
||||
volatile int except_state = 0; \
|
||||
|
@ -195,17 +186,15 @@
|
|||
except_state &= ~EXCEPT_CAUGHT; \
|
||||
\
|
||||
if (except_state == 0 && exc == 0) \
|
||||
WINTRY /* user's code goes here */
|
||||
|
||||
/* user's code goes here */
|
||||
|
||||
#define ENDTRY \
|
||||
WINENDTRY_BEGIN /* rethrow the exception if necessary */ \
|
||||
/* rethrow the exception if necessary */ \
|
||||
if(!(except_state&EXCEPT_CAUGHT) && exc != 0) \
|
||||
except_rethrow(exc); \
|
||||
except_try_pop(); WINENDTRY_END\
|
||||
except_try_pop();\
|
||||
}
|
||||
|
||||
|
||||
/* the (except_state |= EXCEPT_CAUGHT) in the below is a way of setting
|
||||
* except_state before the user's code, without disrupting the user's code if
|
||||
* it's a one-liner.
|
||||
|
|
Loading…
Reference in New Issue