From f67de528d48b1f0a832c8f7d2eb11634bb32781f Mon Sep 17 00:00:00 2001 From: travers Date: Sat, 6 Nov 2021 13:29:10 -0700 Subject: [PATCH] 0.25.2 --- .Rbuildignore | 1 - .github/workflows/R-CMD-check.yaml | 87 ++++---------- .travis.yml | 26 ----- ChangeLog | 5 + DESCRIPTION | 6 +- Makefile | 20 ++-- NAMESPACE | 4 +- R/RcppExports.R | 8 +- R/ascii_encoding.r | 107 ++++++++++++++++++ R/{help_files.R => zz_help_files.R} | 47 -------- README.md | 4 +- configure.ac | 23 ++-- .../extra_tests}/benchmark_testing.R | 0 .../benchmark_testing_between_versions.R | 0 .../correctness_testing_extended.R | 0 .../extra_tests}/regression_testing.R | 0 {tests => inst/extra_tests}/revdep_check.R | 0 inst/include/qs_RcppExports.h | 28 ++--- man/base85_decode.Rd | 5 +- man/base85_encode.Rd | 5 +- man/base91_decode.Rd | 5 +- man/base91_encode.Rd | 14 ++- man/blosc_shuffle_raw.Rd | 2 +- man/blosc_unshuffle_raw.Rd | 2 +- man/catquo.Rd | 2 +- man/decode_source.Rd | 17 +++ man/encode_source.Rd | 21 ++++ man/is_big_endian.Rd | 2 +- man/lz4_compress_bound.Rd | 2 +- man/lz4_compress_raw.Rd | 2 +- man/lz4_decompress_raw.Rd | 2 +- man/qdeserialize.Rd | 2 +- man/qdump.Rd | 2 +- man/qread.Rd | 2 +- man/qread_fd.Rd | 2 +- man/qread_handle.Rd | 2 +- man/qread_ptr.Rd | 2 +- man/qsave.Rd | 2 +- man/qsave_fd.Rd | 2 +- man/qsave_handle.Rd | 2 +- man/qserialize.Rd | 2 +- man/starnames.Rd | 2 +- man/zstd_compress_bound.Rd | 2 +- man/zstd_compress_raw.Rd | 2 +- man/zstd_decompress_raw.Rd | 2 +- src/RcppExports.cpp | 36 +++--- src/extra_functions.h | 4 +- src/qs_functions.cpp | 5 +- tests/correctness_testing.R | 60 ++-------- vignettes/vignette.html | 4 +- vignettes/vignette.rmd | 2 +- 51 files changed, 297 insertions(+), 289 deletions(-) delete mode 100755 .travis.yml create mode 100755 R/ascii_encoding.r rename R/{help_files.R => zz_help_files.R} (88%) mode change 100644 => 100755 README.md rename {tests => inst/extra_tests}/benchmark_testing.R (100%) rename {tests => inst/extra_tests}/benchmark_testing_between_versions.R (100%) rename {tests => inst/extra_tests}/correctness_testing_extended.R (100%) rename {tests => inst/extra_tests}/regression_testing.R (100%) rename {tests => inst/extra_tests}/revdep_check.R (100%) create mode 100755 man/decode_source.Rd create mode 100755 man/encode_source.Rd diff --git a/.Rbuildignore b/.Rbuildignore index 4671c81..dd2e962 100755 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,7 +4,6 @@ rebuild.sh .*\.tar\.gz ^local -^tests ^benchmark_results rticle .Rhistory diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9dce45a..29a2c88 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,18 +1,14 @@ -# NOTE: This workflow is overkill for most R packages -# check-standard.yaml is likely a better choice -# usethis::use_github_action("check-standard") will install it. +# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help # -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# NOTE: This workflow is overkill for most R packages and +# check-standard.yaml is likely a better choice. +# usethis::use_github_action("check-standard") will install it. on: push: - branches: - - main - - master + branches: [main, master] pull_request: - branches: - - main - - master + branches: [main, master] name: R-CMD-check @@ -27,20 +23,22 @@ jobs: matrix: config: - {os: macOS-latest, r: 'release'} + - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: '3.6'} - - {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + # Use 3.6 to trigger usage of RTools35 + # - {os: windows-latest, r: '3.6'} + + # Use older ubuntu to maximise backward compatibility + - {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-18.04, r: 'release'} + - {os: ubuntu-18.04, r: 'oldrel-1'} + - {os: ubuntu-18.04, r: 'oldrel-2'} + - {os: ubuntu-18.04, r: 'oldrel-3'} + # - {os: ubuntu-18.04, r: 'oldrel-4'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - _R_CHECK_FORCE_SUGGESTS_: false - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - name: Windows CRLF fix @@ -48,54 +46,19 @@ jobs: - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-r@v1 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v1 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "16.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) - shell: Rscript {0} + extra-packages: rcmdcheck - - name: Check - env: - _R_CHECK_CRAN_INCOMING_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} + - uses: r-lib/actions/check-r-package@v1 - name: Show testthat output if: always() diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 5724afd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Run Travis CI for R using https://eddelbuettel.github.io/r-travis/ - -language: c - -sudo: required - -dist: focal - -before_install: - - curl -OLs https://eddelbuettel.github.io/r-travis/run.sh && chmod 0755 run.sh - - ./run.sh bootstrap - -install: - - export _R_CHECK_FORCE_SUGGESTS_=0 - - ./run.sh install_aptget r-cran-rcpp r-cran-knitr r-cran-rmarkdown r-cran-dplyr r-cran-data.table r-cran-rapiserialize && ./run.sh install_github traversc/stringfish traversc/qs - -script: - - ./run.sh run_tests && free -h && Rscript tests/correctness_testing.R && free -h - -after_failure: - - ./run.sh dump_logs - -notifications: - email: - on_success: change - on_failure: change diff --git a/ChangeLog b/ChangeLog index f771991..84503b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Version 0.25.2 (2021-11-6) + * Update autoconf to version 2.6.9 (autoupdate; autoreconf --warnings=obsolete) + * Include tests/ folder in build/check process + * Add `encode_source` and `decode_source` -- helper functions for inlining files and documents + Version 0.25.1 (2021-7-20) * Add `qcache` helper function * Remove immediate binding expansion, as it is not part of the R API (comments from CRAN/Luke Tierney). Instead, use the `findVarsInFrame` function to extract immediate bindings from environments. diff --git a/DESCRIPTION b/DESCRIPTION index 413f2dc..0fdb655 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: qs Type: Package Title: Quick Serialization of R Objects -Version: 0.25.1 -Date: 2021-7-24 +Version: 0.25.2 +Date: 2021-11-7 Authors@R: c( person("Travers", "Ching", email = "traversc@gmail.com", role = c("aut", "cre", "cph")), person("Yann", "Collet", role = c("ctb", "cph"), comment = "Yann Collet is the author of the bundled zstd, lz4 and xxHash code"), @@ -24,7 +24,7 @@ Imports: Rcpp, RApiSerialize, stringfish (>= 0.15.1) LinkingTo: Rcpp, RApiSerialize, stringfish RoxygenNote: 7.1.1 -Suggests: knitr, rmarkdown +Suggests: knitr, rmarkdown, teststhat, dplyr, data.table VignetteBuilder: knitr Copyright: This package includes code from the 'zstd' library owned by Facebook, Inc. and created by Yann Collet; the 'lz4' library created and owned by Yann Collet; xxHash library created and owned by Yann Collet; and code derived from the 'Blosc' library created and owned by Francesc Alted. URL: https://github.com/traversc/qs diff --git a/Makefile b/Makefile index 9a8e74a..a39f47e 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,13 @@ check: $(BUILD) R CMD check --as-cran $< check-cran: $(BUILD) - # R --interactive --no-save --args $< <<<'rhub::check_for_cran(commandArgs(T)[1])' - # Rscript -e "rhub::check_on_solaris()" - Rscript -e 'rhub::check("$(BUILD)", platform = c("ubuntu-gcc-devel", "windows-x86_64-devel", "solaris-x86-patched", "linux-x86_64-rocker-gcc-san"))' + Rscript -e 'rhub::check("$(BUILD)", platform = c("ubuntu-gcc-devel", "windows-x86_64-devel", "solaris-x86-patched", "macos-m1-bigsur-release"))' + +check-solaris: $(BUILD) + Rscript -e 'rhub::check("$(BUILD)", platform = c("solaris-x86-patched"))' + +check-m1: $(BUILD) + Rscript -e 'rhub::check("$(BUILD)", platform = c("macos-m1-bigsur-release"))' build: autoconf @@ -51,16 +55,14 @@ vignette: sed -r -i 's/\((.+)\.png/\(vignettes\/\1\.png/' README.md test: + Rscript tests/qsavemload_testing.R Rscript tests/correctness_testing.R filestream Rscript tests/correctness_testing.R fd Rscript tests/correctness_testing.R memory - Rscript tests/regression_testing.R + Rscript inst/extra_tests/regression_testing.R testext: - Rscript tests/correctness_testing_extended.R - -testqsavem: - Rscript tests/qsavemload_testing.R + Rscript inst/extra_tests/correctness_testing_extended.R bench: - Rscript tests/benchmark_testing.R + Rscript inst/extra_tests/benchmark_testing.R diff --git a/NAMESPACE b/NAMESPACE index d80db5c..3dd7ee2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -31,4 +31,6 @@ export("qsave", "qsavem", "qreadm", "qload", - "qcache") + "qcache", + "encode_source", + "decode_source") diff --git a/R/RcppExports.R b/R/RcppExports.R index 0654dde..72ed191 100755 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -53,12 +53,12 @@ base85_decode <- function(encoded_string) { .Call(`_qs_base85_decode`, encoded_string) } -base91_encode <- function(rawdata) { - .Call(`_qs_base91_encode`, rawdata) +c_base91_encode <- function(rawdata) { + .Call(`_qs_c_base91_encode`, rawdata) } -base91_decode <- function(encoded_string) { - .Call(`_qs_base91_decode`, encoded_string) +c_base91_decode <- function(encoded_string) { + .Call(`_qs_c_base91_decode`, encoded_string) } is_big_endian <- function() { diff --git a/R/ascii_encoding.r b/R/ascii_encoding.r new file mode 100755 index 0000000..611cc30 --- /dev/null +++ b/R/ascii_encoding.r @@ -0,0 +1,107 @@ +#' Z85 Encoding +#' +#' Encodes binary data (a raw vector) as ascii text using Z85 encoding format +#' @usage base85_encode(rawdata) +#' @param rawdata A raw vector +#' @return A string representation of the raw vector. +#' @details +#' Z85 is a binary to ascii encoding format created by Pieter Hintjens in 2010 and is part of the ZeroMQ RFC. +#' The encoding has a dictionary using 85 out of 94 printable ASCII characters. +#' There are other base 85 encoding schemes, including Ascii85, which is popularized and used by Adobe. +#' Z85 is distinguished by its choice of dictionary, which is suitable for easier inclusion into source code for many programming languages. +#' The dictionary excludes all quote marks and other control characters, and requires no special treatment in R and most other languages. +#' Note: although the official specification restricts input length to multiples of four bytes, the implementation here works with any input length. +#' The overhead (extra bytes used relative to binary) is 25\%. In comparison, base 64 encoding has an overhead of 33.33\%. + +#' @references https://rfc.zeromq.org/spec/32/ +#' @name base85_encode +NULL + +#' Z85 Decoding +#' +#' Decodes a Z85 encoded string back to binary +#' @usage base85_decode(encoded_string) +#' @param encoded_string A string +#' @return The original raw vector. +#' @name base85_decode +NULL + +#' basE91 Encoding +#' +#' Encodes binary data (a raw vector) as ascii text using basE91 encoding format +#' @usage base91_encode(rawdata, quote_character = "\"") +#' @param rawdata A raw vector +#' @param quote_character The character to use in the encoding, replacing the double quote character. Must be a single quote "'", double quote "\"" or dash "-". +#' @return A string representation of the raw vector. +#' @details +#' basE91 (capital E for stylization) is a binary to ascii encoding format created by Joachim Henke in 2005. +#' The overhead (extra bytes used relative to binary) is 22.97\% on average. In comparison, base 64 encoding has an overhead of 33.33\%. +#' The original encoding uses a dictionary of 91 out of 94 printable ASCII characters excluding - (dash), \ (backslash) and ' (single quote). +#' The original encoding does include double quote characters, which are less than ideal for strings in R. Therefore, +#' you can use the `quote_character` parameter to substitute dash or single quote. +#' @references http://base91.sourceforge.net/ +base91_encode <- function(rawdata, quote_character = "\"") { + if(!quote_character %in% c("\"", "'", "-")) { + stop("quote_character must be a dash, single quote or double quote.") + } + result <- .Call(`_qs_c_base91_encode`, rawdata) + gsub("\"", quote_character, result) +} + +#' basE91 Decoding +#' +#' Decodes a basE91 encoded string back to binary +#' @usage base91_decode(encoded_string) +#' @param encoded_string A string +#' @return The original raw vector. +base91_decode <- function(encoded_string) { + stopifnot(length(encoded_string) == 1) + has_double_quote <- grepl("\"", encoded_string) + has_single_quote <- grepl("'", encoded_string) + has_dash <- grepl("-", encoded_string) + if(has_double_quote + has_single_quote + has_dash > 1) { + stop("Format error: dash, single quote and double quote characters are mutually exclusive for base91 encoding.") + } + encoded_string <- gsub("'", "\"", encoded_string) + encoded_string <- gsub("-", "\"", encoded_string) + .Call(`_qs_c_base91_decode`, encoded_string) +} + +#' Encode and compress a file or string +#' +#' A helper function for encoding and compressing a file or string to ascii using `base91_encode` and `qserialize` with the highest compression level. +#' @usage encode_source(file = NULL, string = NULL, width = 120) +#' @param file The file to encode (if `string` is not NULL) +#' @param string The string to encode (if `file` is not NULL) +#' @param width The output will be broken up into individual strings, with `width` being the longest allowable string. +#' @return A CharacterVector in base91 representing the compressed original file or string. +encode_source <- function(file = NULL, string = NULL, width = 120) { + if(!is.null(file)) { + n <- file.info(file)$size + x <- readChar(con = file, nchars=n, useBytes = TRUE) + } else if(!is.null(string)) { + x <- string + } else { + stop("either file or string must not be NULL.") + } + x <- qserialize(x, preset = "custom", algorithm = "zstd", compress_level = 22) + x <- base91_encode(x, "'") + starts <- seq(1,nchar(x), by=width) + x <- sapply(starts, function(i) { + substr(x, i, i+width-1) + }) + x +} + +#' Decode a compressed string +#' +#' A helper function for encoding and compressing a file or string to ascii using `base91_encode` and `qserialize` with the highest compression level. +#' @usage decode_source(string) +#' @param string The string to decode +#' @return The original (decoded) string. +decode_source <- function(string) { + x <- paste0(string, collapse = "") + x <- base91_decode(x) + qdeserialize(x) +} + diff --git a/R/help_files.R b/R/zz_help_files.R similarity index 88% rename from R/help_files.R rename to R/zz_help_files.R index 6b82006..d1649b8 100755 --- a/R/help_files.R +++ b/R/zz_help_files.R @@ -436,50 +436,3 @@ catquo <- function(...) { cat("'", ..., "'\n", sep = "") } -#' basE91 Encoding -#' -#' Encodes binary data (a raw vector) as ascii text using basE91 encoding format -#' @usage base91_encode(rawdata) -#' @param rawdata A raw vector -#' @details -#' basE91 (capital E for stylization) is a binary to ascii encoding format created by Joachim Henke in 2005. -#' The encoding has a dictionary using 91 out of 94 printable ASCII characters; excludes - (dash), \ (backslash) and ' (single quote). -#' The overhead (extra bytes used relative to binary) is 22.97\% on average. In comparison, base 64 encoding has an overhead of 33.33\%. -#' Because the dictionary includes double quotes, basE91 encoded data must be single quoted when stored as a string in R. -#' @references http://base91.sourceforge.net/ -#' @name base91_encode -NULL - -#' basE91 Decoding -#' -#' Decodes a basE91 encoded string back to binary -#' @usage base91_decode(encoded_string) -#' @param encoded_string A string -#' @name base91_decode -NULL - -#' Z85 Encoding -#' -#' Encodes binary data (a raw vector) as ascii text using Z85 encoding format -#' @usage base85_encode(rawdata) -#' @param rawdata A raw vector -#' @details -#' Z85 is a binary to ascii encoding format created by Pieter Hintjens in 2010 and is part of the ZeroMQ RFC. -#' The encoding has a dictionary using 85 out of 94 printable ASCII characters. -#' There are other base 85 encoding schemes, including Ascii85, which is popularized and used by Adobe. -#' Z85 is distinguished by its choice of dictionary, which is suitable for easier inclusion into source code for many programming languages. -#' The dictionary excludes all quote marks and other control characters, and requires no special treatment in R and most other languages. -#' Note: although the official specification restricts input length to multiples of four bytes, the implementation here works with any input length. -#' The overhead (extra bytes used relative to binary) is 25\%. In comparison, base 64 encoding has an overhead of 33.33\%. - -#' @references https://rfc.zeromq.org/spec/32/ -#' @name base85_encode -NULL - -#' Z85 Decoding -#' -#' Decodes a Z85 encoded string back to binary -#' @usage base85_decode(encoded_string) -#' @param encoded_string A string -#' @name base85_decode -NULL diff --git a/README.md b/README.md old mode 100644 new mode 100755 index b2a1b88..07bc41e --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ Using qs -[![Build -Status](https://travis-ci.org/traversc/qs.svg)](https://travis-ci.org/traversc/qs) + + [![R-CMD-check](https://github.com/traversc/qs/workflows/R-CMD-check/badge.svg)](https://github.com/traversc/qs/actions) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/qs)](https://cran.r-project.org/package=qs) [![CRAN\_Downloads\_Badge](https://cranlogs.r-pkg.org/badges/qs)](https://cran.r-project.org/package=qs) diff --git a/configure.ac b/configure.ac index cab19e3..75d0b38 100755 --- a/configure.ac +++ b/configure.ac @@ -1,42 +1,35 @@ -AC_INIT(qs, 0.22.1, traversc@gmail.com) +AC_INIT([qs],[0.22.1],[traversc@gmail.com]) AC_PATH_PROG([PKGCONF],[pkg-config],[],[$PATH:/usr/local/bin:ext/bin:ext:/sw/bin:/opt/bin:/opt/local/bin]) ######################################################## ### Configure args AC_ARG_WITH([zstd-force-compile], - AC_HELP_STRING([--with-zstd-force-compile], - [Force compilation of bundled zstd source files]), + AS_HELP_STRING([--with-zstd-force-compile],[Force compilation of bundled zstd source files]), [zstd_force_compile="true"]) AC_ARG_WITH([lz4-force-compile], - AC_HELP_STRING([--with-lz4-force-compile], - [Force compilation of bundled lz4 source files]), + AS_HELP_STRING([--with-lz4-force-compile],[Force compilation of bundled lz4 source files]), [lz4_force_compile="true"]) AC_ARG_WITH([zstd-include], - AC_HELP_STRING([--with-zstd-include=INCLUDE_PATH], - [the location of zstd header files]), + AS_HELP_STRING([--with-zstd-include=INCLUDE_PATH],[the location of zstd header files]), [zstd_include_path=$withval]) AC_ARG_WITH([zstd-lib], - AC_HELP_STRING([--with-zstd-lib=LIB_PATH], - [the location of zstd library files]), + AS_HELP_STRING([--with-zstd-lib=LIB_PATH],[the location of zstd library files]), [zstd_lib_path=$withval]) AC_ARG_WITH([lz4-include], - AC_HELP_STRING([--with-lz4-include=INCLUDE_PATH], - [the location of lz4 header files]), + AS_HELP_STRING([--with-lz4-include=INCLUDE_PATH],[the location of lz4 header files]), [lz4_include_path=$withval]) AC_ARG_WITH([lz4-lib], - AC_HELP_STRING([--with-lz4-lib=LIB_PATH], - [the location of lz4 library files]), + AS_HELP_STRING([--with-lz4-lib=LIB_PATH],[the location of lz4 library files]), [lz4_lib_path=$withval]) AC_ARG_WITH([simd], - AC_HELP_STRING([--with-simd], - [Manually select SIMD support (options: AVX2, SSE2)]), + AS_HELP_STRING([--with-simd],[Manually select SIMD support (options: AVX2, SSE2)]), [with_simd=$withval]) diff --git a/tests/benchmark_testing.R b/inst/extra_tests/benchmark_testing.R similarity index 100% rename from tests/benchmark_testing.R rename to inst/extra_tests/benchmark_testing.R diff --git a/tests/benchmark_testing_between_versions.R b/inst/extra_tests/benchmark_testing_between_versions.R similarity index 100% rename from tests/benchmark_testing_between_versions.R rename to inst/extra_tests/benchmark_testing_between_versions.R diff --git a/tests/correctness_testing_extended.R b/inst/extra_tests/correctness_testing_extended.R similarity index 100% rename from tests/correctness_testing_extended.R rename to inst/extra_tests/correctness_testing_extended.R diff --git a/tests/regression_testing.R b/inst/extra_tests/regression_testing.R similarity index 100% rename from tests/regression_testing.R rename to inst/extra_tests/regression_testing.R diff --git a/tests/revdep_check.R b/inst/extra_tests/revdep_check.R similarity index 100% rename from tests/revdep_check.R rename to inst/extra_tests/revdep_check.R diff --git a/inst/include/qs_RcppExports.h b/inst/include/qs_RcppExports.h index fe18f9f..911baaf 100644 --- a/inst/include/qs_RcppExports.h +++ b/inst/include/qs_RcppExports.h @@ -285,16 +285,16 @@ namespace qs { return Rcpp::as(rcpp_result_gen); } - inline std::string base91_encode(const RawVector& rawdata) { - typedef SEXP(*Ptr_base91_encode)(SEXP); - static Ptr_base91_encode p_base91_encode = NULL; - if (p_base91_encode == NULL) { - validateSignature("std::string(*base91_encode)(const RawVector&)"); - p_base91_encode = (Ptr_base91_encode)R_GetCCallable("qs", "_qs_base91_encode"); + inline std::string c_base91_encode(const RawVector& rawdata) { + typedef SEXP(*Ptr_c_base91_encode)(SEXP); + static Ptr_c_base91_encode p_c_base91_encode = NULL; + if (p_c_base91_encode == NULL) { + validateSignature("std::string(*c_base91_encode)(const RawVector&)"); + p_c_base91_encode = (Ptr_c_base91_encode)R_GetCCallable("qs", "_qs_c_base91_encode"); } RObject rcpp_result_gen; { - rcpp_result_gen = p_base91_encode(Shield(Rcpp::wrap(rawdata))); + rcpp_result_gen = p_c_base91_encode(Shield(Rcpp::wrap(rawdata))); } if (rcpp_result_gen.inherits("interrupted-error")) throw Rcpp::internal::InterruptedException(); @@ -305,16 +305,16 @@ namespace qs { return Rcpp::as(rcpp_result_gen); } - inline RawVector base91_decode(const std::string& encoded_string) { - typedef SEXP(*Ptr_base91_decode)(SEXP); - static Ptr_base91_decode p_base91_decode = NULL; - if (p_base91_decode == NULL) { - validateSignature("RawVector(*base91_decode)(const std::string&)"); - p_base91_decode = (Ptr_base91_decode)R_GetCCallable("qs", "_qs_base91_decode"); + inline RawVector c_base91_decode(const std::string& encoded_string) { + typedef SEXP(*Ptr_c_base91_decode)(SEXP); + static Ptr_c_base91_decode p_c_base91_decode = NULL; + if (p_c_base91_decode == NULL) { + validateSignature("RawVector(*c_base91_decode)(const std::string&)"); + p_c_base91_decode = (Ptr_c_base91_decode)R_GetCCallable("qs", "_qs_c_base91_decode"); } RObject rcpp_result_gen; { - rcpp_result_gen = p_base91_decode(Shield(Rcpp::wrap(encoded_string))); + rcpp_result_gen = p_c_base91_decode(Shield(Rcpp::wrap(encoded_string))); } if (rcpp_result_gen.inherits("interrupted-error")) throw Rcpp::internal::InterruptedException(); diff --git a/man/base85_decode.Rd b/man/base85_decode.Rd index 9f5574a..2fba442 100644 --- a/man/base85_decode.Rd +++ b/man/base85_decode.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/ascii_encoding.r \name{base85_decode} \alias{base85_decode} \title{Z85 Decoding} @@ -9,6 +9,9 @@ base85_decode(encoded_string) \arguments{ \item{encoded_string}{A string} } +\value{ +The original raw vector. +} \description{ Decodes a Z85 encoded string back to binary } diff --git a/man/base85_encode.Rd b/man/base85_encode.Rd index a59c79f..efafdff 100644 --- a/man/base85_encode.Rd +++ b/man/base85_encode.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/ascii_encoding.r \name{base85_encode} \alias{base85_encode} \title{Z85 Encoding} @@ -9,6 +9,9 @@ base85_encode(rawdata) \arguments{ \item{rawdata}{A raw vector} } +\value{ +A string representation of the raw vector. +} \description{ Encodes binary data (a raw vector) as ascii text using Z85 encoding format } diff --git a/man/base91_decode.Rd b/man/base91_decode.Rd index ef28541..0dbf6d2 100644 --- a/man/base91_decode.Rd +++ b/man/base91_decode.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/ascii_encoding.r \name{base91_decode} \alias{base91_decode} \title{basE91 Decoding} @@ -9,6 +9,9 @@ base91_decode(encoded_string) \arguments{ \item{encoded_string}{A string} } +\value{ +The original raw vector. +} \description{ Decodes a basE91 encoded string back to binary } diff --git a/man/base91_encode.Rd b/man/base91_encode.Rd index e742e4c..80c2eef 100644 --- a/man/base91_encode.Rd +++ b/man/base91_encode.Rd @@ -1,22 +1,28 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/ascii_encoding.r \name{base91_encode} \alias{base91_encode} \title{basE91 Encoding} \usage{ -base91_encode(rawdata) +base91_encode(rawdata, quote_character = "\"") } \arguments{ \item{rawdata}{A raw vector} + +\item{quote_character}{The character to use in the encoding, replacing the double quote character. Must be a single quote "'", double quote "\"" or dash "-".} +} +\value{ +A string representation of the raw vector. } \description{ Encodes binary data (a raw vector) as ascii text using basE91 encoding format } \details{ basE91 (capital E for stylization) is a binary to ascii encoding format created by Joachim Henke in 2005. -The encoding has a dictionary using 91 out of 94 printable ASCII characters; excludes - (dash), \ (backslash) and ' (single quote). The overhead (extra bytes used relative to binary) is 22.97\% on average. In comparison, base 64 encoding has an overhead of 33.33\%. -Because the dictionary includes double quotes, basE91 encoded data must be single quoted when stored as a string in R. +The original encoding uses a dictionary of 91 out of 94 printable ASCII characters excluding - (dash), \ (backslash) and ' (single quote). +The original encoding does include double quote characters, which are less than ideal for strings in R. Therefore, +you can use the `quote_character` parameter to substitute dash or single quote. } \references{ http://base91.sourceforge.net/ diff --git a/man/blosc_shuffle_raw.Rd b/man/blosc_shuffle_raw.Rd index b47a8c4..cb9e05d 100755 --- a/man/blosc_shuffle_raw.Rd +++ b/man/blosc_shuffle_raw.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{blosc_shuffle_raw} \alias{blosc_shuffle_raw} \title{Shuffle a raw vector} diff --git a/man/blosc_unshuffle_raw.Rd b/man/blosc_unshuffle_raw.Rd index 0963e73..77b37c5 100755 --- a/man/blosc_unshuffle_raw.Rd +++ b/man/blosc_unshuffle_raw.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{blosc_unshuffle_raw} \alias{blosc_unshuffle_raw} \title{Un-shuffle a raw vector} diff --git a/man/catquo.Rd b/man/catquo.Rd index 611a8c1..39a2275 100644 --- a/man/catquo.Rd +++ b/man/catquo.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{catquo} \alias{catquo} \title{catquo} diff --git a/man/decode_source.Rd b/man/decode_source.Rd new file mode 100755 index 0000000..7cb5c77 --- /dev/null +++ b/man/decode_source.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ascii_encoding.r +\name{decode_source} +\alias{decode_source} +\title{Decode a compressed string} +\usage{ +decode_source(string) +} +\arguments{ +\item{string}{The string to decode} +} +\value{ +The original (decoded) string. +} +\description{ +A helper function for encoding and compressing a file or string to ascii using `base91_encode` and `qserialize` with the highest compression level. +} diff --git a/man/encode_source.Rd b/man/encode_source.Rd new file mode 100755 index 0000000..88196d7 --- /dev/null +++ b/man/encode_source.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ascii_encoding.r +\name{encode_source} +\alias{encode_source} +\title{Encode and compress a file or string} +\usage{ +encode_source(file = NULL, string = NULL, width = 120) +} +\arguments{ +\item{file}{The file to encode (if `string` is not NULL)} + +\item{string}{The string to encode (if `file` is not NULL)} + +\item{width}{The output will be broken up into individual strings, with `width` being the longest allowable string.} +} +\value{ +A CharacterVector in base91 representing the compressed original file or string. +} +\description{ +A helper function for encoding and compressing a file or string to ascii using `base91_encode` and `qserialize` with the highest compression level. +} diff --git a/man/is_big_endian.Rd b/man/is_big_endian.Rd index 06b1b20..b79f336 100755 --- a/man/is_big_endian.Rd +++ b/man/is_big_endian.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{is_big_endian} \alias{is_big_endian} \title{System Endianness} diff --git a/man/lz4_compress_bound.Rd b/man/lz4_compress_bound.Rd index 71ebc80..d07ff39 100755 --- a/man/lz4_compress_bound.Rd +++ b/man/lz4_compress_bound.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{lz4_compress_bound} \alias{lz4_compress_bound} \title{lz4 compress bound} diff --git a/man/lz4_compress_raw.Rd b/man/lz4_compress_raw.Rd index 9cb8eda..93ca254 100755 --- a/man/lz4_compress_raw.Rd +++ b/man/lz4_compress_raw.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{lz4_compress_raw} \alias{lz4_compress_raw} \title{lz4 compression} diff --git a/man/lz4_decompress_raw.Rd b/man/lz4_decompress_raw.Rd index 9cb9128..bce082e 100755 --- a/man/lz4_decompress_raw.Rd +++ b/man/lz4_decompress_raw.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{lz4_decompress_raw} \alias{lz4_decompress_raw} \title{lz4 decompression} diff --git a/man/qdeserialize.Rd b/man/qdeserialize.Rd index b5410a3..d1131a5 100644 --- a/man/qdeserialize.Rd +++ b/man/qdeserialize.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qdeserialize} \alias{qdeserialize} \title{qdeserialize} diff --git a/man/qdump.Rd b/man/qdump.Rd index f4c94f1..ab0192f 100644 --- a/man/qdump.Rd +++ b/man/qdump.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qdump} \alias{qdump} \title{qdump} diff --git a/man/qread.Rd b/man/qread.Rd index 799afb2..8e20331 100644 --- a/man/qread.Rd +++ b/man/qread.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qread} \alias{qread} \title{qread} diff --git a/man/qread_fd.Rd b/man/qread_fd.Rd index e35227c..9d50d8e 100644 --- a/man/qread_fd.Rd +++ b/man/qread_fd.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qread_fd} \alias{qread_fd} \title{qread_fd} diff --git a/man/qread_handle.Rd b/man/qread_handle.Rd index bbff66a..3b9974f 100644 --- a/man/qread_handle.Rd +++ b/man/qread_handle.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qread_handle} \alias{qread_handle} \title{qread_handle} diff --git a/man/qread_ptr.Rd b/man/qread_ptr.Rd index 86f1ea8..6f7e64a 100644 --- a/man/qread_ptr.Rd +++ b/man/qread_ptr.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qread_ptr} \alias{qread_ptr} \title{qread_ptr} diff --git a/man/qsave.Rd b/man/qsave.Rd index ba18b45..cb75b44 100644 --- a/man/qsave.Rd +++ b/man/qsave.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qsave} \alias{qsave} \title{qsave} diff --git a/man/qsave_fd.Rd b/man/qsave_fd.Rd index d1ac7b2..cec1f5a 100644 --- a/man/qsave_fd.Rd +++ b/man/qsave_fd.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qsave_fd} \alias{qsave_fd} \title{qsave_fd} diff --git a/man/qsave_handle.Rd b/man/qsave_handle.Rd index 0415954..31a72d0 100644 --- a/man/qsave_handle.Rd +++ b/man/qsave_handle.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qsave_handle} \alias{qsave_handle} \title{qsave_handle} diff --git a/man/qserialize.Rd b/man/qserialize.Rd index b2e4d6d..e2fd8e2 100644 --- a/man/qserialize.Rd +++ b/man/qserialize.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{qserialize} \alias{qserialize} \title{qserialize} diff --git a/man/starnames.Rd b/man/starnames.Rd index 03236aa..a5be7e0 100755 --- a/man/starnames.Rd +++ b/man/starnames.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \docType{data} \name{starnames} \alias{starnames} diff --git a/man/zstd_compress_bound.Rd b/man/zstd_compress_bound.Rd index 89ea979..a552f60 100644 --- a/man/zstd_compress_bound.Rd +++ b/man/zstd_compress_bound.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{zstd_compress_bound} \alias{zstd_compress_bound} \title{Zstd compress bound} diff --git a/man/zstd_compress_raw.Rd b/man/zstd_compress_raw.Rd index b0041b5..086e3ce 100755 --- a/man/zstd_compress_raw.Rd +++ b/man/zstd_compress_raw.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{zstd_compress_raw} \alias{zstd_compress_raw} \title{Zstd compression} diff --git a/man/zstd_decompress_raw.Rd b/man/zstd_decompress_raw.Rd index f4b9c85..3d37114 100755 --- a/man/zstd_decompress_raw.Rd +++ b/man/zstd_decompress_raw.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/help_files.R +% Please edit documentation in R/zz_help_files.R \name{zstd_decompress_raw} \alias{zstd_decompress_raw} \title{Zstd decompression} diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 80d2348..22f0c19 100755 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -448,20 +448,20 @@ RcppExport SEXP _qs_base85_decode(SEXP encoded_stringSEXP) { UNPROTECT(1); return rcpp_result_gen; } -// base91_encode -std::string base91_encode(const RawVector& rawdata); -static SEXP _qs_base91_encode_try(SEXP rawdataSEXP) { +// c_base91_encode +std::string c_base91_encode(const RawVector& rawdata); +static SEXP _qs_c_base91_encode_try(SEXP rawdataSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::traits::input_parameter< const RawVector& >::type rawdata(rawdataSEXP); - rcpp_result_gen = Rcpp::wrap(base91_encode(rawdata)); + rcpp_result_gen = Rcpp::wrap(c_base91_encode(rawdata)); return rcpp_result_gen; END_RCPP_RETURN_ERROR } -RcppExport SEXP _qs_base91_encode(SEXP rawdataSEXP) { +RcppExport SEXP _qs_c_base91_encode(SEXP rawdataSEXP) { SEXP rcpp_result_gen; { - rcpp_result_gen = PROTECT(_qs_base91_encode_try(rawdataSEXP)); + rcpp_result_gen = PROTECT(_qs_c_base91_encode_try(rawdataSEXP)); } Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error"); if (rcpp_isInterrupt_gen) { @@ -481,20 +481,20 @@ RcppExport SEXP _qs_base91_encode(SEXP rawdataSEXP) { UNPROTECT(1); return rcpp_result_gen; } -// base91_decode -RawVector base91_decode(const std::string& encoded_string); -static SEXP _qs_base91_decode_try(SEXP encoded_stringSEXP) { +// c_base91_decode +RawVector c_base91_decode(const std::string& encoded_string); +static SEXP _qs_c_base91_decode_try(SEXP encoded_stringSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::traits::input_parameter< const std::string& >::type encoded_string(encoded_stringSEXP); - rcpp_result_gen = Rcpp::wrap(base91_decode(encoded_string)); + rcpp_result_gen = Rcpp::wrap(c_base91_decode(encoded_string)); return rcpp_result_gen; END_RCPP_RETURN_ERROR } -RcppExport SEXP _qs_base91_decode(SEXP encoded_stringSEXP) { +RcppExport SEXP _qs_c_base91_decode(SEXP encoded_stringSEXP) { SEXP rcpp_result_gen; { - rcpp_result_gen = PROTECT(_qs_base91_decode_try(encoded_stringSEXP)); + rcpp_result_gen = PROTECT(_qs_c_base91_decode_try(encoded_stringSEXP)); } Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error"); if (rcpp_isInterrupt_gen) { @@ -1416,8 +1416,8 @@ static int _qs_RcppExport_validate(const char* sig) { signatures.insert("SEXP(*convertToAlt)(const CharacterVector&)"); signatures.insert("std::string(*base85_encode)(const RawVector&)"); signatures.insert("RawVector(*base85_decode)(const std::string&)"); - signatures.insert("std::string(*base91_encode)(const RawVector&)"); - signatures.insert("RawVector(*base91_decode)(const std::string&)"); + signatures.insert("std::string(*c_base91_encode)(const RawVector&)"); + signatures.insert("RawVector(*c_base91_decode)(const std::string&)"); signatures.insert("bool(*is_big_endian)()"); signatures.insert("double(*qsave)(SEXP const,const std::string&,const std::string,const std::string,const int,const int,const bool,const int)"); signatures.insert("double(*c_qsave)(SEXP const,const std::string&,const std::string,const std::string,const int,const int,const bool,const int)"); @@ -1462,8 +1462,8 @@ RcppExport SEXP _qs_RcppExport_registerCCallable() { R_RegisterCCallable("qs", "_qs_convertToAlt", (DL_FUNC)_qs_convertToAlt_try); R_RegisterCCallable("qs", "_qs_base85_encode", (DL_FUNC)_qs_base85_encode_try); R_RegisterCCallable("qs", "_qs_base85_decode", (DL_FUNC)_qs_base85_decode_try); - R_RegisterCCallable("qs", "_qs_base91_encode", (DL_FUNC)_qs_base91_encode_try); - R_RegisterCCallable("qs", "_qs_base91_decode", (DL_FUNC)_qs_base91_decode_try); + R_RegisterCCallable("qs", "_qs_c_base91_encode", (DL_FUNC)_qs_c_base91_encode_try); + R_RegisterCCallable("qs", "_qs_c_base91_decode", (DL_FUNC)_qs_c_base91_decode_try); R_RegisterCCallable("qs", "_qs_is_big_endian", (DL_FUNC)_qs_is_big_endian_try); R_RegisterCCallable("qs", "_qs_qsave", (DL_FUNC)_qs_qsave_try); R_RegisterCCallable("qs", "_qs_c_qsave", (DL_FUNC)_qs_c_qsave_try); @@ -1507,8 +1507,8 @@ static const R_CallMethodDef CallEntries[] = { {"_qs_convertToAlt", (DL_FUNC) &_qs_convertToAlt, 1}, {"_qs_base85_encode", (DL_FUNC) &_qs_base85_encode, 1}, {"_qs_base85_decode", (DL_FUNC) &_qs_base85_decode, 1}, - {"_qs_base91_encode", (DL_FUNC) &_qs_base91_encode, 1}, - {"_qs_base91_decode", (DL_FUNC) &_qs_base91_decode, 1}, + {"_qs_c_base91_encode", (DL_FUNC) &_qs_c_base91_encode, 1}, + {"_qs_c_base91_decode", (DL_FUNC) &_qs_c_base91_decode, 1}, {"_qs_is_big_endian", (DL_FUNC) &_qs_is_big_endian, 0}, {"_qs_qsave", (DL_FUNC) &_qs_qsave, 8}, {"_qs_c_qsave", (DL_FUNC) &_qs_c_qsave, 8}, diff --git a/src/extra_functions.h b/src/extra_functions.h index 8f54070..b9b157a 100644 --- a/src/extra_functions.h +++ b/src/extra_functions.h @@ -306,7 +306,7 @@ RawVector base85_decode(const std::string & encoded_string) { } // [[Rcpp::export(rng = false)]] -std::string base91_encode(const RawVector & rawdata) { +std::string c_base91_encode(const RawVector & rawdata) { basE91 b = basE91(); size_t size = Rf_xlength(rawdata); size_t outsize = basE91_encode_bound(size); @@ -318,7 +318,7 @@ std::string base91_encode(const RawVector & rawdata) { } // [[Rcpp::export(rng = false)]] -RawVector base91_decode(const std::string & encoded_string) { +RawVector c_base91_decode(const std::string & encoded_string) { basE91 b = basE91(); size_t size = encoded_string.size(); size_t outsize = basE91_decode_bound(size); diff --git a/src/qs_functions.cpp b/src/qs_functions.cpp index c2037cb..a2ba36a 100644 --- a/src/qs_functions.cpp +++ b/src/qs_functions.cpp @@ -26,7 +26,7 @@ #include "qs_mt_deserialization.h" #include "qs_serialization_stream.h" #include "qs_deserialization_stream.h" -#include "extra_functions.h" // should we try to compile in a seperate unit? Would probably need to inline everything in qs_common.h +#include "extra_functions.h" /* * headers: @@ -42,8 +42,7 @@ // https://stackoverflow.com/a/1001373 // [[Rcpp::export(rng = false)]] -bool is_big_endian() -{ +bool is_big_endian() { union { uint32_t i; char c[4]; diff --git a/tests/correctness_testing.R b/tests/correctness_testing.R index d0875de..f0b202d 100755 --- a/tests/correctness_testing.R +++ b/tests/correctness_testing.R @@ -5,6 +5,14 @@ suppressMessages(library(qs)) suppressMessages(library(stringfish)) options(warn=1) +sourceCpp(code = decode_source( +c("un]'BAAA@QRtHACAAAAAAA+>nAAAv7#aT)JXC:JAR%*QaAh72AB'B'vw5pac6M6_%ygB8MFP)gz)^m++prny$p$2zd4,TjRyD]#^IDs$AEA.Iln5o|!b6Rg,?H[7:4>fVhjk;Elgs[t~/2QV.smWKr)qciq:,gJ.WM#<7X[GTC*H}p8LL/GQv]6d>R=O>iPUN11/~8!@P^g#xecEHjR>JF<,zuB", + "8d@Aq1w1Wu;h`BaHYM2BlL6'_X((9Fn4,ns<9^5xcw[_.)4nTTMPw~^2pcKT)+g&])=3]x2;(q7gVbF5qI7RS.hY;}@^Pu~Qxr5/V!#B6}G{Csfkb&I^Xe;hLkO}dX;5`'Wd8?BvZ*@laa2qbX{L%h{E2WwF+}2aDp01lLf&+8HLAbetZ_hlWHeGgi|Xl.U@;O~RhGYsXC1e}#R]e=ky)DZ>Lku@C8Iy"))) + args <- commandArgs(T) if(length(args) == 0) { mode <- "filestream" @@ -17,58 +25,6 @@ if(length(args) < 2) { reps <- as.numeric(args[2]) } -Sys.setenv("PKG_CXXFLAGS"="-std=c++11") -cppFunction("CharacterVector splitstr(std::string x, std::vector cuts){ - CharacterVector ret(cuts.size() - 1); - for(uint64_t i=1; i list_elements){ - auto randchar = []() -> char - { - const char charset[] = - "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz"; - const size_t max_index = (sizeof(charset) - 1); - return charset[ rand() % max_index ]; - }; - List ret(list_elements.size()); - std::string str(10,0); - for(size_t i=0; i(rand()); - break; - } - } - return ret; - }') - obj_size <- 0; max_size <- 1e7 get_obj_size <- function() { get("obj_size", envir=globalenv()) diff --git a/vignettes/vignette.html b/vignettes/vignette.html index 9b1a066..4271791 100755 --- a/vignettes/vignette.html +++ b/vignettes/vignette.html @@ -603,7 +603,9 @@

