From 62f7006190dd2de219ce29f22f32c49214d303c8 Mon Sep 17 00:00:00 2001 From: Zbynek Slajchrt <zbynek.slajchrt@oracle.com> Date: Mon, 9 Jul 2018 19:28:49 +0200 Subject: [PATCH] Missing DL initialization fixed --- .../library/fastrGrid/grDevices/R/fastrGridDevices.R | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 7b010c2149..ceb538f75f 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 @@ -64,6 +64,9 @@ eval(expression({ if (!missing(displaylist)) { displaylist <- match.arg(displaylist) grid::grid.display.list(displaylist == "enable") + if (displaylist == "enable") { + .Call(grid:::C_initDisplayList) + } } else stop("argument is missing with no default") invisible() @@ -73,12 +76,12 @@ eval(expression({ recordPlot <- function() { dl <- grid:::grid.Call(grid:::C_getDisplayList) dl.idx <- grid:::grid.Call(grid:::C_getDLindex) - # The dummy elements and the class 'recordedplot' make the display list look - # like the GNUR one, which enables its use in the 'evaluate' package - # (used in knitr, for instance). - if (all(sapply(dl, function (x) is.null(x)))) { + if (all(sapply(dl[-1], function (x) is.null(x)))) { pl <- list(NULL) } else { + # The dummy elements and the class 'recordedplot' make the display list look + # like the GNUR one, which enables its use in the 'evaluate' package + # (used in knitr, for instance). pl <- list(list(list("dummyCallX",list(list("dummyCallY")))), dl = dl, dl.idx = dl.idx) } class(pl) <- "recordedplot" -- GitLab