[Rd] ptr_R_EditFile, R_WriteConsole, and R_ShowMessage

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Sep 12 18:02:39 CEST 2005


Hi!

I have an application embedding R. For that of course, it is great, that since 
R 2.1.0 the pointers in Rinterface.h allow me to override some callbacks, 
easily. However, after implementing/overriding a couple of those, I'm a bit 
confused about when exactly they get called. So, here are a few specific 
questions:

ptr_R_EditFile:
I can find exactly one point in the R-sources where ptr_R_EditFile acutally 
seems to be used (at least if non-NULL). By default the pointer is set to 
NULL with the comment "for futur expansion".
I wonder:
1) Why is this needed at all? Shouldn't the more generic R_EditFiles 
(ptr_R_EditFiles) suffice for the more specific case of editing a single 
file?
2) Why is ptr_R_EditFiles only available on aqua? Ok, it says on other 
platforms this does not currently work. But if I'd be able to create a 
working implementation in my application, why shouldn't I be allowed to 
override it (ok, I still can by just declaring it extern, but it's not 
exported in rinterface.h)? R could still check ptr_R_EditFiles for NULL 
before using it.
3) Am I correct in assuming that the parameter char* buf is supposed to keep 
the filename?

R_ShowMessage (ptr_R_ShowMessage):
This one, too, seems to have very few use-cases (but at least some). Most seem 
to be for errors during startup.
I wonder:
1) If this callback is most useful during startR (...), can it even be used in 
a meaningful way? After all, startR () also initializes all 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



More information about the R-devel mailing list