jlindsey@alpha.luc.ac.be
2000-May-22 14:13 UTC
[Rd] character arguments with call_R (PR#552)
character arguments with call_R do not work except in the first position. (In other positions, they just yield a single blank character.) The error is at line 1858 of dotcode.c which should be changed from STRING(CAR(pcall))[i]=s; to STRING(CAR(pcall))[0]=s; Jim -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> From: jlindsey@alpha.luc.ac.be > Date: Mon, 22 May 2000 16:13:34 +0200 (MET DST) > To: r-devel@stat.math.ethz.ch > Subject: [Rd] character arguments with call_R (PR#552) > CC: R-bugs@biostat.ku.dk > X-Loop: R-bugs@biostat.ku.dk > > character arguments with call_R do not work except in the first > position. (In other positions, they just yield a single blank > character.) > The error is at line 1858 of dotcode.c which should be changed from > STRING(CAR(pcall))[i]=s; > to > STRING(CAR(pcall))[0]=s; > JimIt's much worse than that, as this happens n times inside a loop. It looks to me as if the code has fairly thoroughly confused character strings and character vectors. I suspect it should be more like for (j = 0 ; j < n ; j++) { s = allocSExp(CHARSXP); CHAR(s) = ((char**)(arguments[i]))[j]; LENGTH(s) = strlen(CHAR(s)); STRING(CAR(pcall))[j] = s; } or, more consisely for (j = 0 ; j < n ; j++) { cptr = (char**)arguments[i] STRING(CAR(pcall))[j] = mkChar(cptr[j]) } Do you have a succinct example on which we could test out solutions? -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Possibly Parallel Threads
- Qs on calling R from C
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?