ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
TException.h
Go to the documentation of this file.
1
// @(#)root/base:$Id$
2
// Author: Fons Rademakers 21/09/95
3
4
/*************************************************************************
5
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
#ifndef ROOT_TException
13
#define ROOT_TException
14
15
16
//////////////////////////////////////////////////////////////////////////
17
// //
18
// Exception Handling //
19
// //
20
// Provide some macro's to simulate the coming C++ try, catch and throw //
21
// exception handling functionality. //
22
// //
23
//////////////////////////////////////////////////////////////////////////
24
25
#ifndef __CINT__
26
#include <setjmp.h>
27
#else
28
struct
sigjmp_buf;
29
struct
jmp_buf;
30
#endif
31
32
#include <
ROOT/RConfig.hxx
>
33
#include "
DllImport.h
"
34
35
struct
ExceptionContext_t {
36
#ifdef NEED_SIGJMP
37
sigjmp_buf fBuf;
38
#else
39
jmp_buf fBuf;
40
#endif
41
};
42
43
#ifdef NEED_SIGJMP
44
# define SETJMP(buf) sigsetjmp(buf,1)
45
#else
46
#define SETJMP(buf) setjmp(buf)
47
#endif
48
49
#define RETRY \
50
{ \
51
static ExceptionContext_t R__curr, *R__old = gException; \
52
int R__code; \
53
gException = &R__curr; \
54
R__code = SETJMP(gException->fBuf); if (R__code) { }; {
55
56
#define TRY \
57
{ \
58
static ExceptionContext_t R__curr, *R__old = gException; \
59
int R__code; \
60
gException = &R__curr; \
61
if ((R__code = SETJMP(gException->fBuf)) == 0) {
62
63
#define CATCH(n) \
64
gException = R__old; \
65
} else { \
66
int n = R__code; \
67
gException = R__old;
68
69
#define ENDTRY \
70
} \
71
gException = R__old; \
72
}
73
74
R__EXTERN ExceptionContext_t *gException;
75
76
extern
void
Throw(
int
code);
77
78
#endif
RConfig.hxx
DllImport.h
core
base
inc
TException.h
Generated on Tue May 5 2020 14:02:19 for ROOT by
1.8.5