[Rcpp-commits] r1324 - pkg/Rcpp/R pkg/Rcpp/inst/include/Rcpp pkg/Rcpp/inst/include/Rcpp/module pkg/Rcpp/src scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 25 21:52:18 CEST 2010


Author: romain
Date: 2010-05-25 21:52:17 +0200 (Tue, 25 May 2010)
New Revision: 1324

Modified:
   pkg/Rcpp/R/Module.R
   pkg/Rcpp/inst/include/Rcpp/Module.h
   pkg/Rcpp/inst/include/Rcpp/config.h
   pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h
   pkg/Rcpp/inst/include/Rcpp/module/Module_generated_function.h
   pkg/Rcpp/src/Module.cpp
   scripts/generator_Module_CppFunction.R
   scripts/generator_Module_function.R
Log:
minor progress towards class_

Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R	2010-05-25 13:21:32 UTC (rev 1323)
+++ pkg/Rcpp/R/Module.R	2010-05-25 19:52:17 UTC (rev 1324)
@@ -16,30 +16,30 @@
 # along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
 # not yet
-# setClass( "Module", representation( pointer = "externalptr" ) )
-# 
-# Module <- function( module, PACKAGE ){
-# 	name <- sprintf( "_rcpp_module_boot_%s", module )
-# 	symbol <- getNativeSymbolInfo( name, PACKAGE )
-# 	xp  <- .Call( symbol )
-# 	new( "Module", pointer = xp ) 
-# }
-# 
-# setMethod( "$", "Module", function(x, name){
-# 	function( ... ) {
-# 		res <- .External(  "Module__invoke" , x at pointer, name, ..., PACKAGE = "Rcpp"  )
-# 		if( isTRUE( res$void ) ) invisible(NULL) else res$result	
-# 	}
-# } )
-# 
-# setMethod( "show", "Module", function( object ){
-# 	info <- .Call( "Module__funtions_arity", object at pointer, PACKAGE = "Rcpp" )
-# 	name <- .Call( "Module__name", object at pointer )
-# 	txt <- sprintf( "Rcpp module '%s' \n\t%d functions: ", name, length(info) )
-# 	writeLines( txt )
-# 	txt <- sprintf( "%15s : %d arguments", names(info), info )
-# 	writeLines( txt )
-# } )
+setClass( "Module", representation( pointer = "externalptr" ) )
 
+Module <- function( module, PACKAGE ){
+	name <- sprintf( "_rcpp_module_boot_%s", module )
+	symbol <- getNativeSymbolInfo( name, PACKAGE )
+	xp  <- .Call( symbol )
+	new( "Module", pointer = xp ) 
+}
+
+setMethod( "$", "Module", function(x, name){
+	function( ... ) {
+		res <- .External(  "Module__invoke" , x at pointer, name, ..., PACKAGE = "Rcpp"  )
+		if( isTRUE( res$void ) ) invisible(NULL) else res$result	
+	}
+} )
+
+setMethod( "show", "Module", function( object ){
+	info <- .Call( "Module__funtions_arity", object at pointer, PACKAGE = "Rcpp" )
+	name <- .Call( "Module__name", object at pointer )
+	txt <- sprintf( "Rcpp module '%s' \n\t%d functions: ", name, length(info) )
+	writeLines( txt )
+	txt <- sprintf( "%15s : %d arguments", names(info), info )
+	writeLines( txt )
+} )
+
 #TODO: maybe attach( Module ), with( Module )
 

Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h	2010-05-25 13:21:32 UTC (rev 1323)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h	2010-05-25 19:52:17 UTC (rev 1324)
@@ -21,7 +21,8 @@
 
 #ifndef Rcpp_Module_h
 #define Rcpp_Module_h
