FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpp11/inst/include/cpp11/declarations.hpp at master · tmastny/cpp11 · GitHub
tmastny
/
cpp11
Public
forked from
r-lib/cpp11
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpp11
/
inst
/
include
/
cpp11
/
declarations.hpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (46 loc) · 1.7 KB
Breadcrumbs
cpp11
/
inst
/
include
/
cpp11
/
declarations.hpp
Copy path
File metadata and controls
52 lines (46 loc) · 1.7 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
pragma
once
#
include
<
cstring
>
#
include
<
string
>
#
include
<
vector
>
#
ifndef
CPP11_PARTIAL
#
include
"
cpp11.hpp
"
using
namespace
cpp11
;
namespace
writable
=
cpp11::writable;
#
endif
#
include
<
R_ext/Rdynload.h
>
namespace
cpp11
{
template
<
class
T
>
T&
unmove
(T&& t) {
return
t;
}
}
//
namespace cpp11
#
ifdef
HAS_UNWIND_PROTECT
#
define
CPP11_UNWIND
R_ContinueUnwind
(err);
#
else
#
define
CPP11_UNWIND
\
do
{ \
}
while
(
false
);
#
endif
#
define
BEGIN_CPP11
\
SEXP
err = R_NilValue; \
const
size_t
ERROR_SIZE
=
8192
; \
char
buf[
ERROR_SIZE
] =
"
"
; \
cpp11::release_existing_protections
(); \
try
{
#
define
END_CPP11
\
} \
catch
(cpp11::unwind_exception & e) { \
err = e.
token
; \
} \
catch
(std::exception & e) { \
strncpy
(buf, e.
what
(),
ERROR_SIZE
-
1
); \
} \
catch
(...) { \
strncpy
(buf,
"
C++ error (unknown cause)
"
,
ERROR_SIZE
-
1
); \
} \
if
(buf[
0
] !=
'
\0
'
) { \
Rf_error
(
"
%s
"
, buf); \
}
else
if
(err != R_NilValue) { \
CPP11_UNWIND
\
} \
return
R_NilValue;
Back
|
FazBrowse Home
|
New Git URL