From 31708f7055b2d992350f6c256b35c8cf71b52759 Mon Sep 17 00:00:00 2001
From: Lukas Stadler <lukas.stadler@oracle.com>
Date: Wed, 22 Feb 2017 16:41:04 +0100
Subject: [PATCH] provide macros and public functions for IS_UTF8, etc.

---
 .../fficall/src/common/inlined_fastr.c              |  3 ++-
 mx.fastr/mx_fastr_edinclude.py                      | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/com.oracle.truffle.r.native/fficall/src/common/inlined_fastr.c b/com.oracle.truffle.r.native/fficall/src/common/inlined_fastr.c
index 72b60fd49b..184f0869ed 100644
--- a/com.oracle.truffle.r.native/fficall/src/common/inlined_fastr.c
+++ b/com.oracle.truffle.r.native/fficall/src/common/inlined_fastr.c
@@ -6,7 +6,7 @@
  * Copyright (c) 1995, 1996, 1997  Robert Gentleman and Ross Ihaka
  * Copyright (c) 1995-2014, The R Core Team
  * Copyright (c) 2002-2008, The R Foundation
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates
  *
  * All rights reserved.
  */
@@ -545,3 +545,4 @@ Rboolean IS_BYTES(SEXP x) { return FALSE; }
 Rboolean IS_LATIN1(SEXP x) { return FALSE; }
 Rboolean IS_ASCII(SEXP x) { return FALSE; }
 Rboolean IS_UTF8(SEXP x) { return TRUE; }
+Rboolean ENC_KNOWN(SEXP x) { return TRUE; }
diff --git a/mx.fastr/mx_fastr_edinclude.py b/mx.fastr/mx_fastr_edinclude.py
index dc211cdd32..3d329b13ac 100644
--- a/mx.fastr/mx_fastr_edinclude.py
+++ b/mx.fastr/mx_fastr_edinclude.py
@@ -61,6 +61,19 @@ sexp = '''#ifdef FASTR
 typedef void *SEXP;
 #define DATAPTR(x)\t\tR_DATAPTR(x)
 void *(R_DATAPTR)(SEXP x);
+
+#define IS_BYTES IS_BYTES
+#define IS_LATIN1 IS_LATIN1
+#define IS_ASCII IS_ASCII
+#define IS_UTF8 IS_UTF8
+#define ENC_KNOWN ENC_KNOWN
+
+Rboolean IS_BYTES(SEXP x);
+Rboolean IS_LATIN1(SEXP x);
+Rboolean IS_ASCII(SEXP x);
+Rboolean IS_UTF8(SEXP x);
+Rboolean ENC_KNOWN(SEXP x);
+
 #else
 '''
 use_internals_begin = '''#if defined (USE_RINTERNALS_DEFS) && (defined (USE_RINTERNALS) || defined (FASTR))
-- 
GitLab