[med-svn] [r-cran-sourcetools] 01/06: New upstream version 0.1.6

Andreas Tille tille at debian.org
Thu Oct 12 16:52:15 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-sourcetools.

commit 1f92696c7626ba8f4edaa2a320fc4ea25d5d9ef9
Author: Andreas Tille <tille at debian.org>
Date:   Thu Oct 12 18:47:36 2017 +0200

    New upstream version 0.1.6
---
 DESCRIPTION                                        |  6 +--
 MD5                                                | 11 ++---
 NAMESPACE                                          |  2 +-
 R/sourcetools.R                                    |  7 ---
 R/util.R                                           | 52 ----------------------
 .../read/windows/MemoryMappedConnection.h          |  3 ++
 src/sourcetools-init.c                             | 28 ++++++++++++
 7 files changed, 41 insertions(+), 68 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 24bd541..2e40313 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: sourcetools
 Type: Package
 Title: Tools for Reading, Tokenizing and Parsing R Code
-Version: 0.1.5
+Version: 0.1.6
 Author: Kevin Ushey
 Maintainer: Kevin Ushey <kevinushey at gmail.com>
 Description: Tools for the reading and tokenization of R code. The
@@ -16,6 +16,6 @@ RoxygenNote: 5.0.1
 BugReports: https://github.com/kevinushey/sourcetools/issues
 Encoding: UTF-8
 NeedsCompilation: yes
-Packaged: 2016-09-14 22:38:37 UTC; kevin
+Packaged: 2017-04-05 19:41:15 UTC; kevin
 Repository: CRAN
-Date/Publication: 2016-09-15 03:07:07
+Date/Publication: 2017-04-05 21:57:43 UTC
diff --git a/MD5 b/MD5
index 56e91d2..dcf5286 100644
--- a/MD5
+++ b/MD5
@@ -1,9 +1,9 @@
-f46bb7c8e02f465638a7a3f70bcbb76e *DESCRIPTION
+14d070e10ee3e1dd88ca1f008e63ba05 *DESCRIPTION
 472904db5a93a07692b3fe24cabcf96c *LICENSE
-d904b6ab89c989c9148d4efba103d02d *NAMESPACE
+ce97ebaad581d3ce2c897cdcffa1d66c *NAMESPACE
 f236d8fcec934db9ad39b317d5308bd7 *NEWS.md
-1782b737100f74e11e90c8c45db0d509 *R/sourcetools.R
-b09019840734b467d388e34905ebc46c *R/util.R
+37e5f77d6f49acabdf3daef30abe34f7 *R/sourcetools.R
+d33c3c2ece7b73587126bae7e012a549 *R/util.R
 d82a27087d6f3fac9d06978a31640aed *README.md
 c5215eb66349006d73ad7e65ce54046b *inst/include/sourcetools.h
 f071c0148a4629ea8150b63d2627cf0c *inst/include/sourcetools/collection/Position.h
@@ -29,7 +29,7 @@ da17972b93e9b4e91554f705b4cda985 *inst/include/sourcetools/r/r.h
 e0147869348d196193c13e89762670f0 *inst/include/sourcetools/read/posix/MemoryMappedConnection.h
 44abbae26e9ab704c92a9ce6c98ba33a *inst/include/sourcetools/read/read.h
 e77d3eb6a47db7e6d1e65f59eb3ab2c5 *inst/include/sourcetools/read/windows/FileConnection.h
-f4b06a29aca570063567f8a765609056 *inst/include/sourcetools/read/windows/MemoryMappedConnection.h
+35b83b8a537f7c447410e3c5e6616cef *inst/include/sourcetools/read/windows/MemoryMappedConnection.h
 b80180f53ca809b9ba6d4e7df6316e0b *inst/include/sourcetools/tests/testthat.h
 c6afafc697b747111348dabb88d9fb4a *inst/include/sourcetools/tokenization/Registration.h
 9ab2cf85d30171f4744d21d10c6cd532 *inst/include/sourcetools/tokenization/Token.h
@@ -42,6 +42,7 @@ a94108446e930c7c488c695e1618f049 *man/tokenize-methods.Rd
 3f03da795dd26373156bddc78d41e95d *src/Makevars.win
 43927b22e2812e5ba35419390a7933ae *src/Reader.cpp
 78946eee022f534743af918d651dd244 *src/Tokenizer.cpp
+f4bd98cee0ca584880a0cac98f48d527 *src/sourcetools-init.c
 175dc27564828d1abeb87bc004d02266 *tests/testthat.R
 b6ba9001993894a2085c981a6c58018d *tests/testthat/helper-utf8.R
 0e31fb15ea8b66d310162f60c434ed7d *tests/testthat/test-read.R
diff --git a/NAMESPACE b/NAMESPACE
index 8a6b65c..41836f1 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -8,4 +8,4 @@ export(read_lines_bytes)
 export(tokenize)
 export(tokenize_file)
 export(tokenize_string)
