22 #ifndef RCPP_UNWINDPROTECT_H
23 #define RCPP_UNWINDPROTECT_H
27 #ifdef RCPP_USING_CXX11
32 namespace Rcpp {
namespace internal {
41 inline void maybeJump(
void* unwind_data, Rboolean jump) {
48 #ifdef RCPP_USING_CXX11
49 inline SEXP unwindProtectUnwrap(
void* data) {
50 std::function<SEXP(
void)>* callback = (std::function<SEXP(
void)>*) data;
64 if (setjmp(unwind_data.
jmpbuf)) {
69 ::R_PreserveObject(token);
74 return ::R_UnwindProtect(callback, data,
79 #ifdef RCPP_USING_CXX11
80 inline SEXP
unwindProtect(std::function<SEXP(
void)> callback) {
81 return unwindProtect(&internal::unwindProtectUnwrap, &callback);
void maybeJump(void *unwind_data, Rboolean jump)
SEXP unwindProtect(SEXP(*callback)(void *data), void *data)