-
+   
+#include <Rcpp/config.h>
 #ifdef RCPP_ENABLE_MODULES
 
 namespace Rcpp{
@@ -55,7 +56,10 @@
 class Module {
 	public:    
 		typedef std::map<std::string,CppFunction*> MAP ;
+		typedef std::pair<const std::string,CppFunction*> FUNCTION_PAIR ;
+		
 		typedef std::map<std::string,class_Base*> CLASS_MAP ;
+		typedef std::pair<const std::string,class_Base*> CLASS_PAIR ;
 	
 		Module() : name(), functions() {}
 		Module(const char* name_) : name(name_), functions(), classes() {}
@@ -82,10 +86,15 @@
 		}                                                                                  
 		
 		Rcpp::IntegerVector functions_arity() ;
+		Rcpp::CharacterVector class_names() ;
 		
 		inline void Add( const char* name, CppFunction* ptr){
-			functions.insert( std::pair<std::string,CppFunction*>( name, ptr ) ) ;
+			functions.insert( FUNCTION_PAIR( name, ptr ) ) ;
 		}
+		
+		inline void AddClass(const char* name, class_Base* cptr){
+			classes.insert( CLASS_PAIR( name, cptr ) ) ;
+		}
 
 		std::string name ;
 		
@@ -95,6 +104,12 @@
 		           
 };
 
