[Rd] Wish: C-API to print if R_Visible is TRUE (PR#9467)

thomas.friedrichsmeier at ruhr-uni-bochum.de thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Jan 25 17:26:39 CET 2007


Full_Name: Thomas Friedrichsmeier
Version: 2.4.1
OS: Linux
Submission from: (NULL) (84.61.205.78)


Frontends wishing to emulate an R console typically want to print the value of
an evaluation, if and only if R_Visible is TRUE. R_Visible has never been part
of the public API (at least not as far as I looked back). In current SVN it is
also hidden from the library. The new R function withVisible() in current SVN
addresses the same issue, but is not easily usable from C (for a more detailed
discussion, see https://stat.ethz.ch/pipermail/r-devel/2007-January/044336.html).

Two alternative suggestions:
1) Make R_Visible part of the public API, or at least make it an exported symbol
again (so the daring can declare it extern and link against it).

2) It might be both cleaner and more convenient for API users to add something
like the following function, instead:
Rboolean Rf_doAutoPrint(SEXP exp, Rboolean forceprint)
{
        if(R_Visible || forceprint) {
            printValueEnv(exp, R_GlobalEnv);
            return TRUE;                /* was printed */
        }
        return FALSE;
}

Regards
Thomas Friedrichsmeier



More information about the R-devel mailing list