Skip to content
Snippets Groups Projects
Commit 46903daf authored by stepan's avatar stepan
Browse files

Work around FastR's inability to change type in SET_TYPE in place

Use C preprocessor to rewrite calls to SET_TYPE(x,y) to x=SET_TYPE(x,y)
parent f2ec5388
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,7 @@
#define UNIMPLEMENTED unimplemented(__FUNCTION__)
#define NO_FASTR_REDEFINE
#include <rffiutils.h>
// these two functions are here just to handle casting void* to void function pointers...
......@@ -1252,7 +1253,7 @@ void DUPLICATE_ATTRIB(SEXP to, SEXP from) {
R_len_t R_BadLongVector(SEXP x, const char *y, int z) {
TRACE0();
unimplemented("R_BadLongVector");
return (R_len_t) 0;
// "no return" function
}
int IS_S4_OBJECT(SEXP x) {
......
......@@ -21,6 +21,7 @@
* questions.
*/
#define NO_FASTR_REDEFINE
#include <Rinterface.h>
#include <rffiutils.h>
#include <Rinternals_common.h>
......
......@@ -20,6 +20,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#define NO_FASTR_REDEFINE
#include <Rinterface.h>
#include <rffiutils.h>
#include <Rinternals_common.h>
......
55
57
#
# Copyright (c) 2017, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -74,6 +74,14 @@ use_internals_end = '''#endif
'''
set_typeof_rewrite = '''#ifdef FASTR
SEXP SET_TYPEOF_FASTR(SEXP x, int v);
#ifndef NO_FASTR_REDEFINE
#define SET_TYPEOF(X,Y) X=SET_TYPEOF_FASTR(X,Y)
#endif
#endif
'''
def ed_r_internals(gnu_dir):
r_internals_h = join(gnu_dir, 'Rinternals.h')
with open(r_internals_h) as f:
......@@ -105,6 +113,9 @@ def ed_r_internals(gnu_dir):
rewrite_var(f, var, line)
else:
f.write(line)
elif 'SET_TYPEOF' in line and '(SEXP' in line:
f.write(line)
f.write(set_typeof_rewrite)
else:
f.write(line)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment