File indexing completed on 2025-01-18 10:11:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TException
0013 #define ROOT_TException
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include <setjmp.h>
0026
0027 #include <ROOT/RConfig.hxx>
0028 #include "DllImport.h"
0029
0030 struct ExceptionContext_t {
0031 #ifdef NEED_SIGJMP
0032 sigjmp_buf fBuf;
0033 #else
0034 jmp_buf fBuf;
0035 #endif
0036 };
0037
0038 #ifdef NEED_SIGJMP
0039 # define SETJMP(buf) sigsetjmp(buf,1)
0040 #else
0041 #define SETJMP(buf) setjmp(buf)
0042 #endif
0043
0044 #define RETRY \
0045 { \
0046 static ExceptionContext_t R__curr, *R__old = gException; \
0047 int R__code; \
0048 gException = &R__curr; \
0049 R__code = SETJMP(gException->fBuf); if (R__code) { }; {
0050
0051 #define TRY \
0052 { \
0053 static ExceptionContext_t R__curr, *R__old = gException; \
0054 int R__code; \
0055 gException = &R__curr; \
0056 if ((R__code = SETJMP(gException->fBuf)) == 0) {
0057
0058 #define CATCH(n) \
0059 gException = R__old; \
0060 } else { \
0061 int n = R__code; \
0062 gException = R__old;
0063
0064 #define ENDTRY \
0065 } \
0066 gException = R__old; \
0067 }
0068
0069 R__EXTERN ExceptionContext_t *gException;
0070
0071 R__EXTERN void Throw(int code);
0072
0073 class TExceptionHandler {
0074 public:
0075 virtual ~TExceptionHandler() {}
0076 virtual void HandleException(int sig) = 0;
0077 };
0078
0079 R__EXTERN TExceptionHandler* gExceptionHandler;
0080
0081 #endif