Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

small updates incl hide away parts of #1003 if C++11 not available#1012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
eddelbuettel merged 1 commit intomasterfrombugfix/xptr_ctor
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletionsChangeLog
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
2019-11-06 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Roll minor version

* inst/include/Rcpp/XPtr.h: Provided fallback for old constructor
when C++11 is not available (follow-up to #1003)
* inst/unitTests/runit.XPTr.R (test.XPtr): On Windows (as a proxy for
old compilers) do not test new feature

* tests/doRUnit.R: Protect printing to /tmp from Windows use

* vignettes/rmd/Rcpp.bib: Updated
* inst/bib/Rcpp.bib: Idem

Expand Down
4 changes: 2 additions & 2 deletionsDESCRIPTION
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
Package: Rcpp
Title: Seamless R and C++ Integration
Version: 1.0.2.5
Date: 2019-11-02
Version: 1.0.2.6
Date: 2019-11-06
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou,
Nathan Russell, Douglas Bates and John Chambers
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Expand Down
4 changes: 3 additions & 1 deletioninst/NEWS.Rd
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@
\item \code{XPtr} tags are now preserved in \code{as<>} (Stephen Wade
in \ghpr{1003} fixing \ghit{986})
\item A few more temporary allocations are now protected from garbage
collection (Romain Francois in \ghpr{1010}).
collection (Romain Francois in \ghpr{1010}, and Dirk in \ghpr{1011}).
}
\item Changes in Rcpp Modules:
\itemize{
Expand All@@ -36,6 +36,8 @@
have been added to README.md (Dirk).
\item Vignettes are now included pre-made (Dirk in \ghpr{1005}
addressing \ghit{1004})).
\item The Rcpp FAQ has two new entries on 'no modules / no rtti' and
exceptions across shared libraries (Dirk in \ghpr{1009}).
}
}
}
Expand Down
24 changes: 23 additions & 1 deletioninst/include/Rcpp/XPtr.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,6 +58,8 @@ class XPtr :

typedef StoragePolicy<XPtr> Storage;

#if defined(RCPP_USING_CXX11)

/**
* constructs a XPtr wrapping the external pointer (EXTPTRSXP SEXP)
*
Expand All@@ -75,14 +77,34 @@ class XPtr :
* constructs a XPtr wrapping the external pointer (EXTPTRSXP SEXP)
*
* @param xp external pointer to wrap
* @param tag tag to assign to external pointer
* @param tag tag to assign to external pointer
* @param prot protected data to assign to external pointer
*/
explicit XPtr(SEXP x, SEXP tag, SEXP prot) : XPtr(x) {
R_SetExternalPtrTag( x, tag);
R_SetExternalPtrProtected(x, prot);
};

#else

/**
* constructs a XPtr wrapping the external pointer (EXTPTRSXP SEXP)
*
* @param xp external pointer to wrap
*/
explicit XPtr(SEXP x, SEXP tag = R_NilValue, SEXP prot = R_NilValue) {
if (TYPEOF(x) != EXTPTRSXP) {
const char* fmt = "Expecting an external pointer: [type=%s].";
throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x)));
}

Storage::set__(x);
R_SetExternalPtrTag( x, tag);
R_SetExternalPtrProtected(x, prot);
};

#endif

/**
* creates a new external pointer wrapping the dumb pointer p.
*
Expand Down
12 changes: 8 additions & 4 deletionsinst/unitTests/runit.XPTr.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,19 +20,23 @@

.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"

isWindows <- Sys.info()[["sysname"]] == "Windows"

if (.runThisTest) {

.setUp <- Rcpp:::unitTestSetup("XPtr.cpp")

test.XPtr <- function(){
xp <- xptr_1()
checkEquals(typeof( xp ), "externalptr", msg = "checking external pointer creation" )

front <- xptr_2(xp)
checkEquals( front, 1L, msg = "check usage of external pointer" )

xptr_self_tag(xp)
checkEquals(xptr_has_self_tag(xp), T, msg = "check external pointer tag preserved")
if (!isWindows) {
xptr_self_tag(xp)
checkEquals(xptr_has_self_tag(xp), T, msg = "check external pointer tag preserved")
}

checkTrue(xptr_release(xp), msg = "check release of external pointer")

Expand Down
5 changes: 3 additions & 2 deletionstests/doRUnit.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,10 +60,11 @@ if (requireNamespace("RUnit", quietly=TRUE) &&
Sys.setenv("RunAllRcppTests"="yes")
}

tests <- runTestSuite(testSuite)# Run tests
tests <- runTestSuite(testSuite)# Run tests

printTextProtocol(tests)# Print results
printTextProtocol(tests, file="/tmp/RcppTestLog.txt")
if (Sys.info()[["sysname"]] != "Windows")
printTextProtocol(tests, file="/tmp/RcppTestLog.txt")

## Return success or failure to R CMD CHECK
if (getErrors(tests)$nFail > 0) stop("TEST FAILED!")
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp