From krunal.rao78 at gmail.com  Tue Nov  8 22:57:01 2011
From: krunal.rao78 at gmail.com (KR)
Date: Tue, 8 Nov 2011 21:57:01 +0000
Subject: [Rd] Question on parsing R code from C
References: <loom.20111108T203022-872@post.gmane.org>
	<9465BE63-EA88-4BE2-8D1C-9E33BE8AA45D@r-project.org>
Message-ID: <loom.20111108T224700-655@post.gmane.org>

Simon Urbanek <simon.urbanek <at> r-project.org> writes:
> I'm not sure I understand this really - it doesn't define SEXP. I would expect 
something like
> 
> typedef void *SEXP;
> 
> Which may work for declarations. Note, however, that for the actual code 
you'll need to include the headers anyway.

Thanks for the prompt reply!

It's my understanding that using opaque pointers to hide implementation is fine 
(as long as they are not de-referenced nor the size of the actual struct is 
needed). I actually come out with the tentative typedef by looking at the 
sources, but I got confused by some conditional pre-processor directives so I 
was searching for confirmation.

For the actual code I can just declare the types (even opaques depending on the 
use) and function signatures that I strictly need by hand as long as I am doing 
it correctly (after all that's what is inside the headers, among with the stuff 
I don't need).

> http://r.research.att.com/man/R-exts.html is the documentation and the headers 
(Rinternals.h
> mainly) is the canonical reference.

Understood, thanks.

> > 2. If the parsed R code of the working implementation contain commands like 
> > plot(), will the opportune windows pop-up as if I were using the R shell (on 
> > both windows and unix systems) ?
> > 
> 
> It depends on your settings - plot() uses whatever graphics device you tell it 
to use, so plot() doesn't
> decide about that. If you use the proper interactive graphics device *and* 
make sure you're serving the
> REPL then it may work. Beware of interactions with your other parts, though, 
since you are responsible for
> ensuring that it works. 

I admit I am quite lost here, is there any code I can look at for examples? :P

> BTW: you subject has absolutely nothing to do with your question - your'e 
asking about embedding R ;)

Hmmmm I may be excused because I copy and pasted the title of section 5.12 
(which seemed most relevant for what I wanted to achieve) :-)


Cheers



[Rd] Question on parsing R code from C
KR