Re: [Rd] Question on parsing R code from C

2011-11-16 Thread Simon Urbanek
On Nov 16, 2011, at 2:48 PM, KR wrote: > Simon Urbanek r-project.org> writes: >> Not without seeing the actual code. (And details such as which platform >> you're > on). >> Note that setup_Rmainloop() is the last to set the SETJMP context target so > you should make sure the stack is >> still

Re: [Rd] Question on parsing R code from C

2011-11-16 Thread KR
Simon Urbanek r-project.org> writes: > Not without seeing the actual code. (And details such as which platform > you're on). > Note that setup_Rmainloop() is the last to set the SETJMP context target so you should make sure the stack is > still present after it finished (i.e. you can't call it

Re: [Rd] Question on parsing R code from C

2011-11-15 Thread Simon Urbanek
On Nov 15, 2011, at 5:39 PM, KR wrote: > Simon Urbanek r-project.org> writes: >> AFAIR you have to evaluate parse(text=...) for that, there is no C-level > access to parser errors. > > Yes that did it, thanks! > >> If you get a crash, you're not setting up you R correctly. If your R quits >

Re: [Rd] Question on parsing R code from C

2011-11-15 Thread KR
Simon Urbanek r-project.org> writes: > AFAIR you have to evaluate parse(text=...) for that, there is no C-level access to parser errors. Yes that did it, thanks! > If you get a crash, you're not setting up you R correctly. If your R quits then you are in non-interactive mode > and you didn't

Re: [Rd] Question on parsing R code from C

2011-11-11 Thread Simon Urbanek
On Nov 11, 2011, at 10:08 AM, Simon Urbanek wrote: > > On Nov 10, 2011, at 6:24 PM, KR wrote: > >> First of all thanks a lot to you both for all the replies, they have been of >> great help to me! >> >> I got the basic embedding running, however I still have some issues to solve >> in >> or

Re: [Rd] Question on parsing R code from C

2011-11-11 Thread Simon Urbanek
On Nov 10, 2011, at 6:24 PM, KR wrote: > First of all thanks a lot to you both for all the replies, they have been of > great help to me! > > I got the basic embedding running, however I still have some issues to solve > in > order to complete the interface to R I am working on: > > 1. I ini

Re: [Rd] Question on parsing R code from C

2011-11-11 Thread KR
First of all thanks a lot to you both for all the replies, they have been of great help to me! I got the basic embedding running, however I still have some issues to solve in order to complete the interface to R I am working on: 1. I initialize with Rf_initEmbeddR(). - Is there a way to have mo

Re: [Rd] Question on parsing R code from C

2011-11-08 Thread Simon Urbanek
On Nov 8, 2011, at 6:53 PM, KR wrote: > Simon Urbanek r-project.org> writes: >> Except that you don't know what are macros, inlined functions and actual > functions. If you are careful you >> can possibly fall back to external functions but, obviously, your code will >> be > less efficient. I

Re: [Rd] Question on parsing R code from C

2011-11-08 Thread Rob Anderson
Hi, With respect to initializing R state and parsing, you might want to look at the "Linking GUI's and other front-ends to R" section in Writing R Extensions . Once the initialization is done, you can use mkString() function to get an input SEXP f

Re: [Rd] Question on parsing R code from C

2011-11-08 Thread KR
Simon Urbanek r-project.org> writes: > Except that you don't know what are macros, inlined functions and actual functions. If you are careful you > can possibly fall back to external functions but, obviously, your code will > be less efficient. I would > still prefer including Rinternals.h - yo

Re: [Rd] Question on parsing R code from C

2011-11-08 Thread Simon Urbanek
On Nov 8, 2011, at 4:57 PM, KR wrote: > Simon Urbanek 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'l

Re: [Rd] Question on parsing R code from C

2011-11-08 Thread KR
Simon Urbanek 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 th

Re: [Rd] Question on parsing R code from C

2011-11-08 Thread Simon Urbanek
On Nov 8, 2011, at 2:42 PM, KR wrote: > Hi all, > > I am facing the necessity to parse R code from C-side. As a first > approximation > the goal would be a re-implementation of the R shell (not Rgui). > > I read the document at http://cran.r-project.org/doc/manuals/R-exts.html > section > 5

[Rd] Question on parsing R code from C

2011-11-08 Thread KR
Hi all, I am facing the necessity to parse R code from C-side. As a first approximation the goal would be a re-implementation of the R shell (not Rgui). I read the document at http://cran.r-project.org/doc/manuals/R-exts.html section 5.12, and the related source code example. I have some que