Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rf_error and Rf_warning definitions

Tags:

r

Where can I find the definitions for these two functions. Grepping for their name brings only declarations but I can't find their implementation in the source code.

like image 356
John Difool Avatar asked Dec 11 '22 19:12

John Difool


1 Answers

Presumably you are looking for the C code function definitions. What I typically do when looking for the definitions is search across all files for the function name without the Rf_ but with the return type. For example, for Rf_error, I would search for void error. In this case you pretty quickly get (from src/main/errors.c@758, for R version 3.2.2):

void error(const char *format, ...)
{
    char buf[BUFSIZE];
    RCNTXT *c = R_GlobalContext;

    va_list(ap);
    va_start(ap, format);
    Rvsnprintf(buf, min(BUFSIZE, R_WarnLength), format, ap);
    va_end(ap);
    /* This can be called before R_GlobalContext is defined, so... */
    /* If profiling is on, this can be a CTXT_BUILTIN */
    if (c && (c->callflag & CTXT_BUILTIN)) c = c->nextcontext;
    errorcall(c ? c->call : R_NilValue, "%s", buf);
}

Rf_warning is defined at line 262 of the same file.

like image 152
BrodieG Avatar answered Jan 02 '23 04:01

BrodieG