From hin-tak.leung at cimr.cam.ac.uk  Fri Jan 27 15:49:45 2006
From: hin-tak.leung at cimr.cam.ac.uk (Hin-Tak Leung)
Date: Fri, 27 Jan 2006 14:49:45 +0000
Subject: [Rd] sub* assgnment unimplemented for raw (RAWSXP) types.
	(PR#8530)
In-Reply-To: <20060127143352.736A2103DC@slim.kubism.ku.dk>
References: <20060127143352.736A2103DC@slim.kubism.ku.dk>
Message-ID: <43DA3309.50903@cimr.cam.ac.uk>

hin-tak.leung at cimr.cam.ac.uk wrote:
> Full_Name: Hin-Tak Leung
> Version: R 2.2.1
> OS: x86_64-redhat-linux-gnu
> Submission from: (NULL) (131.111.186.92)
> 
> 
> Matrix subset assignment and [[<- assignment
> are unimplemented for raw (RAWSXP) types.
> 
> I have a working patch implementing the functionality,
> to follow.

Same thing, sorry for two bug reports and two patches related
to RAWSXP, but they are independent issues.

Attached in ready-to-patch form and also insert (white spaces
will go wrong) here. Please review, comment and possibly commit,
and hope to see it in R 2.3.x.

======================
--- src/main/subassign.c.orig   2005-12-05 23:00:17.000000000 +0000
+++ src/main/subassign.c        2006-01-27 12:50:47.000000000 +0000
@@ -868,6 +868,23 @@
             }
         }
         break;
+    case 2424: /* raw   <- raw   */
+
+       for (j = 0; j < ncs; j++) {
+           jj = INTEGER(sc)[j];
+           if (jj == NA_INTEGER) continue;
+           jj = jj - 1;
+           for (i = 0; i < nrs; i++) {
+               ii = INTEGER(sr)[i];
+               if (ii == NA_INTEGER) continue;
+               ii = ii - 1;
+               ij = ii + jj * nr;
+               RAW(x)[ij] = RAW(y)[k];
+               k = (k + 1) % ny;
+           }
+       }
+       break;
+
      default:
         error(_("incompatible types (case %d) in matrix subset 
assignment"),
               which);
@@ -1611,6 +1628,11 @@
             SET_VECTOR_ELT(x, offset, y);
             break;

+       case 2424:      /* raw <- raw */
+
+           RAW(x)[offset] = RAW(y)[0];
+           break;
+
         default:
             error(_("incompatible types (%d) in [[ assignment"), which);
         }
===========================


[Rd] sub* assgnment unimplemented for raw (RAWSXP) types. (PR#8530)
Hin-Tak Leung