Displaying 13 results from an estimated 13 matches for "ptr_r_writeconsole".
2007 Apr 03
2
R callbacks
Hi,
I'm trying to understand (mostly from the R-exts manual) how to use
the callbacks declared in Rinterface.h. As a first attempt, I'm trying
to redefine ptr_R_WriteConsole in a very trivial manner. Here's my
code:
---------------
$ cat altr.c
int Rf_initialize_R(int ac, char **av);
#define R_INTERFACE_PTRS 1
#include <Rinterface.h>
extern int R_running_as_main_program;
static void my_R_WriteConsole(char *buf, int len)
{
printf("R<< %s&qu...
2005 Oct 17
1
RFC: API to allow identification of warnings and errors in the output stream
...e is the
distinction between Rprintf/Rvprintf and REprintf/REvprintf. This basically
just carries this distinction over to the interface pointers.
You will note that I wrote
ptr_R_WriteErrConsole = R_WriteConsole;
instead of
ptr_R_WriteErrConsole = Rstd_WriteErrConsole;
or
ptr_R_WriteErrConsole = ptr_R_WriteConsole;
This way, code that currently overrides ptr_R_WriteConsole, but does not know
about ptr_R_WriteErrConsole, will still receive all output in
ptr_R_WriteConsole. Hence this change is perfectly backwards compatible.
Of course, the naming may not be perfect?
2) While 1 makes it easy to split warnin...
2009 Sep 03
1
Running an expression 1MN times using embedded R
...s.h>
#include <Rinterface.h>
#include <Rembedded.h>
#include <R_ext/Boolean.h>
#include <R_ext/Parse.h>
#include <R_ext/Rdynload.h>
const int i___ = 1;
#define is_bigendian() ( (*(char*)&i___) == 0 )
extern void (*ptr_R_ShowMessage)(const char *);
extern void (*ptr_R_WriteConsole)(const char *, int);
extern int (*ptr_R_ReadConsole)(char *, unsigned char *, int, int);
extern void (*ptr_R_WriteConsoleEx)(const char *, int , int );
SEXP rh_status(SEXP);
static uint8_t SET_STATUS = 0x02;
static R_CallMethodDef callMethods [] = {
{"rh_status",(DL_FUNC)&rh_stat...
2011 Jun 16
4
Controlling stdin and stdout in an embedded R instance
...R commands to an embedded console and then consume the output of
these commands. Specifically, I cannot send a set of commands to the
embedded console and then consume all of the output after the execution
completes. I have unsuccessfully attempted to assign values to the
ptr_R_ReadConsole and ptr_R_WriteConsole function pointers defined in
Rinterface.h but do not know if this is a valid approach. I am working
in Ubuntu 10.04 and thus the Windows example at the following address is
not applicable.
http://cran.r-project.org/doc/manuals/R-exts.html#Calling-R_002edll-directly
Does anyone on this list hav...
2008 Apr 29
2
Calling R from C - part way there but need a push!
...call and read the values back into my C
program"?
Help is much appreciated.
Regards, Max
(1) The most likely include file is Rinterface.h and within that the
most likely candidates seem to be:
extern int (*ptr_R_ReadConsole)(const char *, unsigned char *, int,
int);
extern void (*ptr_R_WriteConsole)(const char *, int);
extern void (*ptr_R_WriteConsoleEx)(const char *, int, int);
but it turns out that they assume that R is running the terminal and
these are requests to R to display or read from R's console. R isn't
acting as the back end being given work and returning answers.
(...
2004 Aug 18
3
R as shared library
...for a way for R code to call
back into a shared library from which the R shared library was loaded.
Essentially, apache starts and loads mod_R.so which runs an
initialization routine which calls Rf_initEmbeddedR() and the following
code:
/* override to call apache library write routine */
ptr_R_WriteConsole = Rapache_WriteConsole;
/* load source(). I assume this is appropriate. I could
always move this to the code that handles the requst */
PROTECT(R_source_fun = allocVector(LANGSXP, 2));
SETCAR(R_source_fun, Rf_install("source"));
SETCAR(CDR(R_source_fun), R_source_arg = NEW_C...
2005 Sep 12
1
ptr_R_EditFile, R_WriteConsole, and R_ShowMessage
...the callbacks to
the standard values.
2) That aside, what is the policy for R_ShowMessage? Can I assume all messages
being shown this way are errors of some sort? Or could there also be mere
informational messages (which in a GUI would be presented in slightly
different ways)?
R_WriteConsole (ptr_R_WriteConsole):
This is a great callback. It will allow me to get rid of my hacky sinks
(currently I use a sink to a file to retrieve the output). Even better would
be an additional callback ptr_R_WriteErr. Is there any particular reason, why
this does not exist? Could it be added?
Thanks!
Thomas
2010 Jul 21
1
Plot window does not update in embedded code
..."C" {
#define R_INTERFACE_PTRS
#include <Rinterface.h>
int Rf_initialize_R(int ac, char **av); /* in ../unix/system.c */
extern int R_running_as_main_program; /* in ../unix/system.c */
}
int main(int ac, char **av)
{
R_running_as_main_program = 1;
Rf_initialize_R(ac, av);
ptr_R_WriteConsoleEx = &R_WriteConsoleEx;
ptr_R_WriteConsole = &R_WriteConsole;
ptr_R_ReadConsole = &R_ReadConsole;
R_Outputfile = NULL;
R_Consolefile = NULL;
Rf_mainloop(); /* does not return */
return 0;
}
2005 Sep 22
3
warning.expression?
Hi!
I'm trying to catch all warning-messages for special handling. It seems
options (warning.expression=myfunc ()) can be used for that. However, the
question is: How can I get at the actual warning in myfunc ()? Apparently in
S, you can use .C("get_last_message") for that. Is there a similar mechanism
in R?
Thanks for your help!
Thomas
2005 Sep 22
3
warning.expression?
Hi!
I'm trying to catch all warning-messages for special handling. It seems
options (warning.expression=myfunc ()) can be used for that. However, the
question is: How can I get at the actual warning in myfunc ()? Apparently in
S, you can use .C("get_last_message") for that. Is there a similar mechanism
in R?
Thanks for your help!
Thomas
2010 May 06
1
R on kdeedu-svn library problem
...S/kdeedu/cantor/src/backends/R/rserver/rcallbacks.cpp:40: undefined
reference to `R_Outputfile'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rcallbacks.cpp:41: undefined
reference to `R_Consolefile'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rcallbacks.cpp:43: undefined
reference to `ptr_R_WriteConsole'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rcallbacks.cpp:44: undefined
reference to `ptr_R_WriteConsoleEx'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rcallbacks.cpp:45: undefined
reference to `ptr_R_ShowMessage'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rcallbacks.cpp:46:...
2007 Apr 24
0
R 2.5.0 is released
...s str2type, type2char and type2str are now available in
Rinternals.h.
o Added support for Objective C in R and packages (if available).
o R_ParseVector() has a new 4th argument 'SEXP srcfile' allowing
source references to be attached to the returned expression list.
o Added ptr_R_WriteConsoleEx callback which allows consoles to
distinguish between regular output and errors/warnings.
To ensure backward compatibility it is only used if
ptr_R_WriteConsole is set to NULL.
UTILITIES
o Additional Sweave() internal functions are exported to help
writing new drivers, and RweaveLatexR...
2007 Apr 24
0
R 2.5.0 is released
...s str2type, type2char and type2str are now available in
Rinternals.h.
o Added support for Objective C in R and packages (if available).
o R_ParseVector() has a new 4th argument 'SEXP srcfile' allowing
source references to be attached to the returned expression list.
o Added ptr_R_WriteConsoleEx callback which allows consoles to
distinguish between regular output and errors/warnings.
To ensure backward compatibility it is only used if
ptr_R_WriteConsole is set to NULL.
UTILITIES
o Additional Sweave() internal functions are exported to help
writing new drivers, and RweaveLatexR...