50 #if defined(SimulateExceptions) || !defined(__cplusplus)
57 #define ExceptionSimulation 1
60 #include <mix/mutex.h>
64 # define Try if(!(esThrownCode = setjmp(*esNewControlLevel())))
65 # define Catch if(esEndControlLevel())
66 # define Throw(x) esThrowCode(x)
71 # if defined(__LINE__) && defined(__FILE__) && !defined(POOR_DEBUG)
73 # define Try if(!(esThrownCode = setjmp(*esNewControlLevelDebug(__FILE__, __LINE__))))
74 # define Catch if(esEndControlLevelDebug(__FILE__, __LINE__))
75 # define Throw(x) esThrowCodeDebug(x, __FILE__, __LINE__)
78 # define Try if(!(esThrownCode = setjmp(*esNewControlLevelDebug(NULL, 0))))
79 # define Catch if(esEndControlLevelDebug(NULL, 0))
80 # define Throw(x) esThrowCodeDebug(x, NULL, 0)
85 #define exCode esLastCode
91 extern TLStorage
int esLastCode;
95 extern TLStorage
int esThrownCode;
105 enum es_debug_state {
114 extern volatile enum es_debug_state esDebugState;
123 extern void esCoredumpHere ();
124 extern void esAllocCrash ();
125 extern void esExtraCatchCrash ();
126 extern int esIsRunTimeDebugging ();
127 extern jmp_buf* esAllocListItem ();
128 extern void esFreeListItem ();
129 extern jmp_buf* esCurrentHandler ();
130 extern int esNoTrySection ();
134 extern jmp_buf* esNewControlLevel ();
135 extern int esEndControlLevel ();
136 extern void esThrowCode (
int code);
137 extern void esNoCatchCrash (
int code);
140 extern jmp_buf* esNewControlLevelDebug (
const char* szSourceName,
142 extern int esEndControlLevelDebug (
const char* szSourceName,
144 extern void esThrowCodeDebug (
int code,
145 const char* szSourceName,
147 extern void esNoCatchCrashDebug (
int code,
148 const char* szSourceName,
164 extern enum es_debug_state esRunTimeCatcher (
int code);
178 #define ExceptionSimulation 0
181 #define Catch catch(int esCurrentCode)
182 #define Throw(x) throw (x)
183 #define exCode esCurrentCode
188 #define ExSafe(x) Try{x;}Catch{}
193 #define THROW(x) Throw(x)
197 #define ES_CRASH_CODE 99
200 #define ES_ENV_NAME "ESDEBUG"
204 #define ES_FULL_DEBUG "full"
208 #define ES_CORE_ERROR "error"
212 #define ES_CORE_THROW "throw"
216 #define ES_ERRNO_THROW "errno"