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

Minor fixes in graphics package dummy implementation

parent bddf12f8
Branches
No related tags found
No related merge requests found
......@@ -158,6 +158,10 @@ public final class CPar extends RExternalBuiltinNode {
case "page":
// TODO:
return RDataFactory.createLogicalVectorFromScalar(false);
case "xaxp":
case "yaxp":
// TODO:
return RDataFactory.createDoubleVector(new double[]{0., 1., 5.}, RDataFactory.COMPLETE_VECTOR);
default:
if (!FastROptions.IgnoreGraphicsCalls.getBooleanValue()) {
throw RError.nyi(RError.NO_CALLER, "C_Par parameter '" + name + "'");
......
......@@ -25,7 +25,7 @@
# prints a warning message instructing the user to use grid/lattice/ggplot2 instead
eval(expression({
graphicsWarning <- function(name) {
graphicsWarning <- function(name, ignore = NULL) {
# lookup original function and fetch signature
fun <- tryCatch(get(name, environment()), error=function(x) NULL)
if(!is.null(fun)) {
......@@ -36,7 +36,11 @@ eval(expression({
if (.fastr.option('IgnoreGraphicsCalls')) {
# we evaluate the arguments to simulate the function effects
replacementFun <- function(...) { if (is.null(sig)) list(...) else get(names(sig)); invisible(NULL); }
# some arguments must be ignored, because they are a promise
# to value that will be calculated inside the function before
# the argument is accessed
sigNames <- setdiff(base::names(sig), ignore)
replacementFun <- function(...) { if (is.null(sigNames)) list(...) else mget(sigNames, ifnotfound=as.list(rep(42, length(sigNames)))); invisible(NULL); }
} else {
replacementFun <- function(...) {
warning(paste0(name, " not supported.", " Note: FastR does not support graphics package and most of its functions. Please use grid package or grid based packages like lattice instead."))
......@@ -98,7 +102,7 @@ eval(expression({
}
# Note: explicitly supported functions: din
# Note: harmless functions that we do not override: co.intervals, hist.default
# Note: harmless functions that we do not override: co.intervals, hist.default, axTicks
# Note: S3 dispatch functions that may dispatch to lattice/ggplot2/etc. implementation: hist, contour, lines, pairs, points, text
abline <- graphicsWarning("abline");
......@@ -108,7 +112,6 @@ eval(expression({
Axis <- graphicsWarning("Axis");
axis.Date <- graphicsWarning("axis.Date");
axis.POSIXct <- graphicsWarning("axis.POSIXct");
axTicks <- graphicsWarning("axTicks");
barplot.default <- graphicsWarning("barplot.default");
box <- graphicsWarning("box");
boxplot.default <- graphicsWarning("boxplot.default");
......@@ -134,7 +137,7 @@ eval(expression({
layout <- graphicsWarning("layout");
layout.show <- graphicsWarning("layout.show");
lcm <- graphicsWarning("lcm");
legend <- graphicsWarning("legend");
legend <- graphicsWarning("legend", c('merge'));
lines.default <- graphicsWarning("lines.default");
locator <- graphicsWarning("locator");
matlines <- graphicsWarning("matlines");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment