From a6b1bc2db46c0e83119a9cf49031edc44a2abbde Mon Sep 17 00:00:00 2001 From: stepan <stepan.sindelar@oracle.com> Date: Wed, 7 Feb 2018 16:46:29 +0100 Subject: [PATCH] Implement Rf_errorcall upcall --- .../src/truffle_common/Rinternals_truffle_common.h | 13 +++++++++++-- com.oracle.truffle.r.native/version.source | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h index 6fc12a3a36..8d35f0b38c 100644 --- a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h +++ b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h @@ -214,7 +214,16 @@ static int Rvsnprintf(char *buf, size_t size, const char *format, va_list ap) { void Rf_errorcall(SEXP x, const char *format, ...) { TRACE0(); - UNIMPLEMENTED; + // See also comments in Rf_error + char buf[BUFSIZE]; + va_list(ap); + va_start(ap,format); + Rvsnprintf(buf, BUFSIZE - 1, format, ap); + va_end(ap); + ((call_Rf_errorcall) callbacks[Rf_errorcall_x])(x, ensure_string(buf)); + checkExitCall(); + // Should not reach here + unimplemented("Unexpected return from Rf_errorcall, should be no return function"); } void Rf_warningcall(SEXP x, const char *format, ...) { @@ -253,7 +262,7 @@ void Rf_error(const char *format, ...) { // RError.error does quite a lot of stuff including potentially searching for R condition handlers // and, if it finds any, does not return, but throws a different exception than RError. // We definitely need to exit the FFI call and we certainly cannot return to our caller. - char buf[8192]; + char buf[BUFSIZE]; va_list(ap); va_start(ap,format); Rvsnprintf(buf, BUFSIZE - 1, format, ap); diff --git a/com.oracle.truffle.r.native/version.source b/com.oracle.truffle.r.native/version.source index 21e72e8ac3..95f9650f01 100644 --- a/com.oracle.truffle.r.native/version.source +++ b/com.oracle.truffle.r.native/version.source @@ -1 +1 @@ -48 +49 -- GitLab