Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Herve Pages
Peter Dalgaard wrote: > Herve Pages wrote: [...] >> So everybody seems to assume that SET_ELEMENT(), SET_STRING_ELT(), >> SET_NAMES(), etc... can't (and will never) trigger garbage collection. >> But what about defineVar()? More generally, how do I know this for the >> functions/macros listed in Rd

Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Peter Dalgaard
Herve Pages wrote: > Peter Dalgaard wrote: >> >> That's not the problem you raised (argument evaluation order), but >> there's a CONS inside defineVar, and as far as I can see, it doesn't >> protect its arguments, so you could well be right. >> > > This problem is related to my original proble

Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Herve Pages
Peter Dalgaard wrote: > Herve Pages wrote: >> Hi Peter, >> >> Peter Dalgaard wrote: >> >>> Herve Pages wrote: >>> Hi, I'm wondering if this code from the "Writing R Extensions" manual is really safe: SEXP mkans(double x) { SEXP ans;

[Rd] Just-in-time compiler for R

2008-01-16 Thread Stephen Milborrow
Greetings R developers! I have been working on a just-in-time compiler for R arithmetic expressions. An example: jit(1) # turn on just-in-time compilation for(i in 1:na)# example convolution code for(j in 1:nb) ab[i + j] <- ab[i + j] +

Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Peter Dalgaard
Luke Tierney wrote: > On Wed, 16 Jan 2008, Peter Dalgaard wrote: > >> Herve Pages wrote: >> Hi Peter, >> >> Peter Dalgaard wrote: >> >>> Herve Pages wrote: >>> Hi, I'm wondering if this code from the "Writing R Extensions" manual is really safe: SEXP mkans(double

Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Luke Tierney
On Wed, 16 Jan 2008, Peter Dalgaard wrote: Herve Pages wrote: Hi Peter, Peter Dalgaard wrote: Herve Pages wrote: Hi, I'm wondering if this code from the "Writing R Extensions" manual is really safe: SEXP mkans(double x) { SEXP ans; PROTECT(ans = allocVector(REA

Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Peter Dalgaard
Herve Pages wrote: > Hi Peter, > > Peter Dalgaard wrote: > >> Herve Pages wrote: >> >>> Hi, >>> >>> I'm wondering if this code from the "Writing R Extensions" manual >>> is really safe: >>> >>> SEXP mkans(double x) >>> { >>> SEXP ans; >>> PROTECT(ans = allocVecto

Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Herve Pages
Hi Peter, Peter Dalgaard wrote: > Herve Pages wrote: >> Hi, >> >> I'm wondering if this code from the "Writing R Extensions" manual >> is really safe: >> >> SEXP mkans(double x) >> { >> SEXP ans; >> PROTECT(ans = allocVector(REALSXP, 1)); >> REAL(ans)[0] = x; >

Re: [Rd] data types / numerative system

2008-01-16 Thread Prof Brian Ripley
On Wed, 16 Jan 2008, Duncan Murdoch wrote: > On 1/16/2008 10:30 AM, [EMAIL PROTECTED] wrote: >> hello all, >> >> well it is a general question, surely this is written somewhere but I cannot >> find it. >> where is the full list of 'shortcuts' for numerative systems? >> (so 0x123 : hex, 123L : dec

Re: [Rd] data types / numerative system

2008-01-16 Thread Duncan Murdoch
On 1/16/2008 10:30 AM, [EMAIL PROTECTED] wrote: > hello all, > > well it is a general question, surely this is written somewhere but I cannot > find it. > where is the full list of 'shortcuts' for numerative systems? > (so 0x123 : hex, 123L : dec(?... or is it for a... long datatype?)) > are ther

[Rd] data types / numerative system

2008-01-16 Thread AlexanderP
hello all, well it is a general question, surely this is written somewhere but I cannot find it. where is the full list of 'shortcuts' for numerative systems? (so 0x123 : hex, 123L : dec(?... or is it for a... long datatype?)) are there in R 'shortcuts' for data types? thanks, Alex -- Ist Ihr B

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-16 Thread Prof Brian Ripley
On Wed, 16 Jan 2008, Richard Cotton wrote: > > > > Prof Brian Ripley wrote: >> >>> Yes. The problem is of course that we do want a sprintf() format there >>> for "Rplot%03d.pdf" et al. One option would be to escape "%" except >>> when in (regexp) "%[0-9]*d", which seems nontrivial, but not imposs

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-16 Thread Peter Dalgaard
Richard Cotton wrote: > > Prof Brian Ripley wrote: > >>> Yes. The problem is of course that we do want a sprintf() format there >>> for "Rplot%03d.pdf" et al. One option would be to escape "%" except >>> when in (regexp) "%[0-9]*d", which seems nontrivial, but not impossible. >>> >> But

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-16 Thread Richard Cotton
Prof Brian Ripley wrote: > >> Yes. The problem is of course that we do want a sprintf() format there >> for "Rplot%03d.pdf" et al. One option would be to escape "%" except >> when in (regexp) "%[0-9]*d", which seems nontrivial, but not impossible. > > But there are other integer formats (%i,

Re: [Rd] Pb with defineVar() example in the "Writing R Extensions" manual

2008-01-16 Thread Peter Dalgaard
Herve Pages wrote: > Hi, > > I'm wondering if this code from the "Writing R Extensions" manual > is really safe: > > SEXP mkans(double x) > { > SEXP ans; > PROTECT(ans = allocVector(REALSXP, 1)); > REAL(ans)[0] = x; > UNPROTECT(1); > return ans