Using qs

-

Build Status R-CMD-check CRAN_Status_Badge CRAN_Downloads_Badge CRAN_Downloads_Total_Badge

+ + +

R-CMD-check CRAN_Status_Badge CRAN_Downloads_Badge CRAN_Downloads_Total_Badge

Quick serialization of R objects

qs provides an interface for quickly saving and reading objects to and from disk. The goal of this package is to provide a lightning-fast and complete replacement for the saveRDS and readRDS functions in R.

Inspired by the fst package, qs uses a similar block-compression design using either the lz4 or zstd compression libraries. It differs in that it applies a more general approach for attributes and object references.

diff --git a/vignettes/vignette.rmd b/vignettes/vignette.rmd index ddfbca7..85bcc2a 100755 --- a/vignettes/vignette.rmd +++ b/vignettes/vignette.rmd @@ -12,7 +12,7 @@ vignette: > -[![Build Status](https://travis-ci.org/traversc/qs.svg)](https://travis-ci.org/traversc/qs) + [![R-CMD-check](https://github.com/traversc/qs/workflows/R-CMD-check/badge.svg)](https://github.com/traversc/qs/actions) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/qs)](https://cran.r-project.org/package=qs) [![CRAN\_Downloads\_Badge](https://cranlogs.r-pkg.org/badges/qs)](https://cran.r-project.org/package=qs)