search for: r_consoleiob

Displaying 6 results from an estimated 6 matches for "r_consoleiob".

2007 Jan 18
0
Emulating a REPL in frontends
...1 (unsigned char *buffer, ParseStatus *parse_status, Rboolean set_last_sym_value, int print_mode, Rboolean do_toplevel_callbacks) { int c; ParseStatus status; SEXP value; SEXP rho = R_GlobalEnv; Rboolean wasDisplayed = FALSE; while((c = *buffer++)) { R_IoBufferPutc(c, &R_ConsoleIob); if(c == ';' || c == '\n') break; } R_PPStackTop = 0; R_CurrentExpr = R_Parse1Buffer(&R_ConsoleIob, 0, &status); if(parse_status) *parse_status = status; switch(status) { case PARSE_NULL: R_IoBufferWriteReset(&R_ConsoleIob); break; case P...
2007 Nov 07
1
problem in linking to libR.so with R 2.5.0
...a C++ program that uses R internals and I encounter "undefined reference" error when linking to libR.so. Here is an small example of the program test.cpp: extern "C" { #include <config.h> #include <IOStuff.h> int main(int argc, char** argv) { R_IoBufferInit(&R_ConsoleIob); return 0; } } I built it using: g++ -o test -I/dir/to/R-2.5.0/src/include -L/dir/to/R-2.5.0/lib/R/lib -lR test.cpp and I got the error message: /tmp/cc4zxrqh.o(.text+0x20): In function `main': test.cpp: undefined reference to `R_ConsoleIob' /tmp/cc4zxrqh.o(.text+0x25):test.cpp: undef...
2008 Sep 03
8
suggestion of new API function for embedded programming.
...ded API. There are a number of hidden or static parse functions (R_ParseBuffer, R_Parse1Buffer, etc.) which take an IoBuffer* and returns a parsed tree. If one or more of these functions were exported to the Rembedded.h API we could do something like the following: R_Expr = R_Parse1Buffer(&R_ConsoleIob, 0, &status); if (PARSE_OK==status) { ... value = eval(R_CurrentExpr, rho); ... } or possibly simplifying the interface to take the CMDL string: R_Expr = R_Parse1Line("t.test(x,conf.level=(1-p))$conf.int[2]", &status); I think this would be a useful addition t...
2015 Aug 21
0
Problems with embedded R, ReplDLL
...have found some problems with the examples given of embedded R use. One problem can be seen in R_ReplDLLinit, in src/main/main.c: void R_ReplDLLinit(void) { SETJMP(R_Toplevel.cjmpbuf); R_GlobalContext = R_ToplevelContext = R_SessionContext = &R_Toplevel; R_IoBufferWriteReset(&R_ConsoleIob); prompt_type = 1; DLLbuf[0] = DLLbuf[CONSOLE_BUFFER_SIZE] = '\0'; DLLbufp = DLLbuf; } The call of SETJMP makes no sense. Nothing that follows in this function can possibly cause a long jump. The use of R_ReplDLLinit is illustrated in the R Extensions manual (doc/manual/R-ex...
2008 Feb 15
0
R crashes with debug()
I know this may be a pathological case, but I found it while debugging PopCon: Invoking a debugged function prior to the conclusion of setup_Rmainloop() will cause R to crash because R_ConsoleIob is not initialized until run_Rmainloop(). Tested in R-2-6-branch and trunk on Linux. Crash it like this from a shell command line: $ cat >> ~/.Rprofile <<EOF foo <- function() x<-1 debug(foo) foo() EOF $ $R R version 2.7.0 Under development (unstable) (2008-02-15 r44481) Cop...
2013 May 25
0
segfault when using browser() in Rprofile.site
...by 0x41A4D7: main (Rmain.c:32) ==31314== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==31314== *** caught segfault *** address (nil), cause 'memory not mapped' And here is the gdb backtrace: #0 R_IoBufferPutc (c=c at entry=108, iob=iob at entry=0x9868c0 <R_ConsoleIob>) at iosupport.c:135 #1 0x00000000004d3c5d in Rf_ReplIteration (rho=rho at entry=0x9b9920, savestack=savestack at entry=9, browselevel=browselevel at entry=1, state=state at entry=0x7fffffffadb0) at main.c:222 #2 0x00000000004d4048 in R_ReplConsole (rho=rho at entry=0x9b9920, s...