ROOT
v6-32
Reference Guide
Loading...
Searching...
No Matches
SignalTryCatch.h
Go to the documentation of this file.
1
// Partial reproduction of ROOT's TException.h
2
3
/*************************************************************************
4
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5
* All rights reserved. *
6
* *
7
* For the licensing terms see $ROOTSYS/LICENSE. *
8
* For the list of contributors see $ROOTSYS/README/CREDITS. *
9
*************************************************************************/
10
11
#ifndef CPYCPPYY_SIGNALTRYCATCH_H
12
#define CPYCPPYY_SIGNALTRYCATCH_H
13
14
#include <setjmp.h>
15
#include "
CPyCppyy/CommonDefs.h
"
16
17
#ifndef _WIN32
18
#define NEED_SIGJMP 1
19
#endif
20
21
// By default, the ExceptionContext_t class is expected in the namespace
22
// CppyyLegacy, If it is expected in no namespace, one can explicitly define
23
// NO_CPPYY_LEGACY_NAMESPACE at build time (e.g. if one wants to use ROOT).
24
25
#ifndef NO_CPPYY_LEGACY_NAMESPACE
26
namespace
CppyyLegacy
{
27
#endif
28
struct
ExceptionContext_t
{
29
#ifdef NEED_SIGJMP
30
sigjmp_buf
fBuf
;
31
#else
32
jmp_buf
fBuf
;
33
#endif
34
};
35
#ifndef NO_CPPYY_LEGACY_NAMESPACE
36
}
37
38
using
CppyyExceptionContext_t
=
CppyyLegacy::ExceptionContext_t
;
39
#else
40
using
CppyyExceptionContext_t
=
ExceptionContext_t
;
41
#endif
42
43
#ifdef NEED_SIGJMP
44
# define CLING_EXCEPTION_SETJMP(buf) sigsetjmp(buf,1)
45
#else
46
# define CLING_EXCEPTION_SETJMP(buf) setjmp(buf)
47
#endif
48
49
#define CLING_EXCEPTION_RETRY \
50
{ \
51
static CppyyExceptionContext_t R__curr, *R__old = gException; \
52
int R__code; \
53
gException = &R__curr; \
54
R__code = CLING_EXCEPTION_SETJMP(gException->fBuf); if (R__code) { }; {
55
56
#define CLING_EXCEPTION_TRY \
57
{ \
58
static CppyyExceptionContext_t R__curr, *R__old = gException; \
59
int R__code; \
60
gException = &R__curr; \
61
if ((R__code = CLING_EXCEPTION_SETJMP(gException->fBuf)) == 0) {
62
63
#define CLING_EXCEPTION_CATCH(n) \
64
gException = R__old; \
65
} else { \
66
int n = R__code; \
67
gException = R__old;
68
69
#define CLING_EXCEPTION_ENDTRY \
70
} \
71
gException = R__old; \
72
}
73
74
CPYCPPYY_IMPORT
CppyyExceptionContext_t
*
gException
;
75
76
#endif
gException
CPYCPPYY_IMPORT CppyyExceptionContext_t * gException
Definition
SignalTryCatch.h:74
CommonDefs.h
CPYCPPYY_IMPORT
#define CPYCPPYY_IMPORT
Definition
CommonDefs.h:26
CppyyLegacy
Definition
SignalTryCatch.h:26
CppyyLegacy::ExceptionContext_t
Definition
SignalTryCatch.h:28
CppyyLegacy::ExceptionContext_t::fBuf
sigjmp_buf fBuf
Definition
SignalTryCatch.h:30
ExceptionContext_t
Definition
TException.h:30
bindings
pyroot
cppyy
CPyCppyy
src
SignalTryCatch.h
ROOT v6-32 - Reference Guide Generated on Thu Dec 12 2024 15:05:25 (GVA Time) using Doxygen 1.9.8