[Rcpp-commits] r1090 - in pkg/Rcpp: R inst/include inst/unitTests/RcppTestA/src inst/unitTests/RcppTestB/src src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 20 15:58:19 CEST 2010


Author: romain
Date: 2010-04-20 15:58:19 +0200 (Tue, 20 Apr 2010)
New Revision: 1090

Modified:
   pkg/Rcpp/R/Rcpp.package.skeleton.R
   pkg/Rcpp/R/zzz.R
   pkg/Rcpp/inst/include/RcppCommon.h
   pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
   pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp
   pkg/Rcpp/src/RcppCommon.cpp
Log:
not using set_terminate

Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R
===================================================================
--- pkg/Rcpp/R/Rcpp.package.skeleton.R	2010-04-19 20:32:33 UTC (rev 1089)
+++ pkg/Rcpp/R/Rcpp.package.skeleton.R	2010-04-20 13:58:19 UTC (rev 1090)
@@ -88,20 +88,7 @@
 		file.copy( file.path( skeleton, "Makevars.win" ), Makevars.win )
 		message( " >> added Makevars.win file with Rcpp settings" )
 	}
-	
-	zzz <- file.path( src, "zzz.cpp" )
-	writeLines( sprintf('
-#include <RcppCommon.h>
-/* this helps exception forwarding on windows */
-	
-#if defined(WIN32)
-extern "C" void R_init_%s( DllInfo* info){
-	std::set_terminate( forward_uncaught_exceptions_to_r ) ;
-}
-#endif
-', name), zzz )
-	message( ">> added windows exception forwarding helper file zzz.cpp" )
-	
+		
 	if( example_code ){
 		header <- readLines( file.path( skeleton, "rcpp_hello_world.h" ) )
 		header <- gsub( "@PKG@", name, header, fixed = TRUE )

Modified: pkg/Rcpp/R/zzz.R
===================================================================
--- pkg/Rcpp/R/zzz.R	2010-04-19 20:32:33 UTC (rev 1089)
+++ pkg/Rcpp/R/zzz.R	2010-04-20 13:58:19 UTC (rev 1090)
@@ -16,7 +16,6 @@
 # along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
 .onLoad <- function(libname, pkgname){
-	.Call( "initRcpp", PACKAGE = pkgname )
 	if( "package:inline" %in% search() ){
 		init.inline()
 	}

Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h	2010-04-19 20:32:33 UTC (rev 1089)
+++ pkg/Rcpp/inst/include/RcppCommon.h	2010-04-20 13:58:19 UTC (rev 1090)
@@ -168,8 +168,6 @@
 
 const char * sexp_to_name(int sexp_type); 
 
-RcppExport SEXP initRcpp() ;
-
 namespace Rcpp{
 /* internal namespace for things not intended to be used by the 
    user */

Modified: pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp	2010-04-19 20:32:33 UTC (rev 1089)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp	2010-04-20 13:58:19 UTC (rev 1090)
@@ -9,12 +9,11 @@
 }
 
 SEXP hello_world_ex(){
-	throw std::range_error( "boom" ) ;
+	try{
+		throw std::range_error( "boom" ) ;
+	} catch( std::exception& __ex__ ){
+		forward_exception_to_r( __ex__ ) ;	
+	}
 	return R_NilValue ;
 }
 
-#if defined(WIN32)
-extern "C" void R_init_RcppTestA( DllInfo* info){
-	std::set_terminate( forward_uncaught_exceptions_to_r ) ;
-}
-#endif

Modified: pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp	2010-04-19 20:32:33 UTC (rev 1089)
+++ pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp	2010-04-20 13:58:19 UTC (rev 1090)
@@ -9,12 +9,11 @@
 }
 
 SEXP hello_world_ex(){
-	throw std::range_error( "boom" ) ;
+	try{
+		throw std::range_error( "boom" ) ;
+	} catch( std::exception& __ex__ ){
+		forward_exception_to_r( __ex__ ) ;	
+	}
 	return R_NilValue ;
 }
 
-#if defined(WIN32)
-extern "C" void R_init_RcppTestB( DllInfo* info){
-	std::set_terminate( forward_uncaught_exceptions_to_r ) ;
-}
-#endif

Modified: pkg/Rcpp/src/RcppCommon.cpp
===================================================================
--- pkg/Rcpp/src/RcppCommon.cpp	2010-04-19 20:32:33 UTC (rev 1089)
+++ pkg/Rcpp/src/RcppCommon.cpp	2010-04-20 13:58:19 UTC (rev 1090)
@@ -120,11 +120,9 @@
     }
 }
 
-SEXP initRcpp(){
-	// TODO: we should not setup a custom terminate 
-	//       as this does not work as expected on windows
-	initUncaughtExceptionHandler() ;
-	return R_NilValue ;
+void R_init_Rcpp(DllInfo* info){
+	// initUncaughtExceptionHandler() ;
+	// return R_NilValue ;
 }
    
 namespace Rcpp{



More information about the Rcpp-commits mailing list