ROOT
v6-20
Reference Guide
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
DllImport.h
R__EXTERN
#define R__EXTERN
Definition:
DllImport.h:27
RConfig.hxx
Throw
void Throw(int code)
If an exception context has been set (using the TRY and RETRY macros) jump back to where it was set.
Definition:
TException.cxx:27
gException
R__EXTERN ExceptionContext_t * gException
Definition:
TException.h:74
ExceptionContext_t
Definition:
TException.h:35
ExceptionContext_t::fBuf
jmp_buf fBuf
Definition:
TException.h:39
core
base
inc
TException.h
ROOT v6-20 - Reference Guide Generated on Fri Apr 1 2022 00:19:40 (GVA Time) using Doxygen 1.9.4