Thank you for the patch.
To clarify: this is not a bug. ?.C says
The mapping of the types of R arguments to C or Fortran arguments
in '.C' or '.Fortran' is
R C Fortran
integerint * integer
numericdouble *double precision
- or - float * real
complexRcomplex * double complex
logicalint * integer
character char ** [see below]
list SEXP * not allowed
other SEXPnot allowed
and `raw' is in the `other' category. So this would be a change in
behaviour and needs some changes to the documentation. We will do that
for 2.2.0.
Two hints (more for R-devel than just you).
1) Please provide a patch against the current sources, not 2.0.0. (it
worked, with a bit of fiddling).
2) Please _attach_ patches, as your mailer wrapped this one.
On Thu, 12 May 2005 [EMAIL PROTECTED] wrote:
--- dotcode.c2004-09-05 02:31:57.0 -0700
+++ /usr/local/src/R-2.0.0/src/main/dotcode.c2005-05-11
12:24:11.0 -0700
@@ -190,6 +190,7 @@
static void *RObjToCPtr(SEXP s, int naok, int dup, int narg, int Fort,
const char *name, R_toCConverter **converter,
int targetType)
{
+unsigned char *rawptr;
int *iptr;
float *sptr;
double *rptr;
@@ -228,6 +229,16 @@
}
switch(TYPEOF(s)) {
+case RAWSXP:
+n = LENGTH(s);
+rawptr = RAW(s);
+if (dup) {
+rawptr = (unsigned char *) R_alloc(n, sizeof(unsigned char));
+for (i = 0; i n; i++)
+rawptr[i] = RAW(s)[i];
+}
+return (void *) rawptr;
+break;
case LGLSXP:
case INTSXP:
n = LENGTH(s);
@@ -329,6 +340,7 @@
static SEXP CPtrToRObj(void *p, SEXP arg, int Fort,
R_NativePrimitiveArgType type)
{
+unsigned char *rawptr;
int *iptr, n=length(arg);
float *sptr;
double *rptr;
@@ -339,6 +351,12 @@
SEXP s, t;
switch(type) {
+case RAWSXP:
+s = allocVector(type, n);
+rawptr = (unsigned char *)p;
+for (i = 0; i n; i++)
+RAW(s)[i] = rawptr[i];
+break;
case LGLSXP:
case INTSXP:
s = allocVector(type, n);
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
--
Brian D. Ripley, [EMAIL PROTECTED]
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 272866 (PA)
Oxford OX1 3TG, UKFax: +44 1865 272595
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel