diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/R/fastrGridDevices.R b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/R/fastrGridDevices.R index ef9033a6676b28bbf9ca3be615466d6363d83c31..8660bce52947128fca619ed9ecad4d4d804c1b18 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/R/fastrGridDevices.R +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/R/fastrGridDevices.R @@ -21,38 +21,24 @@ eval(expression({ - assignInNs <- function(x, val) { - ns <- asNamespace("grDevices") - unlockBinding(x, ns) - assign(x, val, envir = ns, inherits = T) - lockBinding(x, ns) - } - # This should be preffered way of starting the FastR java device. # For compatibility reasons, both X11 and awt end up calling C_X11. - # In the future, this function may support extra parameters like a - # reference to java 2D graphics object, which will be used for the drawing. - assignInNs('awt', function(width = NULL, height = NULL, graphicsObj = NULL) { + awt <- function(width = NULL, height = NULL, graphicsObj = NULL) invisible(.External2(grDevices:::C_X11, ".FASTR.AWT", width, height, graphicsObj)) - }) # Allows to get the SVG code from SVG device, it also closes the device, # but the contents are not saved to the given file. - assignInNs('svg.off', function(which = dev.cur()) { + svg.off <- function(which = dev.cur()) { if (which == 1) { stop("cannot shut down device 1 (the null device)") } .External(C_devoff, as.integer(-which)) - }) + } # Allows to get the SVG code from SVG device without closing it + # the symbol info should be constant svgStringSymbol <- list(name='svgstring') - assignInNs('svg.string', function() { - .External(svgStringSymbol) - }) - - # Adds help files for the new public functions - .fastr.addHelpPath('/com/oracle/truffle/r/library/fastrGrid/grDevices/Rd') + svg.string <- function() .External(svgStringSymbol) # GnuR version only works with "X11cairo" device. Our version of savePlot # works with "awt" device and "X11cairo", which is for us only alias for @@ -103,4 +89,13 @@ eval(expression({ grid:::grid.refresh() } -}), asNamespace("grDevices")) \ No newline at end of file +}), asNamespace("grDevices")) + +# export new public functions +exports <- asNamespace("grDevices")[[".__NAMESPACE__."]][['exports']] +assign('svg.off', 'svg.off', envir = exports) +assign('svg.string', 'svg.string', envir = exports) +assign('awt', 'awt', envir = exports) + +# add help files for the new public functions +.fastr.addHelpPath('/com/oracle/truffle/r/library/fastrGrid/grDevices/Rd') \ No newline at end of file diff --git a/com.oracle.truffle.r.native/run/Makefile b/com.oracle.truffle.r.native/run/Makefile index 2fd145b8277cf69f1a5118780d19c44263089cfc..67dd0de7c8aed5b0348fd0a3c66f984c82dbf4eb 100644 --- a/com.oracle.truffle.r.native/run/Makefile +++ b/com.oracle.truffle.r.native/run/Makefile @@ -69,7 +69,6 @@ rcmds: $(FASTR_BIN_DIR)/R $(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh Rclasspath.sh cp -r $(BIN_FILES) $(FASTR_BIN_DIR) - # cp $(FASTR_R_HOME)/com.oracle.truffle.r.native/gnur/patch/bin-patch/* $(FASTR_BIN_DIR) # overide bin/R cp R.sh $(FASTR_BIN_DIR)/exec/R @@ -82,7 +81,7 @@ $(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh Rclasspath.sh # update R_HOME_DIR to FastR, --help to -r-help because --help is handled by FastR, and pass args to Rcmd (esp. --jvm) (sed -e 's!^\(R_HOME_DIR=\)\(.*\)!\1"$(FASTR_R_HOME)"!' | \ sed -e 's/ -h.--help./ --r-help\)/' | \ - sed -e 's! exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;! FASTR_INTERNAL_ARGS="$${FASTR_INTERNAL_ARGS} $${args}" exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;!') < $(R_SCRIPT) > $(FASTR_BIN_DIR)/R + sed -e 's! exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;! FASTR_INTERNAL_ARGS=`echo "$${FASTR_INTERNAL_ARGS} $${args}" | $${SED} -e 's/^[[:space:]]*//'` exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;!') < $(R_SCRIPT) > $(FASTR_BIN_DIR)/R chmod +x $(FASTR_BIN_DIR)/R touch $(FASTR_ETC_DIR)/ldpaths sed -e "s|\(R_LIBS_USER=.*-'\)\(.*\)'}|\1$(FASTR_R_HOME)/library'}|" < $(GNUR_HOME_BINARY)/etc/Renviron > $(FASTR_ETC_DIR)/Renviron diff --git a/com.oracle.truffle.r.native/run/edMakeconf.etc b/com.oracle.truffle.r.native/run/edMakeconf.etc index 56acb23b418b5497dc0e148d6599ff24bc54540e..af6567fefcf39bbb9a2b60fe821d7633ec4b0cd1 100644 --- a/com.oracle.truffle.r.native/run/edMakeconf.etc +++ b/com.oracle.truffle.r.native/run/edMakeconf.etc @@ -2,6 +2,12 @@ /^CXXFLAGS/s/$/ -DFASTR/ /^CPPFLAGS/s/$/ -DFASTR/ g/JAVA_HOME =/d +g/JAVAC =/d +g/JAVAH =/d +g/JAVA =/d +g/JAVA_LIBS =/d +g/JAVA_LD_LIBRARY_PATH =/d +g/JAVA_CPPFLAGS =/d /LIBINTL=/ d /LIBR =/