[Rcpp-commits] r4283 - in pkg/Rcpp: . inst inst/include/Rcpp src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Mar 20 02:39:53 CET 2013
Author: edd
Date: 2013-03-20 02:39:52 +0100 (Wed, 20 Mar 2013)
New Revision: 4283
Modified:
pkg/Rcpp/DESCRIPTION
pkg/Rcpp/inst/NEWS.Rd
pkg/Rcpp/inst/include/Rcpp/config.h
pkg/Rcpp/src/api.cpp
Log:
attempt to roll back to to R_PreserveObject / R_ReleaseObject via a simple #define
but blows up in unit test for modules
Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION 2013-03-13 14:27:01 UTC (rev 4282)
+++ pkg/Rcpp/DESCRIPTION 2013-03-20 01:39:52 UTC (rev 4283)
@@ -1,6 +1,6 @@
Package: Rcpp
Title: Seamless R and C++ Integration
-Version: 0.10.2.5
+Version: 0.10.2.6
Date: $Date$
Author: Dirk Eddelbuettel and Romain Francois, with contributions
by Douglas Bates, John Chambers and JJ Allaire
Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd 2013-03-13 14:27:01 UTC (rev 4282)
+++ pkg/Rcpp/inst/NEWS.Rd 2013-03-20 01:39:52 UTC (rev 4283)
@@ -2,7 +2,7 @@
\title{News for Package 'Rcpp'}
\newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
-\section{Changes in Rcpp 0.10.3 (future)}{
+\section{Changes in Rcpp 0.10.3 (2013-xx-yy)}{
\itemize{
\item Changes in R code:
\itemize{
@@ -41,7 +41,7 @@
treated as a stack instead of a pairlist in the R implementation
\item Platform-dependent code in Timer.cpp now recognises a few
more BSD variants thanks to contributed defined() test suggestions
- \item support for wide character strings has been added throughout the
+ \item Support for wide character strings has been added throughout the
API. In particular String, CharacterVector, wrap and as are aware of
wide character strings
}
Modified: pkg/Rcpp/inst/include/Rcpp/config.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/config.h 2013-03-13 14:27:01 UTC (rev 4282)
+++ pkg/Rcpp/inst/include/Rcpp/config.h 2013-03-20 01:39:52 UTC (rev 4283)
@@ -26,6 +26,10 @@
// All three digits have to be integers for g++-4.7 or later
#define RCPP_VERSION Rcpp_Version(0,10,3)
+
+// Rcpp 0.10.3 has initial support for new preserve/release semantics
+// This switch enables a rollback to the standard R preserve/release semantics
+#define RCPP_USE_NEW_PRESERVE_RELEASE 1
#endif
Modified: pkg/Rcpp/src/api.cpp
===================================================================
--- pkg/Rcpp/src/api.cpp 2013-03-13 14:27:01 UTC (rev 4282)
+++ pkg/Rcpp/src/api.cpp 2013-03-20 01:39:52 UTC (rev 4283)
@@ -48,6 +48,7 @@
}
SEXP Rcpp_PreserveObject(SEXP x){
+#if RCPP_USE_NEW_PRESERVE_RELEASE
if( x != R_NilValue ){
init_ProtectionStack();
int top = GET_TOP() ;
@@ -60,9 +61,15 @@
#if RCPP_DEBUG_LEVEL > 1
Rcpp_Stack_Debug() ;
#endif
+#else
+ if( x != R_NilValue ) {
+ R_PreserveObject(x);
+ }
+#endif
return x ;
}
void Rcpp_ReleaseObject(SEXP x){
+#if RCPP_USE_NEW_PRESERVE_RELEASE
if( x != R_NilValue ){
init_ProtectionStack();
@@ -96,13 +103,20 @@
Rcpp_Stack_Debug() ;
#endif
}
+#else
+ if (x != R_NilValue) {
+ R_ReleaseObject(x);
+ }
+#endif
}
+
SEXP Rcpp_ReplaceObject(SEXP x, SEXP y){
if( x == R_NilValue ){
Rcpp_PreserveObject( y ) ;
} else if( y == R_NilValue ){
Rcpp_ReleaseObject( x ) ;
} else {
+#if RCPP_USE_NEW_PRESERVE_RELEASE
init_ProtectionStack();
int top = GET_TOP();
@@ -122,6 +136,7 @@
Rcpp_Stack_Debug() ;
#endif
+#endif
}
return y ;
}
More information about the Rcpp-commits
mailing list