[Rcpp-commits] r484 - in pkg: inst src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 27 15:59:12 CET 2010


Author: romain
Date: 2010-01-27 15:59:12 +0100 (Wed, 27 Jan 2010)
New Revision: 484

Modified:
   pkg/inst/ChangeLog
   pkg/src/Environment.cpp
   pkg/src/Evaluator.cpp
   pkg/src/Rcpp/Environment.h
Log:
remove static Environment::RCPP_NAMESPACE to make embedding with RInside happy again

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-01-27 09:31:13 UTC (rev 483)
+++ pkg/inst/ChangeLog	2010-01-27 14:59:12 UTC (rev 484)
@@ -1,5 +1,9 @@
 2010-01-27  Romain Francois <francoisromain at free.fr>
 
+	* src/Rcpp/Environment.h: removed the static 
+	Environment::RCPP_NAMESPACE which caused problems when 
+	embedding R
+
 	* src/Rcpp/RObject.h: RObject::AttributeProxy::operator RObject
 	replaced by templated implicit conversion operator, delegating the
 	actual work to as<>.

Modified: pkg/src/Environment.cpp
===================================================================
--- pkg/src/Environment.cpp	2010-01-27 09:31:13 UTC (rev 483)
+++ pkg/src/Environment.cpp	2010-01-27 14:59:12 UTC (rev 484)
@@ -282,9 +282,8 @@
     	return Binding( *this, name ) ;
     }
     
-    Environment Environment::RCPP_NAMESPACE = Rf_eval( Rf_lcons( Rf_install("getNamespace"), Rf_cons( Rf_mkString("Rcpp") , R_NilValue) ), R_GlobalEnv );
-    Environment& Environment::Rcpp_namespace() throw() {
-    	    return RCPP_NAMESPACE ;
+    Environment Environment::Rcpp_namespace() throw() {
+    	    return Environment( Rf_eval( Rf_lcons( Rf_install("getNamespace"), Rf_cons( Rf_mkString("Rcpp") , R_NilValue) ), R_GlobalEnv ) ) ;
     }
     
     Environment Environment::new_child(bool hashed) {

Modified: pkg/src/Evaluator.cpp
===================================================================
--- pkg/src/Evaluator.cpp	2010-01-27 09:31:13 UTC (rev 483)
+++ pkg/src/Evaluator.cpp	2010-01-27 14:59:12 UTC (rev 484)
@@ -32,8 +32,7 @@
 	
    	SEXP call = PROTECT( Rf_lang3( Rf_install("rcpp_tryCatch") , expr, env ) ) ;
 	
-   	/* already protected */
-   	SEXP RCPP = Environment::Rcpp_namespace(); 
+   	Environment RCPP = Environment::Rcpp_namespace(); 
    	
 	/* call the tryCatch call */
 	SEXP res = PROTECT( Rf_eval( call, RCPP ) );

Modified: pkg/src/Rcpp/Environment.h
===================================================================
--- pkg/src/Rcpp/Environment.h	2010-01-27 09:31:13 UTC (rev 483)
+++ pkg/src/Rcpp/Environment.h	2010-01-27 14:59:12 UTC (rev 484)
@@ -448,7 +448,7 @@
     /**
      * @return the Rcpp namespace
      */
-    static Environment& Rcpp_namespace() throw() ;
+    static Environment Rcpp_namespace() throw() ;
     
     /**
      * @param name the name of the package of which we want the namespace
@@ -468,11 +468,7 @@
      * creates a new environment whose this is the parent
      */
     Environment new_child(bool hashed) ; 
-    
-private:
-	/* we cache the Rcpp namespace environment since
-	it is used many times internally */
-	static Environment RCPP_NAMESPACE ;
+	
 };
 
 } // namespace Rcpp



More information about the Rcpp-commits mailing list