[Rcpp-commits] r2503 - scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 23 15:12:17 CET 2010


Author: romain
Date: 2010-11-23 15:12:17 +0100 (Tue, 23 Nov 2010)
New Revision: 2503

Modified:
   scripts/generator_Module_CppFunction.R
Log:
extract signature from function

Modified: scripts/generator_Module_CppFunction.R
===================================================================
--- scripts/generator_Module_CppFunction.R	2010-11-23 13:56:56 UTC (rev 2502)
+++ scripts/generator_Module_CppFunction.R	2010-11-23 14:12:17 UTC (rev 2503)
@@ -16,6 +16,7 @@
 		}
 		
 		inline int nargs(){ return %d; }
+		const char* signature(const char* name){ return Rcpp::signature<OUT,%s>(name) ; }
 		
 	private:
 		OUT (*ptr_fun)(%s) ;	
@@ -33,6 +34,7 @@
 		
 		inline int nargs(){ return %d; }
 		inline bool is_void(){ return true; }
+		const char* signature(const char* name){ return Rcpp::signature<void_type,%s>(name) ; }
 		
 	private:
 		void (*ptr_fun)(%s) ;	
@@ -46,6 +48,8 @@
 collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d >::type >( args[%d] )", index, index ) ),
 i, 
 collapse( sprintf( "U%d", index ) ), 
+collapse( sprintf( "U%d", index ) ), 
+
 paste( sprintf( "typename U%d", index ), collapse = ", " ), 
 i, 
 collapse( sprintf( "U%d", index ) ), 
@@ -53,6 +57,7 @@
 collapse( sprintf( "U%d", index ) ), 
 collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d>::type >( args[%d] )", index, index ) ),
 i, 
+collapse( sprintf( "U%d", index ) ), 
 collapse( sprintf( "U%d", index ) )
 )
 	
@@ -61,7 +66,7 @@
 file <- sprintf( 
 '// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
 //
-// Module_generated_function.h: Rcpp R/C++ interface class library -- Rcpp modules
+// Module_generated_CppFunction.h: Rcpp R/C++ interface class library -- Rcpp modules
 //
 // Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
 //
@@ -92,6 +97,7 @@
 		}
 		
 		inline int nargs(){ return 0; }
+		const char* signature(const char* name){ return Rcpp::signature<OUT>(name) ; }
 		
 	private:
 		OUT (*ptr_fun)(void) ;	                    
@@ -110,6 +116,7 @@
 		
 		inline int nargs(){ return 0; }
 		inline bool is_void(){ return true; }
+		const char* signature(const char* name){ return Rcpp::signature<void_type>(name) ; }
 		
 	private:
 		void (*ptr_fun)(void) ;	



More information about the Rcpp-commits mailing list