+}
+extern "C" Rcpp::Module* getCurrentScope() ;
+extern "C" void setCurrentScope( Rcpp::Module* ) ;
+
+namespace Rcpp{
+	
 template <typename Class>
 class CppMethod {
 	public:
@@ -107,17 +122,19 @@
 } ;
 
 template <typename Class>
-class class_{
+class class_ : public class_Base {
 public:
 	typedef class_ self ;
 	typedef CppMethod<Class> method ;
 	typedef std::map<std::string,method*> METHOD_MAP ;
 	typedef std::pair<const std::string,method*> PAIR ;
 	
-	class_( const char* name_ ) : class_Base(name_), methods() {}
+	class_( const char* name_ ) : class_Base(name_), methods() {
+		getCurrentScope()->AddClass( name_, this ) ;
+	}
 	
 	SEXP invoke( const std::string& method_name, SEXP *args, int nargs ){ 
-		try{
+		BEGIN_RCPP
 			typename METHOD_MAP::iterator it = methods.find( method_name ) ;
 			if( it == methods.end() ){
 				throw std::range_error( "no such method" ) ; 
@@ -130,11 +147,7 @@
 					Rcpp::Named("result") = met->operator()( args ), 
 					Rcpp::Named("void")   = met->is_void() 
 				) ;
-				
-		} catch( std::exception& __ex__ ){
-			forward_exception_to_r( __ex__ ); 
-		}
-		return R_NilValue ; // -Wall		
+		END_RCPP	
 	}
 	
 	self& AddMethod( const char* name, method* m){
@@ -146,8 +159,6 @@
 	METHOD_MAP methods ;
 } ;
 
-extern Rcpp::Module* current_scope ;
-
 // function factories
 #include <Rcpp/module/Module_generated_function.h>
 
@@ -158,10 +169,10 @@
 void _rcpp_module_##name##_init() ;                                  \
 static Rcpp::Module _rcpp_module_##name( # name ) ;                  \
 extern "C" SEXP _rcpp_module_boot_##name(){                          \
-  ::Rcpp::current_scope =  & _rcpp_module_##name ;                   \
+  ::setCurrentScope( & _rcpp_module_##name ) ;                   \
   _rcpp_module_##name##_init( ) ;                                    \
   Rcpp::XPtr<Rcpp::Module> mod_xp( & _rcpp_module_##name , false ) ; \
-  ::Rcpp::current_scope =  0 ;                                       \
+  ::setCurrentScope( 0 ) ;                                       \
   return mod_xp ;                                                    \
 }                                                                    \
 void _rcpp_module_##name##_init()

Modified: pkg/Rcpp/inst/include/Rcpp/config.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/config.h	2010-05-25 13:21:32 UTC (rev 1323)
+++ pkg/Rcpp/inst/include/Rcpp/config.h	2010-05-25 19:52:17 UTC (rev 1324)
@@ -22,7 +22,7 @@
 #ifndef RCPP__CONFIG_H
 #define RCPP__CONFIG_H
 
-// uncomment to enable Rcpp modules
+// comment to disable Rcpp modules
 // #define RCPP_ENABLE_MODULES
 
 #endif

Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h	2010-05-25 13:21:32 UTC (rev 1323)
+++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_CppFunction.h	2010-05-25 19:52:17 UTC (rev 1324)
@@ -40,9 +40,12 @@
 template <>
 class CppFunction0<void> : public CppFunction {
 	public:
-		CppFunction0(void (*fun)(void) )  ;
+		CppFunction0(void (*fun)(void) ) : CppFunction(), ptr_fun(fun){} ;
 		
-		SEXP operator()(SEXP* args) throw(std::exception) ;
+		SEXP operator()(SEXP* args) throw(std::exception) {
+			ptr_fun() ;
+			return R_NilValue ;
+		}
 		
 		inline int nargs(){ return 0; }
 		inline bool is_void(){ return true; }

Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_function.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/module/Module_generated_function.h	2010-05-25 13:21:32 UTC (rev 1323)
+++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_function.h	2010-05-25 19:52:17 UTC (rev 1324)
@@ -25,528 +25,594 @@
 
 template <typename OUT>                                                                   
 void function( const char* name,  OUT (*fun)(void)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction0<OUT>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction0<OUT>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction1<OUT,U0>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction1<OUT,U0>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction2<OUT,U0, U1>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction2<OUT,U0, U1>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction3<OUT,U0, U1, U2>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction3<OUT,U0, U1, U2>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction4<OUT,U0, U1, U2, U3>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction4<OUT,U0, U1, U2, U3>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction5<OUT,U0, U1, U2, U3, U4>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction5<OUT,U0, U1, U2, U3, U4>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction6<OUT,U0, U1, U2, U3, U4, U5>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction6<OUT,U0, U1, U2, U3, U4, U5>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction7<OUT,U0, U1, U2, U3, U4, U5, U6>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction7<OUT,U0, U1, U2, U3, U4, U5, U6>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction8<OUT,U0, U1, U2, U3, U4, U5, U6, U7>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction8<OUT,U0, U1, U2, U3, U4, U5, U6, U7>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction9<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction9<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction10<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction10<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction11<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction11<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction12<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction12<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction13<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction13<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction14<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction14<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction15<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction15<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction16<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction16<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction17<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction17<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction18<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction18<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction19<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction19<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction20<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction20<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction21<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction21<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction22<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction22<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction23<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction23<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22, typename U23>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction24<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction24<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22, typename U23, typename U24>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction25<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction25<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22, typename U23, typename U24, typename U25>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction26<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction26<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22, typename U23, typename U24, typename U25, typename U26>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction27<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction27<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22, typename U23, typename U24, typename U25, typename U26, typename U27>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction28<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26, U27>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction28<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26, U27>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22, typename U23, typename U24, typename U25, typename U26, typename U27, typename U28>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction29<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26, U27, U28>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction29<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26, U27, U28>( fun ) ) ;
   }
 }
 
 
 template <typename OUT,typename U0, typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8, typename U9, typename U10, typename U11, typename U12, typename U13, typename U14, typename U15, typename U16, typename U17, typename U18, typename U19, typename U20, typename U21, typename U22, typename U23, typename U24, typename U25, typename U26, typename U27, typename U28, typename U29>                                                                   
 void function( const char* name,  OUT (*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29)){
-  if( Rcpp::current_scope ){
-    Rcpp::current_scope->Add( name, new CppFunction30<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26, U27, U28, U29>( fun ) ) ;
+  Rcpp::Module* scope = ::getCurrentScope() ;
+  if( scope ){
+    scope->Add( name, new CppFunction30<OUT,U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26, U27, U28, U29>( fun ) ) ;
   }
 }
 
 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 1324


More information about the Rcpp-commits mailing list