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
        integer    int *       integer
        numeric    double *    double precision
        - or -     float *     real
        complex    Rcomplex *  double complex
        logical    int *       integer
        character  char **     [see below]
        list       SEXP *      not allowed
        other      SEXP        not 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.c    2004-09-05 02:31:57.000000000 -0700
> +++ /usr/local/src/R-2.0.0/src/main/dotcode.c    2005-05-11
> 12:24:11.000000000 -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, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to