00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TException
00013 #define ROOT_TException
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __CINT__
00026 #include <setjmp.h>
00027 #else
00028 struct sigjmp_buf;
00029 struct jmp_buf;
00030 #endif
00031
00032 #ifndef ROOT_RConfig
00033 #include "RConfig.h"
00034 #endif
00035 #ifndef ROOT_DllImport
00036 #include "DllImport.h"
00037 #endif
00038
00039 struct ExceptionContext_t {
00040 #ifdef NEED_SIGJMP
00041 sigjmp_buf fBuf;
00042 #else
00043 jmp_buf fBuf;
00044 #endif
00045 };
00046
00047 #ifdef NEED_SIGJMP
00048 #define SETJMP(buf) sigsetjmp(buf,1)
00049 #else
00050 #define SETJMP(buf) setjmp(buf)
00051 #endif
00052
00053 #define RETRY \
00054 { \
00055 static ExceptionContext_t R__curr, *R__old = gException; \
00056 int R__code; \
00057 gException = &R__curr; \
00058 R__code = SETJMP(gException->fBuf); if (R__code) { }; {
00059
00060 #define TRY \
00061 { \
00062 static ExceptionContext_t R__curr, *R__old = gException; \
00063 int R__code; \
00064 gException = &R__curr; \
00065 if ((R__code = SETJMP(gException->fBuf)) == 0) {
00066
00067 #define CATCH(n) \
00068 gException = R__old; \
00069 } else { \
00070 int n = R__code; \
00071 gException = R__old;
00072
00073 #define ENDTRY \
00074 } \
00075 gException = R__old; \
00076 }
00077
00078 R__EXTERN ExceptionContext_t *gException;
00079
00080 extern void Throw(int code);
00081
00082 #endif