[Rcpp-commits] r2845 - in pkg/Rcpp: inst/include/Rcpp inst/unitTests src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 7 12:32:11 CET 2011


Author: romain
Date: 2011-01-07 12:32:11 +0100 (Fri, 07 Jan 2011)
New Revision: 2845

Modified:
   pkg/Rcpp/inst/include/Rcpp/RObject.h
   pkg/Rcpp/inst/unitTests/runit.Module.R
   pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
   pkg/Rcpp/src/RObject.cpp
Log:
roll back to R_Preserve / R_Release for now

Modified: pkg/Rcpp/inst/include/Rcpp/RObject.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/RObject.h	2011-01-07 04:21:11 UTC (rev 2844)
+++ pkg/Rcpp/inst/include/Rcpp/RObject.h	2011-01-07 11:32:11 UTC (rev 2845)
@@ -284,10 +284,13 @@
     
 private:
 
-    static internal::SEXPstack PPstack ;
+//    static internal::SEXPstack PPstack ;
+//    void preserve(){ if( m_sexp != R_NilValue ) PPstack.preserve(m_sexp) ; } 
+//    void release() { if( m_sexp != R_NilValue ) PPstack.release(m_sexp) ; }
+
+    void preserve(){ if( m_sexp != R_NilValue ) R_PreserveObject(m_sexp) ; }
+    void release() { if( m_sexp != R_NilValue ) R_ReleaseObject(m_sexp) ; } 
     
-    void preserve(){ if( m_sexp != R_NilValue ) PPstack.preserve(m_sexp) ; } 
-    void release() { if( m_sexp != R_NilValue ) PPstack.release(m_sexp) ; } 
     virtual void update() {
         RCPP_DEBUG_1( "RObject::update(SEXP = <%p> )", m_sexp ) ; 
     } ;

Modified: pkg/Rcpp/inst/unitTests/runit.Module.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Module.R	2011-01-07 04:21:11 UTC (rev 2844)
+++ pkg/Rcpp/inst/unitTests/runit.Module.R	2011-01-07 11:32:11 UTC (rev 2845)
@@ -22,8 +22,8 @@
 	gc()
 }
 
-#if( Rcpp:::capabilities()[["Rcpp modules"]] ) {
-if( FALSE ){
+if( Rcpp:::capabilities()[["Rcpp modules"]] ) {
+# if( FALSE ){
     
 test.Module <- function(){
 

Modified: pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Module.client.package.R	2011-01-07 04:21:11 UTC (rev 2844)
+++ pkg/Rcpp/inst/unitTests/runit.Module.client.package.R	2011-01-07 11:32:11 UTC (rev 2845)
@@ -24,50 +24,50 @@
 
 if( Rcpp:::capabilities()[["Rcpp modules"]] ) {
 
-# test.Module.package <- function( ){
-# 
-#     td <- tempfile()
-#     cwd <- getwd()
-#     dir.create( td )
-#     file.copy( system.file( "unitTests", "testRcppModule", package = "Rcpp" ) , td, recursive = TRUE)
-#     setwd( td )
-#     on.exit( { setwd( cwd) ; unlink( td, recursive = TRUE ) } )
-#     R <- shQuote( file.path( R.home( component = "bin" ), "R" ))
-#     cmd <- paste( R , "CMD build testRcppModule" )
-#     system( cmd )
-#     dir.create( "templib" )
-#     install.packages( "testRcppModule_0.1.tar.gz", "templib", repos = NULL, type = "source" )
-#     require( "testRcppModule", "templib", character.only = TRUE )
-# 
-# 	vClass <- stdVector$vec
-# 	vec <- new(vClass)
-# 
-# 	data <- 1:10
-# 	vec$assign(data)
-# 	vec[[3]] <- vec[[3]] + 1
-# 
-# 	data[[4]] <- data[[4]] +1
-# 
-# 	checkEquals( vec$as.vector(), data )
-# 
-# 	## a few function calls
-# 
-# 	checkEquals( yada$bar(2), 4)
-# 
-# 	# this upsets the windows/gcc 4.5 combo
-# 	# e <- tryCatch(yada$hello(), error = function(x)x)
-# 	# checkTrue(is(e, "error"))
-# 	# checkEquals( e$message, "boom")
-# 
-# 	checkEquals( yada$foo(2,3), 6)
-# 
-# 	## properties (at one stage this seqfaulted, so beware)
-#     ## FIXME: Commented-out test below to let R CMD check pass with g++-4.5
-# 	## nc = NumEx$Num
-# 	## nn <- new(nc)
-# 	## nn$x <- pi
-# 	## checkEquals( nn$x, pi )
-# 
-# }
+test.Module.package <- function( ){
 
+    td <- tempfile()
+    cwd <- getwd()
+    dir.create( td )
+    file.copy( system.file( "unitTests", "testRcppModule", package = "Rcpp" ) , td, recursive = TRUE)
+    setwd( td )
+    on.exit( { setwd( cwd) ; unlink( td, recursive = TRUE ) } )
+    R <- shQuote( file.path( R.home( component = "bin" ), "R" ))
+    cmd <- paste( R , "CMD build testRcppModule" )
+    system( cmd )
+    dir.create( "templib" )
+    install.packages( "testRcppModule_0.1.tar.gz", "templib", repos = NULL, type = "source" )
+    require( "testRcppModule", "templib", character.only = TRUE )
+
+	vClass <- stdVector$vec
+	vec <- new(vClass)
+
+	data <- 1:10
+	vec$assign(data)
+	vec[[3]] <- vec[[3]] + 1
+
+	data[[4]] <- data[[4]] +1
+
+	checkEquals( vec$as.vector(), data )
+
+	## a few function calls
+
+	checkEquals( yada$bar(2), 4)
+
+	# this upsets the windows/gcc 4.5 combo
+	# e <- tryCatch(yada$hello(), error = function(x)x)
+	# checkTrue(is(e, "error"))
+	# checkEquals( e$message, "boom")
+
+	checkEquals( yada$foo(2,3), 6)
+
+	## properties (at one stage this seqfaulted, so beware)
+    ## FIXME: Commented-out test below to let R CMD check pass with g++-4.5
+	## nc = NumEx$Num
+	## nn <- new(nc)
+	## nn$x <- pi
+	## checkEquals( nn$x, pi )
+
 }
+
+}

Modified: pkg/Rcpp/src/RObject.cpp
===================================================================
--- pkg/Rcpp/src/RObject.cpp	2011-01-07 04:21:11 UTC (rev 2844)
+++ pkg/Rcpp/src/RObject.cpp	2011-01-07 11:32:11 UTC (rev 2845)
@@ -60,7 +60,7 @@
     }
 }
 
-internal::SEXPstack RObject::PPstack ;    
+// internal::SEXPstack RObject::PPstack ;    
     
 void RObject::setSEXP(SEXP x){
     RCPP_DEBUG_1( "RObject::setSEXP(SEXP = <%p> )", x ) ; 



More information about the Rcpp-commits mailing list