diff -Nru r-bioc-xvector-0.22.0/debian/changelog r-bioc-xvector-0.24.0/debian/changelog --- r-bioc-xvector-0.22.0/debian/changelog 2018-11-08 21:23:38.000000000 +0000 +++ r-bioc-xvector-0.24.0/debian/changelog 2019-07-03 12:52:16.000000000 +0000 @@ -1,3 +1,15 @@ +r-bioc-xvector (0.24.0-1) unstable; urgency=medium + + [ Dylan Aïssi ] + * Remove patch and use r-bioc-zlibbioc. + + [ Andreas Tille ] + * New upstream version + * debhelper 12 + * Standards-Version: 4.3.0 + + -- Andreas Tille Wed, 03 Jul 2019 14:52:16 +0200 + r-bioc-xvector (0.22.0-1) unstable; urgency=medium * Team upload. diff -Nru r-bioc-xvector-0.22.0/debian/compat r-bioc-xvector-0.24.0/debian/compat --- r-bioc-xvector-0.22.0/debian/compat 2018-11-08 21:23:38.000000000 +0000 +++ r-bioc-xvector-0.24.0/debian/compat 2019-07-03 12:52:16.000000000 +0000 @@ -1 +1 @@ -11 +12 diff -Nru r-bioc-xvector-0.22.0/debian/control r-bioc-xvector-0.24.0/debian/control --- r-bioc-xvector-0.22.0/debian/control 2018-11-08 21:23:38.000000000 +0000 +++ r-bioc-xvector-0.24.0/debian/control 2019-07-03 12:52:16.000000000 +0000 @@ -3,13 +3,14 @@ Uploaders: Andreas Tille Section: gnu-r Priority: optional -Build-Depends: debhelper (>= 11~), +Build-Depends: debhelper (>= 12~), dh-r, r-base-dev, r-bioc-biocgenerics (>= 0.19.2), - r-bioc-s4vectors (>= 0.19.15), - r-bioc-iranges (>= 2.15.12) -Standards-Version: 4.2.1 + r-bioc-s4vectors (>= 0.21.13), + r-bioc-iranges (>= 2.15.12), + r-bioc-zlibbioc +Standards-Version: 4.3.0 Vcs-Browser: https://salsa.debian.org/r-pkg-team/r-bioc-xvector Vcs-Git: https://salsa.debian.org/r-pkg-team/r-bioc-xvector.git Homepage: https://bioconductor.org/packages/XVector/ diff -Nru r-bioc-xvector-0.22.0/debian/patches/series r-bioc-xvector-0.24.0/debian/patches/series --- r-bioc-xvector-0.22.0/debian/patches/series 2018-11-08 21:23:38.000000000 +0000 +++ r-bioc-xvector-0.24.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -use_debian_packaged_zlib.patch diff -Nru r-bioc-xvector-0.22.0/debian/patches/use_debian_packaged_zlib.patch r-bioc-xvector-0.24.0/debian/patches/use_debian_packaged_zlib.patch --- r-bioc-xvector-0.22.0/debian/patches/use_debian_packaged_zlib.patch 2018-11-08 21:23:38.000000000 +0000 +++ r-bioc-xvector-0.24.0/debian/patches/use_debian_packaged_zlib.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -Author: Andreas Tille -LastChanged: Thu, 29 Oct 2015 22:45:15 +0100 -Description: If the systems includes zlib natively there is no point in - requiring the import of zlibbioc - ---- a/DESCRIPTION -+++ b/DESCRIPTION -@@ -9,7 +9,7 @@ - biocViews: Infrastructure, DataRepresentation - Depends: R (>= 2.8.0), methods, BiocGenerics (>= 0.19.2), S4Vectors (>= - 0.19.15), IRanges (>= 2.15.12) --Imports: methods, utils, zlibbioc, BiocGenerics, S4Vectors, IRanges -+Imports: methods, utils, BiocGenerics, S4Vectors, IRanges - LinkingTo: S4Vectors, IRanges - Suggests: Biostrings, drosophila2probe, RUnit - License: Artistic-2.0 ---- a/NAMESPACE -+++ b/NAMESPACE -@@ -2,7 +2,6 @@ - - import(methods) - importFrom(utils, download.file) --import(zlibbioc) - import(BiocGenerics) - import(S4Vectors) - import(IRanges) diff -Nru r-bioc-xvector-0.22.0/DESCRIPTION r-bioc-xvector-0.24.0/DESCRIPTION --- r-bioc-xvector-0.22.0/DESCRIPTION 2018-10-30 23:52:16.000000000 +0000 +++ r-bioc-xvector-0.24.0/DESCRIPTION 2019-05-03 00:42:35.000000000 +0000 @@ -1,14 +1,15 @@ Package: XVector -Title: Representation and manipulation of external sequences -Description: Memory efficient S4 classes for storing sequences "externally" - (behind an R external pointer, or on disk). -Version: 0.22.0 +Title: Foundation of external vector representation and manipulation in + Bioconductor +Description: Provides memory efficient S4 classes for storing sequences + "externally" (e.g. behind an R external pointer, or on disk). +Version: 0.24.0 Encoding: UTF-8 Author: Hervé Pagès and Patrick Aboyoun Maintainer: Hervé Pagès biocViews: Infrastructure, DataRepresentation Depends: R (>= 2.8.0), methods, BiocGenerics (>= 0.19.2), S4Vectors (>= - 0.19.15), IRanges (>= 2.15.12) + 0.21.13), IRanges (>= 2.15.12) Imports: methods, utils, zlibbioc, BiocGenerics, S4Vectors, IRanges LinkingTo: S4Vectors, IRanges Suggests: Biostrings, drosophila2probe, RUnit @@ -22,9 +23,9 @@ reverse-methods.R slice-methods.R view-summarization-methods.R updateObject-methods.R zzz.R git_url: https://git.bioconductor.org/packages/XVector -git_branch: RELEASE_3_8 -git_last_commit: b5e107a -git_last_commit_date: 2018-10-30 -Date/Publication: 2018-10-30 +git_branch: RELEASE_3_9 +git_last_commit: e5109cb +git_last_commit_date: 2019-05-02 +Date/Publication: 2019-05-02 NeedsCompilation: yes -Packaged: 2018-10-30 23:52:16 UTC; biocbuild +Packaged: 2019-05-03 00:42:35 UTC; biocbuild diff -Nru r-bioc-xvector-0.22.0/inst/include/XVector_interface.h r-bioc-xvector-0.24.0/inst/include/XVector_interface.h --- r-bioc-xvector-0.22.0/inst/include/XVector_interface.h 2018-10-30 19:41:27.000000000 +0000 +++ r-bioc-xvector-0.24.0/inst/include/XVector_interface.h 2019-05-02 21:00:35.000000000 +0000 @@ -198,23 +198,38 @@ SEXP get_XVector_tag(SEXP x); +SEXP new_XVector(const char *classname, SEXP shared, int offset, int length); + +/* + * Low-level manipulation of XRaw objects. + * (see XRaw_class.c) + */ + Chars_holder hold_XRaw(SEXP x); -Ints_holder hold_XInteger(SEXP x); +SEXP new_XRaw_from_tag(const char *classname, SEXP tag); -Doubles_holder hold_XDouble(SEXP x); +SEXP alloc_XRaw(const char *classname, int length); -SEXP new_XVector(const char *classname, SEXP shared, int offset, int length); +/* + * Low-level manipulation of XInteger objects. + * (see XInteger_class.c) + */ -SEXP new_XRaw_from_tag(const char *classname, SEXP tag); +Ints_holder hold_XInteger(SEXP x); SEXP new_XInteger_from_tag(const char *classname, SEXP tag); -SEXP new_XDouble_from_tag(const char *classname, SEXP tag); +SEXP alloc_XInteger(const char *classname, int length); -SEXP alloc_XRaw(const char *classname, int length); +/* + * Low-level manipulation of XDouble objects. + * (see XDouble_class.c) + */ -SEXP alloc_XInteger(const char *classname, int length); +Doubles_holder hold_XDouble(SEXP x); + +SEXP new_XDouble_from_tag(const char *classname, SEXP tag); SEXP alloc_XDouble(const char *classname, int length); diff -Nru r-bioc-xvector-0.22.0/inst/include/_XVector_stubs.c r-bioc-xvector-0.24.0/inst/include/_XVector_stubs.c --- r-bioc-xvector-0.22.0/inst/include/_XVector_stubs.c 2018-10-30 19:41:27.000000000 +0000 +++ r-bioc-xvector-0.24.0/inst/include/_XVector_stubs.c 2019-05-02 21:00:35.000000000 +0000 @@ -173,49 +173,61 @@ ( x) ) -DEFINE_CCALLABLE_STUB(Chars_holder, hold_XRaw, - (SEXP x), - ( x) +DEFINE_CCALLABLE_STUB(SEXP, new_XVector, + (const char *classname, SEXP shared, int offset, int length), + ( classname, shared, offset, length) ) -DEFINE_CCALLABLE_STUB(Ints_holder, hold_XInteger, - (SEXP x), - ( x) -) +/* + * Stubs for callables defined in XRaw_class.c + */ -DEFINE_CCALLABLE_STUB(Doubles_holder, hold_XDouble, +DEFINE_CCALLABLE_STUB(Chars_holder, hold_XRaw, (SEXP x), ( x) ) -DEFINE_CCALLABLE_STUB(SEXP, new_XVector, - (const char *classname, SEXP shared, int offset, int length), - ( classname, shared, offset, length) -) - DEFINE_CCALLABLE_STUB(SEXP, new_XRaw_from_tag, (const char *classname, SEXP tag), ( classname, tag) ) -DEFINE_CCALLABLE_STUB(SEXP, new_XInteger_from_tag, - (const char *classname, SEXP tag), - ( classname, tag) +DEFINE_CCALLABLE_STUB(SEXP, alloc_XRaw, + (const char *classname, int length), + ( classname, length) ) -DEFINE_CCALLABLE_STUB(SEXP, new_XDouble_from_tag, +/* + * Stubs for callables defined in XInteger_class.c + */ + +DEFINE_CCALLABLE_STUB(Ints_holder, hold_XInteger, + (SEXP x), + ( x) +) + +DEFINE_CCALLABLE_STUB(SEXP, new_XInteger_from_tag, (const char *classname, SEXP tag), ( classname, tag) ) -DEFINE_CCALLABLE_STUB(SEXP, alloc_XRaw, +DEFINE_CCALLABLE_STUB(SEXP, alloc_XInteger, (const char *classname, int length), ( classname, length) ) -DEFINE_CCALLABLE_STUB(SEXP, alloc_XInteger, - (const char *classname, int length), - ( classname, length) +/* + * Stubs for callables defined in XDouble_class.c + */ + +DEFINE_CCALLABLE_STUB(Doubles_holder, hold_XDouble, + (SEXP x), + ( x) +) + +DEFINE_CCALLABLE_STUB(SEXP, new_XDouble_from_tag, + (const char *classname, SEXP tag), + ( classname, tag) ) DEFINE_CCALLABLE_STUB(SEXP, alloc_XDouble, diff -Nru r-bioc-xvector-0.22.0/R/SharedDouble-class.R r-bioc-xvector-0.24.0/R/SharedDouble-class.R --- r-bioc-xvector-0.22.0/R/SharedDouble-class.R 2018-10-30 19:41:27.000000000 +0000 +++ r-bioc-xvector-0.24.0/R/SharedDouble-class.R 2019-05-02 21:00:35.000000000 +0000 @@ -1,99 +1,99 @@ -### ========================================================================= -### SharedDouble objects -### ------------------------------------------------------------------------- -### -### A SharedDouble object is an external pointer to an ordinary double -### vector. -### - -setClass("SharedDouble", contains="SharedVector") - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Initialization. -### -### Note that, unlike 'numeric(99)', 'SharedDouble(99)' does NOT initialize its -### data. Specify the 'val' argument if you want data initialization. -### - -SharedDouble <- function(length=0L, val=NULL) -{ - if (!isSingleNumber(length) || length < 0) - stop("'length' must be a single non-negative integer") - if (!is.integer(length)) - length <- as.integer(length) - if (!is.null(val)) { - if (!is.numeric(val)) - stop("'val' must be a numeric vector") - if (!storage.mode(val) == "double") - storage.mode(val) <- "double" - } - .Call2("SharedDouble_new", length, val, PACKAGE="XVector") -} - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Validity. -### - -.valid.SharedDouble <- function(x) -{ - if (!tagIsVector(x@xp, tagtype="double")) - return(problemIfNotExternalVector("'x@xp'", - tagmustbe="a double vector")) - NULL -} - -setValidity2("SharedDouble", .valid.SharedDouble) - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Read/write functions. -### These are almost safe wrappers to unsafe C functions ("almost" because -### they don't check for NAs in their arguments). -### If length(i) == 0 then the read functions return an empty vector -### and the write functions don't do anything. -### - -SharedDouble.read <- function(x, i, imax=integer(0)) -{ - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - .Call2("SharedDouble_read_nums_from_i1i2", x, i, imax, PACKAGE="XVector") - } else { - .Call2("SharedDouble_read_nums_from_subscript", x, i, PACKAGE="XVector") - } -} - -SharedDouble.write <- function(x, i, imax=integer(0), value) -{ - if (!is.numeric(value)) - stop("'value' must be a numeric vector") - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - .Call2("SharedDouble_write_nums_to_i1i2", x, i, imax, value, PACKAGE="XVector") - } else { - .Call2("SharedDouble_write_nums_to_subscript", x, i, value, PACKAGE="XVector") - } - x -} - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Coercion. -### - -setMethod("as.numeric", "SharedDouble", - function(x, ...) SharedDouble.read(x, 1L, length(x)) -) - +### ========================================================================= +### SharedDouble objects +### ------------------------------------------------------------------------- +### +### A SharedDouble object is an external pointer to an ordinary double +### vector. +### + +setClass("SharedDouble", contains="SharedVector") + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Initialization. +### +### Note that, unlike 'numeric(99)', 'SharedDouble(99)' does NOT initialize its +### data. Specify the 'val' argument if you want data initialization. +### + +SharedDouble <- function(length=0L, val=NULL) +{ + if (!isSingleNumber(length) || length < 0) + stop("'length' must be a single non-negative integer") + if (!is.integer(length)) + length <- as.integer(length) + if (!is.null(val)) { + if (!is.numeric(val)) + stop("'val' must be a numeric vector") + if (!storage.mode(val) == "double") + storage.mode(val) <- "double" + } + .Call2("SharedDouble_new", length, val, PACKAGE="XVector") +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Validity. +### + +.valid.SharedDouble <- function(x) +{ + if (!tagIsVector(x@xp, tagtype="double")) + return(problemIfNotExternalVector("'x@xp'", + tagmustbe="a double vector")) + NULL +} + +setValidity2("SharedDouble", .valid.SharedDouble) + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Read/write functions. +### These are almost safe wrappers to unsafe C functions ("almost" because +### they don't check for NAs in their arguments). +### If length(i) == 0 then the read functions return an empty vector +### and the write functions don't do anything. +### + +SharedDouble.read <- function(x, i, imax=integer(0)) +{ + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + .Call2("SharedDouble_read_nums_from_i1i2", x, i, imax, PACKAGE="XVector") + } else { + .Call2("SharedDouble_read_nums_from_subscript", x, i, PACKAGE="XVector") + } +} + +SharedDouble.write <- function(x, i, imax=integer(0), value) +{ + if (!is.numeric(value)) + stop("'value' must be a numeric vector") + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + .Call2("SharedDouble_write_nums_to_i1i2", x, i, imax, value, PACKAGE="XVector") + } else { + .Call2("SharedDouble_write_nums_to_subscript", x, i, value, PACKAGE="XVector") + } + x +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Coercion. +### + +setMethod("as.numeric", "SharedDouble", + function(x, ...) SharedDouble.read(x, 1L, length(x)) +) + diff -Nru r-bioc-xvector-0.22.0/R/SharedInteger-class.R r-bioc-xvector-0.24.0/R/SharedInteger-class.R --- r-bioc-xvector-0.22.0/R/SharedInteger-class.R 2018-10-30 19:41:27.000000000 +0000 +++ r-bioc-xvector-0.24.0/R/SharedInteger-class.R 2019-05-02 21:00:35.000000000 +0000 @@ -1,99 +1,99 @@ -### ========================================================================= -### SharedInteger objects -### ------------------------------------------------------------------------- -### -### A SharedInteger object is an external pointer to an ordinary integer -### vector. -### - -setClass("SharedInteger", contains="SharedVector") - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Initialization. -### -### Note that, unlike 'integer(99)', 'SharedInteger(99)' does NOT initialize its -### data. Specify the 'val' argument if you want data initialization. -### - -SharedInteger <- function(length=0L, val=NULL) -{ - if (!isSingleNumber(length) || length < 0) - stop("'length' must be a single non-negative integer") - if (!is.integer(length)) - length <- as.integer(length) - if (!is.null(val)) { - if (!is.numeric(val)) - stop("'val' must be a numeric vector") - if (!storage.mode(val) == "integer") - storage.mode(val) <- "integer" - } - .Call2("SharedInteger_new", length, val, PACKAGE="XVector") -} - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Validity. -### - -.valid.SharedInteger <- function(x) -{ - if (!tagIsVector(x@xp, tagtype="integer")) - return(problemIfNotExternalVector("'x@xp'", - tagmustbe="an integer vector")) - NULL -} - -setValidity2("SharedInteger", .valid.SharedInteger) - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Read/write functions. -### These are almost safe wrappers to unsafe C functions ("almost" because -### they don't check for NAs in their arguments). -### If length(i) == 0 then the read functions return an empty vector -### and the write functions don't do anything. -### - -SharedInteger.read <- function(x, i, imax=integer(0)) -{ - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - .Call2("SharedInteger_read_ints_from_i1i2", x, i, imax, PACKAGE="XVector") - } else { - .Call2("SharedInteger_read_ints_from_subscript", x, i, PACKAGE="XVector") - } -} - -SharedInteger.write <- function(x, i, imax=integer(0), value) -{ - if (!is.integer(value)) - stop("'value' must be an integer vector") - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - .Call2("SharedInteger_write_ints_to_i1i2", x, i, imax, value, PACKAGE="XVector") - } else { - .Call2("SharedInteger_write_ints_to_subscript", x, i, value, PACKAGE="XVector") - } - x -} - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Coercion. -### - -setMethod("as.integer", "SharedInteger", - function(x, ...) SharedInteger.read(x, 1L, length(x)) -) - +### ========================================================================= +### SharedInteger objects +### ------------------------------------------------------------------------- +### +### A SharedInteger object is an external pointer to an ordinary integer +### vector. +### + +setClass("SharedInteger", contains="SharedVector") + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Initialization. +### +### Note that, unlike 'integer(99)', 'SharedInteger(99)' does NOT initialize its +### data. Specify the 'val' argument if you want data initialization. +### + +SharedInteger <- function(length=0L, val=NULL) +{ + if (!isSingleNumber(length) || length < 0) + stop("'length' must be a single non-negative integer") + if (!is.integer(length)) + length <- as.integer(length) + if (!is.null(val)) { + if (!is.numeric(val)) + stop("'val' must be a numeric vector") + if (!storage.mode(val) == "integer") + storage.mode(val) <- "integer" + } + .Call2("SharedInteger_new", length, val, PACKAGE="XVector") +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Validity. +### + +.valid.SharedInteger <- function(x) +{ + if (!tagIsVector(x@xp, tagtype="integer")) + return(problemIfNotExternalVector("'x@xp'", + tagmustbe="an integer vector")) + NULL +} + +setValidity2("SharedInteger", .valid.SharedInteger) + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Read/write functions. +### These are almost safe wrappers to unsafe C functions ("almost" because +### they don't check for NAs in their arguments). +### If length(i) == 0 then the read functions return an empty vector +### and the write functions don't do anything. +### + +SharedInteger.read <- function(x, i, imax=integer(0)) +{ + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + .Call2("SharedInteger_read_ints_from_i1i2", x, i, imax, PACKAGE="XVector") + } else { + .Call2("SharedInteger_read_ints_from_subscript", x, i, PACKAGE="XVector") + } +} + +SharedInteger.write <- function(x, i, imax=integer(0), value) +{ + if (!is.integer(value)) + stop("'value' must be an integer vector") + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + .Call2("SharedInteger_write_ints_to_i1i2", x, i, imax, value, PACKAGE="XVector") + } else { + .Call2("SharedInteger_write_ints_to_subscript", x, i, value, PACKAGE="XVector") + } + x +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Coercion. +### + +setMethod("as.integer", "SharedInteger", + function(x, ...) SharedInteger.read(x, 1L, length(x)) +) + diff -Nru r-bioc-xvector-0.22.0/R/SharedRaw-class.R r-bioc-xvector-0.24.0/R/SharedRaw-class.R --- r-bioc-xvector-0.22.0/R/SharedRaw-class.R 2018-10-30 19:41:27.000000000 +0000 +++ r-bioc-xvector-0.24.0/R/SharedRaw-class.R 2019-05-02 21:00:35.000000000 +0000 @@ -1,236 +1,274 @@ -### ========================================================================= -### SharedRaw objects and SharedRaw_Pool objects -### ------------------------------------------------------------------------- -### -### A SharedRaw object is an external pointer to an ordinary raw vector. -### A SharedRaw_Pool object is *conceptually* a list of SharedRaw -### objects but is actually NOT *implemented* as a list of such objects. -### See SharedVector-class.R file for the representation details. -### - -setClass("SharedRaw", contains="SharedVector") - -setClass("SharedRaw_Pool", contains="SharedVector_Pool") - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Initialization. -### - -### Note that, unlike 'raw(99)', 'SharedRaw(99)' does NOT initialize its -### data. Specify the 'val' argument if you want data initialization. -SharedRaw <- function(length=0L, val=NULL) -{ - if (!isSingleNumber(length) || length < 0) - stop("'length' must be a single non-negative integer") - if (!is.integer(length)) - length <- as.integer(length) - if (!is.null(val) && !is.raw(val)) { - if (is.numeric(val)) { - val <- as.raw(val) - } else if (isSingleString(val)) { - val <- charToRaw(val) - } else { - stop("don't know how to turn 'val' into a raw vector") - } - } - .Call2("SharedRaw_new", length, val, PACKAGE="XVector") -} - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Some low-level methods. -### - -setMethod("[[", "SharedRaw_Pool", - function(x, i, j, ...) - { - if (!isSingleInteger(i) || i < 1L || i > length(x)) - stop("invalid subscript") - ans <- SharedRaw() - ans@xp <- x@xp_list[[i]] - ans@.link_to_cached_object <- x@.link_to_cached_object_list[[i]] - ans - } -) - -setReplaceMethod("[[", "SharedRaw_Pool", - function(x, i, j, ..., value) - { - if (!isSingleInteger(i) || i < 1L || i > length(x)) - stop("invalid subscript") - if (class(value) != "SharedRaw") - stop("replacement value must be a SharedRaw instance") - x@xp_list[[i]] <- value@xp - x@.link_to_cached_object_list[[i]] <- value@.link_to_cached_object - x - } -) - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Validity. -### - -.valid.SharedRaw <- function(x) -{ - if (!tagIsVector(x@xp, tagtype="raw")) - return(problemIfNotExternalVector("'x@xp'", - tagmustbe="a raw vector")) - NULL -} - -setValidity2("SharedRaw", .valid.SharedRaw) - -.valid.SharedRaw_Pool <- function(x) -{ - if (!all(sapply(x@xp_list, - function(elt) tagIsVector(elt, tagtype="raw")))) - return(problemIfNotExternalVector("each element in 'x@xp_list'", - tagmustbe="a raw vector")) - NULL -} - -setValidity2("SharedRaw_Pool", .valid.SharedRaw_Pool) - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Read/write functions. -### These are almost safe wrappers to unsafe C functions ("almost" because -### they don't check for NAs in their arguments). -### If length(i) == 0 then the read functions return an empty vector -### and the write functions don't do anything. - -SharedRaw.readInts <- function(x, i, imax=integer(0)) -{ - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - .Call2("SharedRaw_read_ints_from_i1i2", x, i, imax, PACKAGE="XVector") - } else { - .Call2("SharedRaw_read_ints_from_subscript", x, i, PACKAGE="XVector") - } -} - -SharedRaw.writeInts <- function(x, i, imax=integer(0), value) -{ - if (!is.integer(value)) - stop("'value' must be an integer vector") - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - .Call2("SharedRaw_write_ints_to_i1i2", x, i, imax, value, PACKAGE="XVector") - } else { - .Call2("SharedRaw_write_ints_to_subscript", x, i, value, PACKAGE="XVector") - } - x -} - -### 'dec_lkup' must be NULL or a vector of integers -SharedRaw.read <- function(x, i, imax=integer(0), dec_lkup=NULL) -{ - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - if (is.null(dec_lkup)) - .Call2("SharedRaw_read_chars_from_i1i2", - x, i, imax, PACKAGE="XVector") - else - .Call2("SharedRaw_read_enc_chars_from_i1i2", - x, i, imax, dec_lkup, PACKAGE="XVector") - } else { - if (is.null(dec_lkup)) - .Call2("SharedRaw_read_chars_from_subscript", - x, i, PACKAGE="XVector") - else - .Call2("SharedRaw_read_enc_chars_from_subscript", - x, i, dec_lkup, PACKAGE="XVector") - } -} - -### 'enc_lkup' must be NULL or a vector of integers -SharedRaw.write <- function(x, i, imax=integer(0), value, enc_lkup=NULL) -{ - if (!isSingleString(value)) - stop("'value' must be a single string") - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - if (is.null(enc_lkup)) - .Call2("SharedRaw_write_chars_to_i1i2", - x, i, imax, value, PACKAGE="XVector") - else - .Call2("SharedRaw_write_enc_chars_to_i1i2", - x, i, imax, value, enc_lkup, PACKAGE="XVector") - } else { - if (is.null(enc_lkup)) - .Call2("SharedRaw_write_chars_to_subscript", - x, i, value, PACKAGE="XVector") - else - .Call2("SharedRaw_write_enc_chars_to_subscript", - x, i, value, enc_lkup, PACKAGE="XVector") - } - x -} - -### 'lkup' must be a vector of complexes -SharedRaw.readComplexes <- function(x, i, imax=integer(0), lkup) -{ - if (!is.integer(i)) - i <- as.integer(i) - if (length(i) == 1) { - if (length(imax) == 0) - imax <- i - else - imax <- as.integer(imax) - .Call2("SharedRaw_read_complexes_from_i1i2", - x, i, imax, lkup, PACKAGE="XVector") - } else { - .Call2("SharedRaw_read_complexes_from_subscript", - x, i, lkup, PACKAGE="XVector") - } -} - - -### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Coercion. -### -### TODO: add the "as.raw" and "as.character" methods. -### - -setMethod("as.integer", "SharedRaw", - function(x, ...) - { - SharedRaw.readInts(x, 1L, length(x)) - } -) - -### Typical use: -### x <- SharedRaw(15, as.raw(65)) -### toString(x) -### x <- SharedRaw(5, charToRaw("Hello")) -### toString(x) -### This should always rewrite the content of a SharedRaw object -### to itself, without any modification: -### SharedRaw.write(x, 1, length(x), value=toString(x)) -### whatever the content of 'x' is! -setMethod("toString", "SharedRaw", - function(x, ...) SharedRaw.read(x, 1, length(x)) -) - +### ========================================================================= +### SharedRaw objects and SharedRaw_Pool objects +### ------------------------------------------------------------------------- +### +### A SharedRaw object is an external pointer to an ordinary raw vector. +### A SharedRaw_Pool object is *conceptually* a list of SharedRaw +### objects but is actually NOT *implemented* as a list of such objects. +### See SharedVector-class.R file for the representation details. +### + +setClass("SharedRaw", contains="SharedVector") + +setClass("SharedRaw_Pool", contains="SharedVector_Pool") + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Initialization. +### + +### Note that, unlike 'raw(99)', 'SharedRaw(99)' does NOT initialize its +### data. Specify the 'val' argument if you want data initialization. +SharedRaw <- function(length=0L, val=NULL) +{ + if (!isSingleNumber(length) || length < 0) + stop("'length' must be a single non-negative integer") + if (!is.integer(length)) + length <- as.integer(length) + if (!is.null(val) && !is.raw(val)) { + if (is.numeric(val)) { + val <- as.raw(val) + } else if (isSingleString(val)) { + val <- charToRaw(val) + } else { + stop("don't know how to turn 'val' into a raw vector") + } + } + .Call2("SharedRaw_new", length, val, PACKAGE="XVector") +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Some low-level methods. +### + +setMethod("[[", "SharedRaw_Pool", + function(x, i, j, ...) + { + if (!isSingleInteger(i) || i < 1L || i > length(x)) + stop("invalid subscript") + ans <- SharedRaw() + ans@xp <- x@xp_list[[i]] + ans@.link_to_cached_object <- x@.link_to_cached_object_list[[i]] + ans + } +) + +setReplaceMethod("[[", "SharedRaw_Pool", + function(x, i, j, ..., value) + { + if (!isSingleInteger(i) || i < 1L || i > length(x)) + stop("invalid subscript") + if (class(value) != "SharedRaw") + stop("replacement value must be a SharedRaw instance") + x@xp_list[[i]] <- value@xp + x@.link_to_cached_object_list[[i]] <- value@.link_to_cached_object + x + } +) + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Validity. +### + +.valid.SharedRaw <- function(x) +{ + if (!tagIsVector(x@xp, tagtype="raw")) + return(problemIfNotExternalVector("'x@xp'", + tagmustbe="a raw vector")) + NULL +} + +setValidity2("SharedRaw", .valid.SharedRaw) + +.valid.SharedRaw_Pool <- function(x) +{ + if (!all(sapply(x@xp_list, + function(elt) tagIsVector(elt, tagtype="raw")))) + return(problemIfNotExternalVector("each element in 'x@xp_list'", + tagmustbe="a raw vector")) + NULL +} + +setValidity2("SharedRaw_Pool", .valid.SharedRaw_Pool) + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### extract_character_from_SharedRaw_by_positions() and +### extract_character_from_SharedRaw_by_ranges() +### + +### Typical use: +### x <- SharedRaw(5, charToRaw("Hello")) +### extract_character_from_SharedRaw_by_positions(x, 5:2) +### extract_character_from_SharedRaw_by_positions(x, 5:2, collapse=TRUE) +extract_character_from_SharedRaw_by_positions <- function(x, pos, + collapse=FALSE, + lkup=NULL) +{ + .Call("C_extract_character_from_SharedRaw_by_positions", + x, pos, collapse, lkup, + PACKAGE="XVector") +} + +### Typical use: +### x <- SharedRaw(5, charToRaw("Hello")) +### extract_character_from_SharedRaw_by_ranges(x, 3:1, c(2:1, 4L)) +### extract_character_from_SharedRaw_by_ranges(x, 3:1, c(2:1, 4L), +### collapse=TRUE) +extract_character_from_SharedRaw_by_ranges <- function(x, start, width, + collapse=FALSE, + lkup=NULL) +{ + .Call("C_extract_character_from_SharedRaw_by_ranges", + x, start, width, collapse, lkup, + PACKAGE="XVector") +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Read/write functions +### +### NOTE: This is pretty old stuff! Some of it is now superseded by more +### modern extract_character_from_SharedRaw_by_positions() and +### extract_character_from_SharedRaw_by_ranges() above. +### +### These are almost safe wrappers to unsafe C functions ("almost" because +### they don't check for NAs in their arguments). +### If length(i) == 0 then the read functions return an empty vector +### and the write functions don't do anything. + +SharedRaw.readInts <- function(x, i, imax=integer(0)) +{ + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + .Call2("SharedRaw_read_ints_from_i1i2", x, i, imax, PACKAGE="XVector") + } else { + .Call2("SharedRaw_read_ints_from_subscript", x, i, PACKAGE="XVector") + } +} + +SharedRaw.writeInts <- function(x, i, imax=integer(0), value) +{ + if (!is.integer(value)) + stop("'value' must be an integer vector") + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + .Call2("SharedRaw_write_ints_to_i1i2", x, i, imax, value, PACKAGE="XVector") + } else { + .Call2("SharedRaw_write_ints_to_subscript", x, i, value, PACKAGE="XVector") + } + x +} + +### 'dec_lkup' must be NULL or a vector of integers +SharedRaw.read <- function(x, i, imax=integer(0), dec_lkup=NULL) +{ + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + if (is.null(dec_lkup)) + .Call2("SharedRaw_read_chars_from_i1i2", + x, i, imax, PACKAGE="XVector") + else + .Call2("SharedRaw_read_enc_chars_from_i1i2", + x, i, imax, dec_lkup, PACKAGE="XVector") + } else { + if (is.null(dec_lkup)) + .Call2("SharedRaw_read_chars_from_subscript", + x, i, PACKAGE="XVector") + else + .Call2("SharedRaw_read_enc_chars_from_subscript", + x, i, dec_lkup, PACKAGE="XVector") + } +} + +### 'enc_lkup' must be NULL or a vector of integers +SharedRaw.write <- function(x, i, imax=integer(0), value, enc_lkup=NULL) +{ + if (!isSingleString(value)) + stop("'value' must be a single string") + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + if (is.null(enc_lkup)) + .Call2("SharedRaw_write_chars_to_i1i2", + x, i, imax, value, PACKAGE="XVector") + else + .Call2("SharedRaw_write_enc_chars_to_i1i2", + x, i, imax, value, enc_lkup, PACKAGE="XVector") + } else { + if (is.null(enc_lkup)) + .Call2("SharedRaw_write_chars_to_subscript", + x, i, value, PACKAGE="XVector") + else + .Call2("SharedRaw_write_enc_chars_to_subscript", + x, i, value, enc_lkup, PACKAGE="XVector") + } + x +} + +### 'lkup' must be a vector of complexes +SharedRaw.readComplexes <- function(x, i, imax=integer(0), lkup) +{ + if (!is.integer(i)) + i <- as.integer(i) + if (length(i) == 1) { + if (length(imax) == 0) + imax <- i + else + imax <- as.integer(imax) + .Call2("SharedRaw_read_complexes_from_i1i2", + x, i, imax, lkup, PACKAGE="XVector") + } else { + .Call2("SharedRaw_read_complexes_from_subscript", + x, i, lkup, PACKAGE="XVector") + } +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### Coercion. +### +### TODO: add the "as.raw" and "as.character" methods. +### + +setMethod("as.integer", "SharedRaw", + function(x, ...) + { + SharedRaw.readInts(x, 1L, length(x)) + } +) + +### Typical use: +### x <- SharedRaw(15, as.raw(65)) +### toString(x) +### x <- SharedRaw(5, charToRaw("Hello")) +### toString(x) +### This should always rewrite the content of a SharedRaw object +### to itself, without any modification: +### SharedRaw.write(x, 1, length(x), value=toString(x)) +### whatever the content of 'x' is! +setMethod("toString", "SharedRaw", + function(x, ...) SharedRaw.read(x, 1, length(x)) +) + diff -Nru r-bioc-xvector-0.22.0/R/XRaw-class.R r-bioc-xvector-0.24.0/R/XRaw-class.R --- r-bioc-xvector-0.22.0/R/XRaw-class.R 2018-10-30 19:41:27.000000000 +0000 +++ r-bioc-xvector-0.24.0/R/XRaw-class.R 2019-05-02 21:00:35.000000000 +0000 @@ -34,6 +34,44 @@ ### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +### extract_character_from_XRaw_by_positions() and +### extract_character_from_XRaw_by_ranges() +### + +### Typical use: +### x <- subseq(as(charToRaw("--Hello--"), "XRaw"), 3, 7) +### extract_character_from_XRaw_by_positions(x, 5:2) +### extract_character_from_XRaw_by_positions(x, 5:2, collapse=TRUE) +### lkup <- S4Vectors:::TOUPPER_LOOKUP +### extract_character_from_XRaw_by_positions(x, 5:2, lkup=lkup) +### extract_character_from_XRaw_by_positions(x, 5:2, collapse=TRUE, lkup=lkup) +extract_character_from_XRaw_by_positions <- function(x, pos, + collapse=FALSE, + lkup=NULL) +{ + .Call("C_extract_character_from_XRaw_by_positions", + x, pos, collapse, lkup, + PACKAGE="XVector") +} + +### Typical use: +### x <- subseq(as(charToRaw("--Hello--"), "XRaw"), 3, 7) +### extract_character_from_XRaw_by_ranges(x, 3:1, c(2:1, 4L)) +### extract_character_from_XRaw_by_ranges(x, 3:1, c(2:1, 4L), collapse=TRUE) +### lkup <- S4Vectors:::TOUPPER_LOOKUP +### extract_character_from_XRaw_by_ranges(x, 3:1, c(2:1, 4L), lkup=lkup) +### extract_character_from_XRaw_by_ranges(x, 3:1, c(2:1, 4L), collapse=TRUE, +### lkup=lkup) +extract_character_from_XRaw_by_ranges <- function(x, start, width, + collapse=FALSE, lkup=NULL) +{ + .Call("C_extract_character_from_XRaw_by_ranges", + x, start, width, collapse, lkup, + PACKAGE="XVector") +} + + +### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ### Coercion. ### diff -Nru r-bioc-xvector-0.22.0/README.md r-bioc-xvector-0.24.0/README.md --- r-bioc-xvector-0.22.0/README.md 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-xvector-0.24.0/README.md 2019-05-02 21:00:35.000000000 +0000 @@ -0,0 +1,6 @@ +[](https://bioconductor.org/) + +_XVector_ is an R/Bioconductor package that provides the foundation of external vector representation and manipulation in Bioconductor. + +See https://bioconductor.org/packages/XVector for more information including how to install the release version of the package (please refrain from installing directly from GitHub). + diff -Nru r-bioc-xvector-0.22.0/src/Ocopy_byteblocks.c r-bioc-xvector-0.24.0/src/Ocopy_byteblocks.c --- r-bioc-xvector-0.22.0/src/Ocopy_byteblocks.c 2018-10-30 23:52:16.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/Ocopy_byteblocks.c 2019-05-02 21:00:35.000000000 +0000 @@ -1,15 +1,6 @@ #include "XVector.h" -static int translate_byte(char byte, const int *lkup, int lkup_length) -{ - int key; - - key = (unsigned char) byte; - return key >= lkup_length ? NA_INTEGER : lkup[key]; -} - - /**************************************************************************** All the functions below are performing cyclic copy i.e. copy with recycling either at the destination ('dest') or at the source ('src'). In this file, diff -Nru r-bioc-xvector-0.22.0/src/R_init_XVector.c r-bioc-xvector-0.24.0/src/R_init_XVector.c --- r-bioc-xvector-0.22.0/src/R_init_XVector.c 2018-10-30 23:52:16.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/R_init_XVector.c 2019-05-02 21:00:35.000000000 +0000 @@ -36,6 +36,8 @@ /* SharedRaw_class.c */ CALLMETHOD_DEF(SharedRaw_new, 2), + CALLMETHOD_DEF(C_extract_character_from_SharedRaw_by_positions, 4), + CALLMETHOD_DEF(C_extract_character_from_SharedRaw_by_ranges, 5), CALLMETHOD_DEF(SharedRaw_read_chars_from_i1i2, 3), CALLMETHOD_DEF(SharedRaw_read_chars_from_subscript, 2), CALLMETHOD_DEF(SharedRaw_write_chars_to_i1i2, 4), @@ -72,6 +74,10 @@ CALLMETHOD_DEF(SharedDouble_write_nums_to_i1i2, 4), CALLMETHOD_DEF(SharedDouble_write_nums_to_subscript, 3), +/* XRaw_class.c */ + CALLMETHOD_DEF(C_extract_character_from_XRaw_by_positions, 4), + CALLMETHOD_DEF(C_extract_character_from_XRaw_by_ranges, 5), + /* XRawList_comparison.c */ CALLMETHOD_DEF(XRawList_pcompare, 2), CALLMETHOD_DEF(XRawList_is_unsorted, 2), @@ -131,15 +137,21 @@ REGISTER_CCALLABLE(_get_XVector_offset); REGISTER_CCALLABLE(_get_XVector_length); REGISTER_CCALLABLE(_get_XVector_tag); - REGISTER_CCALLABLE(_hold_XRaw); - REGISTER_CCALLABLE(_hold_XInteger); - REGISTER_CCALLABLE(_hold_XDouble); REGISTER_CCALLABLE(_new_XVector); + +/* XRaw_class.c */ + REGISTER_CCALLABLE(_hold_XRaw); REGISTER_CCALLABLE(_new_XRaw_from_tag); - REGISTER_CCALLABLE(_new_XInteger_from_tag); - REGISTER_CCALLABLE(_new_XDouble_from_tag); REGISTER_CCALLABLE(_alloc_XRaw); + +/* XInteger_class.c */ + REGISTER_CCALLABLE(_hold_XInteger); + REGISTER_CCALLABLE(_new_XInteger_from_tag); REGISTER_CCALLABLE(_alloc_XInteger); + +/* XDouble_class.c */ + REGISTER_CCALLABLE(_hold_XDouble); + REGISTER_CCALLABLE(_new_XDouble_from_tag); REGISTER_CCALLABLE(_alloc_XDouble); /* XVectorList_class.c */ diff -Nru r-bioc-xvector-0.22.0/src/SharedRaw_class.c r-bioc-xvector-0.24.0/src/SharedRaw_class.c --- r-bioc-xvector-0.22.0/src/SharedRaw_class.c 2018-10-30 23:52:16.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/SharedRaw_class.c 2019-05-02 21:00:35.000000000 +0000 @@ -38,12 +38,58 @@ * -------------------------------------------------------------------------- */ +SEXP C_extract_character_from_SharedRaw_by_positions(SEXP x, SEXP pos, + SEXP collapse, SEXP lkup) +{ + SEXP x_tag; + + x_tag = _get_SharedVector_tag(x); + if (!IS_RAW(x_tag)) + error("'x' must be a SharedRaw object"); + + if (!IS_INTEGER(pos)) + error("'pos' must be an integer vector"); + + if (!(IS_LOGICAL(collapse) && LENGTH(collapse) == 1)) + error("'collapse' must be TRUE or FALSE"); + + return extract_bytes_by_positions( + (const char *) RAW(x_tag), LENGTH(x_tag), + INTEGER(pos), LENGTH(pos), + LOGICAL(collapse)[0], lkup); +} + +SEXP C_extract_character_from_SharedRaw_by_ranges(SEXP x, + SEXP start, SEXP width, + SEXP collapse, SEXP lkup) +{ + SEXP x_tag; + int nranges; + const int *start_p, *width_p; + + x_tag = _get_SharedVector_tag(x); + if (!IS_RAW(x_tag)) + error("'x' must be a SharedRaw object"); + + nranges = check_integer_pairs(start, width, + &start_p, &width_p, + "start", "width"); + + if (!(IS_LOGICAL(collapse) && LENGTH(collapse) == 1)) + error("'collapse' must be TRUE or FALSE"); + + return extract_bytes_by_ranges( + (const char *) RAW(x_tag), LENGTH(x_tag), + start_p, width_p, nranges, + LOGICAL(collapse)[0], lkup); +} + /* * Return a single string (character vector of length 1). * From R: * x <- SharedRaw(15) * x[] < "Hello" - * .Call("SharedRaw_read_chars_from_i1i2", x, 2:2, 4:4, PACKAGE="XVector") + * .Call("SharedRaw_read_chars_from_i1i2", x, 2L, 4L, PACKAGE="XVector") */ SEXP SharedRaw_read_chars_from_i1i2(SEXP src, SEXP imin, SEXP imax) { @@ -123,7 +169,7 @@ * Return an integer vector of length 'imax' - 'imin' + 1. * From R: * x <- SharedRaw(30) - * .Call("SharedRaw_read_ints_from_i1i2", x, 20:20, 25:25, PACKAGE="XVector") + * .Call("SharedRaw_read_ints_from_i1i2", x, 20L, 25L, PACKAGE="XVector") */ SEXP SharedRaw_read_ints_from_i1i2(SEXP src, SEXP imin, SEXP imax) { diff -Nru r-bioc-xvector-0.22.0/src/XDouble_class.c r-bioc-xvector-0.24.0/src/XDouble_class.c --- r-bioc-xvector-0.22.0/src/XDouble_class.c 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/XDouble_class.c 2019-05-02 21:00:35.000000000 +0000 @@ -0,0 +1,41 @@ +/**************************************************************************** + * Low-level manipulation of XDouble objects * + * Author: H. Pag\`es * + ****************************************************************************/ +#include "XVector.h" + + +Doubles_holder _hold_XDouble(SEXP x) +{ + Doubles_holder x_holder; + SEXP tag; + int offset; + + tag = _get_XVector_tag(x); + offset = _get_XVector_offset(x); + x_holder.ptr = (const double *) (REAL(tag) + offset); + x_holder.length = _get_XVector_length(x); + return x_holder; +} + +SEXP _new_XDouble_from_tag(const char *classname, SEXP tag) +{ + SEXP shared, ans; + + PROTECT(shared = _new_SharedVector("SharedDouble", tag)); + PROTECT(ans = _new_XVector(classname, shared, 0, LENGTH(tag))); + UNPROTECT(2); + return ans; +} + +/* Allocation WITHOUT initialization. */ +SEXP _alloc_XDouble(const char *classname, int length) +{ + SEXP tag, ans; + + PROTECT(tag = NEW_NUMERIC(length)); + PROTECT(ans = _new_XDouble_from_tag(classname, tag)); + UNPROTECT(2); + return ans; +} + diff -Nru r-bioc-xvector-0.22.0/src/XInteger_class.c r-bioc-xvector-0.24.0/src/XInteger_class.c --- r-bioc-xvector-0.22.0/src/XInteger_class.c 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/XInteger_class.c 2019-05-02 21:00:35.000000000 +0000 @@ -0,0 +1,41 @@ +/**************************************************************************** + * Low-level manipulation of XInteger objects * + * Author: H. Pag\`es * + ****************************************************************************/ +#include "XVector.h" + + +Ints_holder _hold_XInteger(SEXP x) +{ + Ints_holder x_holder; + SEXP tag; + int offset; + + tag = _get_XVector_tag(x); + offset = _get_XVector_offset(x); + x_holder.ptr = (const int *) (INTEGER(tag) + offset); + x_holder.length = _get_XVector_length(x); + return x_holder; +} + +SEXP _new_XInteger_from_tag(const char *classname, SEXP tag) +{ + SEXP shared, ans; + + PROTECT(shared = _new_SharedVector("SharedInteger", tag)); + PROTECT(ans = _new_XVector(classname, shared, 0, LENGTH(tag))); + UNPROTECT(2); + return ans; +} + +/* Allocation WITHOUT initialization. */ +SEXP _alloc_XInteger(const char *classname, int length) +{ + SEXP tag, ans; + + PROTECT(tag = NEW_INTEGER(length)); + PROTECT(ans = _new_XInteger_from_tag(classname, tag)); + UNPROTECT(2); + return ans; +} + diff -Nru r-bioc-xvector-0.22.0/src/XRaw_class.c r-bioc-xvector-0.24.0/src/XRaw_class.c --- r-bioc-xvector-0.22.0/src/XRaw_class.c 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/XRaw_class.c 2019-05-02 21:00:35.000000000 +0000 @@ -0,0 +1,93 @@ +/**************************************************************************** + * Low-level manipulation of XRaw objects * + * Author: H. Pag\`es * + ****************************************************************************/ +#include "XVector.h" +#include "S4Vectors_interface.h" + + +Chars_holder _hold_XRaw(SEXP x) +{ + Chars_holder x_holder; + SEXP tag; + int offset; + + tag = _get_XVector_tag(x); + offset = _get_XVector_offset(x); + x_holder.ptr = (const char *) (RAW(tag) + offset); + x_holder.length = _get_XVector_length(x); + return x_holder; +} + +SEXP _new_XRaw_from_tag(const char *classname, SEXP tag) +{ + SEXP shared, ans; + + PROTECT(shared = _new_SharedVector("SharedRaw", tag)); + PROTECT(ans = _new_XVector(classname, shared, 0, LENGTH(tag))); + UNPROTECT(2); + return ans; +} + +/* Allocation WITHOUT initialization. */ +SEXP _alloc_XRaw(const char *classname, int length) +{ + SEXP tag, ans; + + PROTECT(tag = NEW_RAW(length)); + PROTECT(ans = _new_XRaw_from_tag(classname, tag)); + UNPROTECT(2); + return ans; +} + +SEXP C_extract_character_from_XRaw_by_positions(SEXP x, SEXP pos, + SEXP collapse, SEXP lkup) +{ + SEXP x_tag; + int x_off, x_len; + + x_tag = _get_XVector_tag(x); + if (!IS_RAW(x_tag)) + error("'x' must be an XRaw object"); + x_off = _get_XVector_offset(x); + x_len = _get_XVector_length(x); + + if (!IS_INTEGER(pos)) + error("'pos' must be an integer vector"); + + if (!(IS_LOGICAL(collapse) && LENGTH(collapse) == 1)) + error("'collapse' must be TRUE or FALSE"); + + return extract_bytes_by_positions( + (const char *) (RAW(x_tag) + x_off), x_len, + INTEGER(pos), LENGTH(pos), + LOGICAL(collapse)[0], lkup); +} + +SEXP C_extract_character_from_XRaw_by_ranges(SEXP x, SEXP start, SEXP width, + SEXP collapse, SEXP lkup) +{ + SEXP x_tag; + int x_off, x_len; + int nranges; + const int *start_p, *width_p; + + x_tag = _get_XVector_tag(x); + if (!IS_RAW(x_tag)) + error("'x' must be an XRaw object"); + x_off = _get_XVector_offset(x); + x_len = _get_XVector_length(x); + + nranges = check_integer_pairs(start, width, + &start_p, &width_p, + "start", "width"); + + if (!(IS_LOGICAL(collapse) && LENGTH(collapse) == 1)) + error("'collapse' must be TRUE or FALSE"); + + return extract_bytes_by_ranges( + (const char *) (RAW(x_tag) + x_off), x_len, + start_p, width_p, nranges, + LOGICAL(collapse)[0], lkup); +} + diff -Nru r-bioc-xvector-0.22.0/src/XVector_class.c r-bioc-xvector-0.24.0/src/XVector_class.c --- r-bioc-xvector-0.22.0/src/XVector_class.c 2018-10-30 23:52:16.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/XVector_class.c 2019-05-02 21:00:35.000000000 +0000 @@ -35,7 +35,7 @@ return INTEGER(GET_SLOT(x, length_symbol))[0]; } -/* Not a strict "slot getter" but very much like. */ +/* Not a strict "slot getter" but convenient to have. */ SEXP _get_XVector_tag(SEXP x) { return _get_SharedVector_tag(_get_XVector_shared(x)); @@ -43,50 +43,6 @@ /**************************************************************************** - * Caching. - */ - -Chars_holder _hold_XRaw(SEXP x) -{ - Chars_holder x_holder; - SEXP tag; - int offset; - - tag = _get_XVector_tag(x); - offset = _get_XVector_offset(x); - x_holder.ptr = (const char *) (RAW(tag) + offset); - x_holder.length = _get_XVector_length(x); - return x_holder; -} - -Ints_holder _hold_XInteger(SEXP x) -{ - Ints_holder x_holder; - SEXP tag; - int offset; - - tag = _get_XVector_tag(x); - offset = _get_XVector_offset(x); - x_holder.ptr = (const int *) (INTEGER(tag) + offset); - x_holder.length = _get_XVector_length(x); - return x_holder; -} - -Doubles_holder _hold_XDouble(SEXP x) -{ - Doubles_holder x_holder; - SEXP tag; - int offset; - - tag = _get_XVector_tag(x); - offset = _get_XVector_offset(x); - x_holder.ptr = (const double *) (REAL(tag) + offset); - x_holder.length = _get_XVector_length(x); - return x_holder; -} - - -/**************************************************************************** * C-level slot setters. * * Be careful that these functions do NOT duplicate the assigned value! @@ -122,7 +78,7 @@ /**************************************************************************** - * C-level constructors. + * C-level constructor * * Be careful that these functions do NOT duplicate their arguments before * putting them in the slots of the returned object. @@ -142,65 +98,3 @@ return ans; } -SEXP _new_XRaw_from_tag(const char *classname, SEXP tag) -{ - SEXP shared, ans; - - PROTECT(shared = _new_SharedVector("SharedRaw", tag)); - PROTECT(ans = _new_XVector(classname, shared, 0, LENGTH(tag))); - UNPROTECT(2); - return ans; -} - -SEXP _new_XInteger_from_tag(const char *classname, SEXP tag) -{ - SEXP shared, ans; - - PROTECT(shared = _new_SharedVector("SharedInteger", tag)); - PROTECT(ans = _new_XVector(classname, shared, 0, LENGTH(tag))); - UNPROTECT(2); - return ans; -} - -SEXP _new_XDouble_from_tag(const char *classname, SEXP tag) -{ - SEXP shared, ans; - - PROTECT(shared = _new_SharedVector("SharedDouble", tag)); - PROTECT(ans = _new_XVector(classname, shared, 0, LENGTH(tag))); - UNPROTECT(2); - return ans; -} - -/* Allocation WITHOUT initialization. */ - -SEXP _alloc_XRaw(const char *classname, int length) -{ - SEXP tag, ans; - - PROTECT(tag = NEW_RAW(length)); - PROTECT(ans = _new_XRaw_from_tag(classname, tag)); - UNPROTECT(2); - return ans; -} - -SEXP _alloc_XInteger(const char *classname, int length) -{ - SEXP tag, ans; - - PROTECT(tag = NEW_INTEGER(length)); - PROTECT(ans = _new_XInteger_from_tag(classname, tag)); - UNPROTECT(2); - return ans; -} - -SEXP _alloc_XDouble(const char *classname, int length) -{ - SEXP tag, ans; - - PROTECT(tag = NEW_NUMERIC(length)); - PROTECT(ans = _new_XDouble_from_tag(classname, tag)); - UNPROTECT(2); - return ans; -} - diff -Nru r-bioc-xvector-0.22.0/src/XVector.h r-bioc-xvector-0.24.0/src/XVector.h --- r-bioc-xvector-0.22.0/src/XVector.h 2018-10-30 23:52:16.000000000 +0000 +++ r-bioc-xvector-0.24.0/src/XVector.h 2019-05-02 21:00:35.000000000 +0000 @@ -355,6 +355,21 @@ SEXP val ); +SEXP C_extract_character_from_SharedRaw_by_positions( + SEXP x, + SEXP pos, + SEXP collapse, + SEXP lkup +); + +SEXP C_extract_character_from_SharedRaw_by_ranges( + SEXP x, + SEXP start, + SEXP width, + SEXP collapse, + SEXP lkup +); + SEXP SharedRaw_read_chars_from_i1i2( SEXP src, SEXP imin, @@ -523,12 +538,6 @@ SEXP _get_XVector_tag(SEXP x); -Chars_holder _hold_XRaw(SEXP x); - -Ints_holder _hold_XInteger(SEXP x); - -Doubles_holder _hold_XDouble(SEXP x); - SEXP _new_XVector( const char *classname, SEXP shared, @@ -536,29 +545,59 @@ int length ); + +/* XRaw_class.c */ + +Chars_holder _hold_XRaw(SEXP x); + SEXP _new_XRaw_from_tag( const char *classname, SEXP tag ); -SEXP _new_XInteger_from_tag( +SEXP _alloc_XRaw( const char *classname, - SEXP tag + int length ); -SEXP _new_XDouble_from_tag( +SEXP C_extract_character_from_XRaw_by_positions( + SEXP x, + SEXP pos, + SEXP collapse, + SEXP lkup +); + +SEXP C_extract_character_from_XRaw_by_ranges( + SEXP x, + SEXP start, + SEXP width, + SEXP collapse, + SEXP lkup +); + + +/* XInteger_class.c */ + +Ints_holder _hold_XInteger(SEXP x); + +SEXP _new_XInteger_from_tag( const char *classname, SEXP tag ); -SEXP _alloc_XRaw( +SEXP _alloc_XInteger( const char *classname, int length ); -SEXP _alloc_XInteger( + +/* XDouble_class.c */ + +Doubles_holder _hold_XDouble(SEXP x); + +SEXP _new_XDouble_from_tag( const char *classname, - int length + SEXP tag ); SEXP _alloc_XDouble(