Displaying 5 results from an estimated 5 matches for "r_currentexpr".
2007 Jan 18
0
Emulating a REPL in frontends
...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 PARSE_OK:
R_IoBufferReadReset(&R_ConsoleIob);
R_CurrentExpr = R_Parse1Buffer(&R_ConsoleIo...
2000 Nov 07
0
error handling
...cluded in a personal make of R.dll. (Similiar to R_Proxy_evaluate() in
rproxy_impl.c) Using SETJMP to catch errors works but there is a problem.
For example, the following code:
if (SETJMP(R_ToplevelContext->cjmpbuf)) // R_ToplevelContext->cjmpbuf
R_GlobalContext->cjmpbuf
return FALSE;
R_CurrentExpr = eval(R_CurrentExpr , rho);
will appear to work the first time there is an error, but the second error
causes an infinite loop. I have identified the location where the loop
occurs. It is in the function jump_to_toplevel() in errors.c inside the for
loop:
for (c = R_GlobalContext; c; c = c->...
2008 Sep 03
8
suggestion of new API function for embedded programming.
..._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 to the embedding interface, and
hopefully not difficult to incorporate by someone mo...
2010 Aug 20
2
segfault in embedded r after call to repldlldo1
...repldlldo1. within the readconsole
as long as i copy commandlines containing valid R commands function to
R's buffer all things are fine. but when i copy a non valid command, R
singals segfault after passing the error message, that the given object
is not valid. this happens in call to eval(R_CurrentExpr, rho) in
repldlldo1. i tried to comapare both ways (mainloop vs.
repldlldo+repldllinit) but actually cannot find a significant difference.
can anyone please help me with this problem, i'm stucked with this
because i don't know the inside of R and the datastructures.
some additional in...
2006 Aug 31
2
stop R mainloop without calling exit(1)
...ach eval() and
breaks the main loop by returning -1.
Here are the simple changes to the R source code ('+' are the lines I
added, '//' are the lines I removed):
src/main/main.c : Rf_ReplIteration(...):
------------------------------------------------------------------
value = eval(R_CurrentExpr, rho);
+if(value == NULL)
+return(-1);
src/main/main.c : do_quit():
-------------------------------------
//exit(0);
+return(NULL)
I also removed the call to exit in src/linux/sys-std.c:Rstd_CleanUp
and src/gnuwin32/system.c:R_CleanUp for linux and windows
respectively.
This is obviously a quick...