Bug 8530

Summary: sub* assgnment unimplemented for raw (RAWSXP) types.
Product: R Reporter: Jitterbug compatibility account <jitterbug-import>
Component: Low-levelAssignee: Jitterbug compatibility account <jitterbug-import>
Status: CLOSED FIXED    
Severity: normal    
Priority: P5    
Version: old   
Hardware: All   
OS: Linux-Fedora   
Attachments:

Description Jitterbug compatibility account 2006-01-27 20:33:50 UTC
From: hin-tak.leung@cimr.cam.ac.uk
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.

--please do not edit the information below--

Version:
 platform = x86_64-redhat-linux-gnu
 arch = x86_64
 os = linux-gnu
 system = x86_64, linux-gnu
 status =
 major = 2
 minor = 2.1
 year = 2005
 month = 12
 day = 20
 svn rev = 36812
 language = R

Locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C

Search Path:
 .GlobalEnv, package:methods, package:stats, package:graphics,
package:grDevices, package:utils, package:datasets, Autoloads, package:base

Comment 1 Jitterbug compatibility account 2006-01-27 20:49:45 UTC
From: Hin-Tak Leung <hin-tak.leung@cimr.cam.ac.uk>
PARTS: 2
hin-tak.leung@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);
         }
===========================

(Attached 'subassign-rawsxp.patch' of type 'text/x-patch')

**END
Comment 2 Jitterbug compatibility account 2006-01-27 20:49:45 UTC
Created attachment 992 [details]
Comment 3 Jitterbug compatibility account 2006-01-28 16:43:00 UTC
NOTES:
 patch incorporated in 2.3.0
Comment 4 Jitterbug compatibility account 2006-01-28 16:43:49 UTC
Audit (from Jitterbug):
Sat Jan 28 11:43:15 2006	ripley	changed notes
Sat Jan 28 10:43:49 2006	ripley	moved from incoming to Low-level-fixed