[R-gui] Interfaces between GUIs and R
Byron Ellis wrote:
I was curious how you were going to handle the graphics devices... Are you somehow capturing the output from the devga device under the Windows platform?
I capture the graph device window, i.e., I display it in my own application instead of in its original place but R is still responsible directly of (re)drawing its content. This way, I do not need to exchange large amounts of data between the backend and the frontend (indeed, there are no exchanges at all!) and all functionalities provided by the original R graph device are still available in SciViews, like copy metafile/bitmap to the clipboard, save the graphs directly in different formats, save and restore to and from a variable in the R user workspace and management of a graph history that is specific to the Windows version of R.
As far as I can determine from working with the C APIs, the OpenMath and MathLink protocols are quite similar, though they use a slightly different protocol syntax you can generate a complete mapping from one to the other: MLPutInteger -> OMputInt32 MLPutReal -> OMputFloat64 MLPutSymbol-> OMputSymbol (though OpenMath seems to suport a namespace mechanism they call "CD"s for some reason)
Then, as you suggest, OpenMath could be an excellent solution to interface R. However, R being a statistical package there are few needs in representing complex mathematical notation. Even, R uses its own notation for statistical models (formulas). I wonder if and how this could be easily and automatically translated in a more traditional mathematical notation,... and even if this would be desirable?!
There's no function for MLPutFunction, rather they use a more open ended mechanism (OMputApp,OMputSymbol,...,OMputEndApp) eliminating the need to send an argument count. This is slightly more difficult to serialize. There are also other elements for sending richer structures (to simulate MathLink arrays and whatnot) via OMputObject and OMputEndObject. This makes it pretty easy to build lists and arrays. You can also send opaque byte objects much like MathLink.
The API has mechanisms for socket transfer (*NIX,Win32) and *NIX sockets (*NIX only, of course) with either binary or "XML" serialization (though it doesn't produce a document that conforms to the XML standard... it just happens to use an XML-like structure that you could stick into an XML document)
Do you intend to initiate a project for making an OpenMath interface for R? If yes, I would like to take part of it, and ultimately include these features to the SciViews R plug.
Admittedly, the website and most of the papers seem to talk about these complex server set ups where various servers offer a variety of services dispatched through a hub of some sort, but the reality of the situation is the API is basically a MathLink clone (which is fine, since it was exactly what I expected it to be :-))
I have looked a little closer to it, and indeed yes, it is closer to
MathLink as it looks like when you first browse their web site.
Best Regards,
Philippe Grosjean
...........]<(({?<...............<?}))><...............................
) ) ) ) )
( ( ( ( ( Dr. Philippe Grosjean
) ) ) ) )
( ( ( ( ( LOV, UMR 7093
) ) ) ) ) Station Zoologique
( ( ( ( ( Observatoire Oceanologique
) ) ) ) ) BP 28
( ( ( ( ( 06234 Villefranche sur mer cedex
) ) ) ) ) France
( ( ( ( (
) ) ) ) ) tel: +33.4.93.76.38.18, fax: +33.4.93.76.38.34
( ( ( ( (
) ) ) ) ) e-mail: phgrosjean@sciviews.org
( ( ( ( ( SciViews project coordinator (http://www.sciviews.org)
) ) ) ) )
.......................................................................