[Rcpp-commits] r4542 - scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 28 10:38:37 CEST 2013


Author: romain
Date: 2013-09-28 10:38:36 +0200 (Sat, 28 Sep 2013)
New Revision: 4542

Modified:
   scripts/DataFrame.R
   scripts/generator_Module_CppMethod.R
   scripts/generator_Module_PointerCppMethod.R
Log:
updated generators

Modified: scripts/DataFrame.R
===================================================================
--- scripts/DataFrame.R	2013-09-28 08:37:34 UTC (rev 4541)
+++ scripts/DataFrame.R	2013-09-28 08:38:36 UTC (rev 4542)
@@ -8,7 +8,7 @@
     sprintf('
 template <%s>
 static DataFrame create( %s ) {
-    return DataFrame( List::create( %s ) ) ;
+    return DataFrame::from_list( List::create( %s ) ) ;
 } ',
             paste( sprintf( "typename T%d", 1:i ), collapse = ", "),
             paste( sprintf( "const T%d& t%d", 1:i, 1:i ), collapse = ", "),

Modified: scripts/generator_Module_CppMethod.R
===================================================================
--- scripts/generator_Module_CppMethod.R	2013-09-28 08:37:34 UTC (rev 4541)
+++ scripts/generator_Module_CppMethod.R	2013-09-28 08:38:36 UTC (rev 4542)
@@ -3,11 +3,12 @@
 fun <- function( i ){
 
 	index <- (1:i)-1
-	collapse <- function(x) paste( x, collapse = ", " )
+	collapse <- function(x, collapse = ", " ) paste( x, collapse = collapse )
 	
 	typenames <- collapse( sprintf( "typename U%d", index ) )
 	u <- collapse( sprintf( "U%d u%d", index, index ) )
-    as <- collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d >::type >( args[%d] )", index, index ) )  
+    input_parameter <- collapse( sprintf( "typename Rcpp::traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), collapse = "\n" )  
+    x <- collapse( sprintf( "x%d", index ) )
     U <- collapse( sprintf( "U%d", index ) )
        
 txt <- sprintf( '
@@ -20,6 +21,7 @@
 		
 		CppMethod%d(Method m) : method_class(), met(m) {} 
 		SEXP operator()( Class* object, SEXP* args){
+		    %s
 			return Rcpp::module_wrap<CLEANED_OUT>( (object->*met)( %s ) ) ;
 		}
 		inline int nargs(){ return %d ; }
@@ -38,6 +40,7 @@
 		
 		CppMethod%d( Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
+			%s
 			(object->*met)( %s ) ;
 			return R_NilValue ;
 		}
@@ -61,6 +64,7 @@
 		
 		const_CppMethod%d(Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
+			%s
 			return Rcpp::module_wrap<CLEANED_OUT>( (object->*met)( %s ) ) ;
 		}
 		inline int nargs(){ return %d ; }
@@ -79,6 +83,7 @@
 		
 		const_CppMethod%d( Method m) : method_class(), met(m) {} 
 		SEXP operator()( Class* object, SEXP* args){
+			%s
 			(object->*met)( %s ) ;
 			return R_NilValue ;
 		}
@@ -95,9 +100,10 @@
 typenames,  # typename U0, ...
 i,           
 u,          # U0 u0, ...
+i,
+input_parameter,
+x,         # Rcpp::as<U0>( args[0] ) , ...
 i, 
-as,         # Rcpp::as<U0>( args[0] ) , ...
-i, 
 U,
 
 typenames,  # typename U0, ...
@@ -105,7 +111,8 @@
 U, 			# U0, ...
 u,          # U0 u0, ...
 i,
-as, 
+input_parameter,
+x, 
 i, 
 U,
 
@@ -114,7 +121,8 @@
 i,           
 u,          # U0 u0, ...
 i, 
-as,         # Rcpp::as<U0>( args[0] ) , ...
+input_parameter,
+x,         # Rcpp::as<U0>( args[0] ) , ...
 i, 
 U, 
 
@@ -123,7 +131,8 @@
 U, 			 # U0, ...
 u,          # U0 u0, ...
 i, 
-as, 
+input_parameter,
+x, 
 i,
 U 
 
@@ -136,7 +145,7 @@
 //
 // Module_generated_CppMethod.h: Rcpp R/C++ interface class library -- Rcpp modules
 //
-// Copyright (C) 2010-2012  Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010-2013  Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //

Modified: scripts/generator_Module_PointerCppMethod.R
===================================================================
--- scripts/generator_Module_PointerCppMethod.R	2013-09-28 08:37:34 UTC (rev 4541)
+++ scripts/generator_Module_PointerCppMethod.R	2013-09-28 08:38:36 UTC (rev 4542)
@@ -3,11 +3,12 @@
 fun <- function( i ){
 
 	index <- (1:i)-1
-	collapse <- function(x) paste( x, collapse = ", " )
+	collapse <- function(x, collapse = ", " ) paste( x, collapse = collapse )
 	
 	typenames <- collapse( sprintf( "typename U%d", index ) )
 	u <- collapse( sprintf( "U%d u%d", index, index ) )
-    as <- collapse( sprintf( "Rcpp::as< typename Rcpp::traits::remove_const_and_reference< U%d >::type >( args[%d] )", index, index ) )  
+    input_parameter <- collapse( sprintf( "typename Rcpp::traits::input_parameter< U%d >::type x%d( args[%d] ) ;", index, index, index ), collapse = "\n" )  
+    x <- collapse( sprintf( "x%d", index ) )
     U <- collapse( sprintf( "U%d", index ) )
        
 txt <- sprintf( '
@@ -20,6 +21,7 @@
 		
 		Pointer_CppMethod%d(Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
+		    %s
 		    return Rcpp::module_wrap<CLEANED_OUT>( met( object, %s ) ) ;
 		}
 		inline int nargs(){ return %d ; }
@@ -38,7 +40,8 @@
 		
 		Pointer_CppMethod%d( Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
-			met( object, %s ) ;
+			%s
+		    met( object, %s ) ;
 			return R_NilValue ;
 		}
 		inline int nargs(){ return %d ; }
@@ -61,6 +64,7 @@
 		
 		Const_Pointer_CppMethod%d(Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
+			%s
 			return Rcpp::module_wrap<CLEANED_OUT>( met( object, %s ) ) ;
 		}
 		inline int nargs(){ return %d ; }
@@ -79,6 +83,7 @@
 		
 		Const_Pointer_CppMethod%d( Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
+			%s
 			met( object, %s ) ;
 			return R_NilValue ;
 		}
@@ -97,7 +102,8 @@
 i,           
 u,          # U0 u0, ...
 i, 
-as,         # Rcpp::as<U0>( args[0] ) , ...
+input_parameter,
+x,
 i,
 U, 
 
@@ -106,7 +112,8 @@
 U, 			# U0, ...
 u,          # U0 u0, ...
 i, 
-as, 
+input_parameter,
+x,
 i,
 U, 
 
@@ -116,7 +123,8 @@
 i,           
 u,          # U0 u0, ...
 i, 
-as,         # Rcpp::as<U0>( args[0] ) , ...
+input_parameter,
+x,
 i,
 U, 
 
@@ -125,7 +133,8 @@
 U, 			# U0, ...
 u,          # U0 u0, ...
 i, 
-as, 
+input_parameter,
+x,
 i,
 U
 



More information about the Rcpp-commits mailing list