-useDynLib(sourcetools)
+useDynLib(sourcetools, .registration = TRUE)
diff --git a/R/sourcetools.R b/R/sourcetools.R
index 24c5512..de256cb 100644
--- a/R/sourcetools.R
+++ b/R/sourcetools.R
@@ -89,10 +89,3 @@ print.RTokens <- function(x, ...) {
   print.data.frame(x, ...)
 }
 
-parse_string <- function(string) {
-  .Call("sourcetools_parse_string", string, PACKAGE = "sourcetools")
-}
-
-parse_file <- function(file) {
-  parse_string(read(file))
-}
diff --git a/R/util.R b/R/util.R
index f5536b7..b90b795 100644
--- a/R/util.R
+++ b/R/util.R
@@ -1,55 +1,3 @@
-.sourcetools <- new.env(parent = emptyenv())
-.sourcetools$gctorture <- TRUE
-
-with_gctorture <- function(expr) {
-  gctorture(.sourcetools$gctorture)
-  result <- expr
-  gctorture(FALSE)
-  result
-}
-
-check_parse <- function(R, S = R) {
-  lhs <- base::parse(text = R, keep.source = FALSE)
-  rhs <- with_gctorture(parse_string(S))
-  check_parse_impl(lhs, rhs)
-}
-
-check_parse_impl <- function(lhs, rhs) {
-
-  lhsType <- typeof(lhs)
-  rhsType <- typeof(rhs)
-
-  onError <- function(format, ...) {
-    message <- c(
-      sprintf(format, ...),
-      sprintf("R: '%s'", deparse(lhs)),
-      sprintf("S: '%s'", deparse(rhs))
-    )
-    stop(paste(message, collapse = "\n"), call. = FALSE)
-  }
-
-  if (lhsType != rhsType)
-    onError("TypeError: '%s' != '%s'", lhsType, rhsType)
-
-  if (length(lhs) != length(rhs))
-    onError("LengthError: %s != %s", length(lhs), length(rhs))
-
-  if (is.call(lhs) || is.expression(lhs)) {
-    lapply(seq_along(lhs), function(i) {
-      check_parse_impl(lhs[[i]], rhs[[i]])
-    })
-  }
-
-  if (!identical(lhs, rhs))
-    onError("IdenticalError: '%s' != '%s'", lhs, rhs)
-
-  TRUE
-}
-
-expect_parse <- function(R, S = R) {
-  testthat::expect_true(check_parse(R, S))
-}
-
 search_objects <- function() {
   lapply(seq_along(search()), function(i) {
     ls(pos = i, all.names = TRUE)
diff --git a/inst/include/sourcetools/read/windows/MemoryMappedConnection.h b/inst/include/sourcetools/read/windows/MemoryMappedConnection.h
index 0885e3b..a888411 100644
--- a/inst/include/sourcetools/read/windows/MemoryMappedConnection.h
+++ b/inst/include/sourcetools/read/windows/MemoryMappedConnection.h
@@ -26,6 +26,9 @@ public:
   {
     if (handle_ != INVALID_HANDLE_VALUE)
       ::CloseHandle(handle_);
+
+    if (map_ != NULL)
+      ::UnmapViewOfFile(map_);
   }
 
   bool open()
diff --git a/src/sourcetools-init.c b/src/sourcetools-init.c
new file mode 100644
index 0000000..b147d61
--- /dev/null
+++ b/src/sourcetools-init.c
@@ -0,0 +1,28 @@
+#include <R.h>
+#include <Rinternals.h>
+#include <stdlib.h> // for NULL
+#include <R_ext/Rdynload.h>
+
+/* .Call calls */
+extern SEXP sourcetools_read(SEXP);
+extern SEXP sourcetools_read_bytes(SEXP);
+extern SEXP sourcetools_read_lines(SEXP);
+extern SEXP sourcetools_read_lines_bytes(SEXP);
+extern SEXP sourcetools_tokenize_file(SEXP);
+extern SEXP sourcetools_tokenize_string(SEXP);
+
+static const R_CallMethodDef CallEntries[] = {
+    {"sourcetools_read",             (DL_FUNC) &sourcetools_read,             1},
+    {"sourcetools_read_bytes",       (DL_FUNC) &sourcetools_read_bytes,       1},
+    {"sourcetools_read_lines",       (DL_FUNC) &sourcetools_read_lines,       1},
+    {"sourcetools_read_lines_bytes", (DL_FUNC) &sourcetools_read_lines_bytes, 1},
+    {"sourcetools_tokenize_file",    (DL_FUNC) &sourcetools_tokenize_file,    1},
+    {"sourcetools_tokenize_string",  (DL_FUNC) &sourcetools_tokenize_string,  1},
+    {NULL, NULL, 0}
+};
+
+void R_init_sourcetools(DllInfo *dll)
+{
+    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
+    R_useDynamicSymbols(dll, FALSE);
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-sourcetools.git



More information about the debian-med-commit mailing list