[Rcpp-commits] r2859 - in pkg/Rcpp: inst/include inst/include/Rcpp inst/include/Rcpp/generated inst/include/Rcpp/vector src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 11 16:04:45 CET 2011


Author: romain
Date: 2011-01-11 16:04:45 +0100 (Tue, 11 Jan 2011)
New Revision: 2859

Modified:
   pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h
   pkg/Rcpp/inst/include/Rcpp/Function.h
   pkg/Rcpp/inst/include/Rcpp/Module.h
   pkg/Rcpp/inst/include/Rcpp/generated/Function__operator.h
   pkg/Rcpp/inst/include/Rcpp/grow.h
   pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
   pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h
   pkg/Rcpp/inst/include/RcppCommon.h
   pkg/Rcpp/src/Environment.cpp
   pkg/Rcpp/src/Evaluator.cpp
   pkg/Rcpp/src/Language.cpp
   pkg/Rcpp/src/Module.cpp
   pkg/Rcpp/src/Reference.cpp
   pkg/Rcpp/src/cache.cpp
Log:
trying things (not over yet)

Modified: pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -30,7 +30,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -44,7 +44,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -58,7 +58,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -72,7 +72,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -86,7 +86,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -100,7 +100,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -114,7 +114,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -128,7 +128,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -142,7 +142,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -156,7 +156,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -170,7 +170,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -184,7 +184,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -198,7 +198,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -212,7 +212,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -226,7 +226,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -240,7 +240,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -254,7 +254,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -268,7 +268,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -282,7 +282,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;
@@ -296,7 +296,7 @@
 	try{
 		return DataFrame( 
 			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20 ) )
+				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20 ) )
 				) ) ;
 	} catch( eval_error& __ex__){
 		throw not_compatible("error calling the data.frame function") ;

Modified: pkg/Rcpp/inst/include/Rcpp/Function.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Function.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/Rcpp/Function.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -72,11 +72,11 @@
 #ifdef HAS_VARIADIC_TEMPLATES
 template<typename... Args> 
 	SEXP operator()( const Args&... args) /* throw(Evaluator::eval_error) */ const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(args...) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(args...) ) ) ;
 	}
 #else
 	SEXP operator()() const {
-		return internal::try_catch( Rf_lcons( m_sexp, R_NilValue ) ) ;	
+		return internal::try_catch( Rf_lang1( m_sexp  ) ) ;	
 	}
 	
 #include <Rcpp/generated/Function__operator.h>	

Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -237,7 +237,6 @@
 	typedef std::vector<signed_method_class*> vec_signed_method ;
 	
 	S4_CppOverloadedMethods( vec_signed_method* m, SEXP class_xp, const char* name, std::string& buffer ) : Reference( "C++OverloadedMethods" ){
-        
 	    int n = m->size() ;
         Rcpp::LogicalVector voidness(n), constness(n) ;
         Rcpp::CharacterVector docstrings(n), signatures(n) ;
@@ -656,7 +655,7 @@
 	    typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
 		vec_signed_method* v; 
 	    for( int i=0; i<n; i++, ++it){
-		    mnames[i] = it->first ;
+	        mnames[i] = it->first ;
 		    v = it->second ;
 		    res[i] = S4_CppOverloadedMethods<Class>( v , class_xp, it->first.c_str(), buffer ) ;
 		}

Modified: pkg/Rcpp/inst/include/Rcpp/generated/Function__operator.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/generated/Function__operator.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/Rcpp/generated/Function__operator.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -26,108 +26,108 @@
 
 	template <TYPENAMES>
 	SEXP operator()(ARGUMENTS){
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(PARAMETERS) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(PARAMETERS) ) ) ;
 	}
 	
 */
 	template <typename T1>
 	SEXP operator()(const T1& t1) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1) ) ) ;
 	}
 	
 	template <typename T1, typename T2>
 	SEXP operator()(const T1& t1, const T2& t2) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19) ) ) ;
 	}
 	
 	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20>
 	SEXP operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20) const {
-		return internal::try_catch( Rf_lcons( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20) ) ) ;
+		return internal::try_catch( Rf_lang2( m_sexp, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20) ) ) ;
 	}
 	
 /* </code-bloat> */

Modified: pkg/Rcpp/inst/include/Rcpp/grow.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/grow.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/Rcpp/grow.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -52,13 +52,12 @@
 
 template <typename T>
 SEXP grow__dispatch( ::Rcpp::traits::false_type, const T& head, SEXP tail ){
-	return Rf_cons( wrap(head), tail ) ;	
+	return Rf_list2( wrap(head), tail ) ;	
 }
 
 template <typename T>
 SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){
-	SEXP x;
-	x = PROTECT( Rf_cons( wrap( head.object) , tail) ) ;
+	SEXP x = PROTECT( Rf_list2( wrap( head.object) , tail) ) ;
 	SET_TAG( x, Rf_install( head.name.c_str() ) ); 
 	UNPROTECT(1); 
 	return x; 	

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -369,8 +369,8 @@
 				/* use the slower and more flexible version (callback to R) */
 			
 				SEXP new_vec = PROTECT( internal::try_catch( 
-				Rf_lcons( Rf_install("names<-"), 
-						Rf_cons( parent, Rf_cons( x , R_NilValue) )))) ;
+				    Rf_lang3( Rf_install("names<-"), parent, x )
+				)) ;
 				/* names<- makes a new vector, so we have to change 
 				   the SEXP of the parent of this proxy */
 				const_cast<Vector&>(parent).set_sexp( new_vec ) ;

Modified: pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -30,11 +30,11 @@
 		
 		SEXP eval(){
 			SEXP xp = ( static_cast<VECTOR&>(*this) ).asSexp() ;
-			return try_catch( ::Rf_lcons( ::Rf_install( "eval" ) , ::Rf_cons( xp, R_NilValue) ) ) ;
+			return try_catch( Rf_lang2( Rf_install( "eval" ), xp ) ) ;
 		} ;
 		SEXP eval( const ::Rcpp::Environment& env ){
 			SEXP xp = ( static_cast<VECTOR&>(*this) ).asSexp() ;
-			return try_catch( ::Rf_lcons( ::Rf_install( "eval" ) , ::Rf_cons( xp, ::Rf_cons(env.asSexp(), R_NilValue)) ) ) ;
+			return try_catch( Rf_lang3( Rf_install( "eval" ), xp, env.asSexp() ) ) ;
 		} ;
 	} ;
 	

Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/inst/include/RcppCommon.h	2011-01-11 15:04:45 UTC (rev 2859)
@@ -130,6 +130,13 @@
 #include <Rversion.h>
 #define RCPP_GET_NAMES(x)	Rf_getAttrib(x, R_NamesSymbol)
 
+inline SEXP Rcpp_lcons(SEXP car, SEXP cdr){
+    PROTECT(car) ;
+    car = Rf_lcons( car, cdr ) ; 
+    UNPROTECT(1) ;
+    return car ;
+}
+
 #include <Rcpp/complex.h>
 
 #include <Rcpp/barrier.h>

Modified: pkg/Rcpp/src/Environment.cpp
===================================================================
--- pkg/Rcpp/src/Environment.cpp	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/src/Environment.cpp	2011-01-11 15:04:45 UTC (rev 2859)
@@ -134,17 +134,17 @@
     	    	    } else{
     	    	    	    /* unless we want to copy all of do_remove, 
     	    	    	       we have to go back to R to do this operation */
-    	    	    	    SEXP call = Rf_lang2( 
+    	    	    	    SEXP call = PROTECT( Rf_lang2( 
     	    	    	    	    Rf_install( ".Internal" ), 
-    	    	    	    	    Rf_lcons( Rf_install( "remove" ), 
-    	    	    	    	    	    Rf_cons( Rf_mkString(name.c_str()), 
-    	    	    	    	    	    	    Rf_cons( m_sexp, 
-    	    	    	    	    	    	    	    Rf_cons( Rf_ScalarLogical( FALSE ), R_NilValue )
-    	    	    	    	    	    	    	    ) 
-    	    	    	    	    	    	    )
-    	    	    	    	    	    )
-    	    	    	    	    ) ;
+    	    	    	    	    Rf_lang4( 
+    	    	    	    	        Rf_install( "remove" ), 
+    	    	    	    	        Rf_mkString(name.c_str()), 
+    	    	    	    	        m_sexp, 
+    	    	    	    	        Rf_ScalarLogical( FALSE )
+    	    	    	    	    )
+    	    	    	    	    ) );
     	    	    	    Rf_eval( call, R_GlobalEnv ) ;
+    	    	    	    UNPROTECT(1) ;
     	    	    }
     	    } else{
     	    	throw no_such_binding(name) ;
@@ -264,9 +264,8 @@
     
     Environment Environment::new_child(bool hashed) {
     	    return Environment( Evaluator::run( 
-    	    	    Rf_lcons( Rf_install("new.env"), 
-    	    	    	    Rf_cons(Rf_ScalarLogical(hashed), 
-    	    	    	    	    Rf_cons(m_sexp,R_NilValue)) ) ) );
+    	        Rf_lang3( Rf_install("new.env"), Rf_ScalarLogical(hashed), m_sexp )
+    	    ) );
     }
     
     

Modified: pkg/Rcpp/src/Evaluator.cpp
===================================================================
--- pkg/Rcpp/src/Evaluator.cpp	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/src/Evaluator.cpp	2011-01-11 15:04:45 UTC (rev 2859)
@@ -36,7 +36,10 @@
 	SEXP res = PROTECT( Rf_eval( call, RCPP ) );
 	
 	/* was there an error ? */
-	int error = LOGICAL( Rf_eval( Rf_lang1( Rf_install("errorOccured") ), RCPP ) )[0];
+	SEXP err_call = PROTECT( Rf_lang1( Rf_install("errorOccured") ) ) ;
+	SEXP err_res  = PROTECT( Rf_eval( err_call, RCPP ) ) ;
+	int error = LOGICAL( err_res )[0];
+	UNPROTECT(2) ;
 	
 	if( error ){
 		SEXP err_msg = PROTECT( Rf_eval( 
@@ -61,7 +64,7 @@
     SEXP convert_using_rfunction(SEXP x, const char* const fun) throw(::Rcpp::not_compatible) {
     	SEXP res = R_NilValue ;
     	try{    
-    		res = Evaluator::run( Rf_lcons( Rf_install(fun), Rf_cons(x, R_NilValue) ) ) ;
+    		res = Evaluator::run( Rf_lang2( Rf_install(fun), x ) ) ;
     	} catch( eval_error& e){
     		throw ::Rcpp::not_compatible( std::string("could not convert using R function : ") + fun  ) ;
     	}

Modified: pkg/Rcpp/src/Language.cpp
===================================================================
--- pkg/Rcpp/src/Language.cpp	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/src/Language.cpp	2011-01-11 15:04:45 UTC (rev 2859)
@@ -39,15 +39,15 @@
 	}
 	
 	Language::Language( const std::string& symbol ): DottedPair() {
-		setSEXP( Rf_lcons( Symbol(symbol), R_NilValue ) );
+		setSEXP( Rf_lang1( Symbol(symbol) ) );
 	}
 	
 	Language::Language( const Symbol& symbol ): DottedPair() {
-		setSEXP( Rf_lcons( symbol, R_NilValue ) ) ;
+		setSEXP( Rf_lang1( symbol ) ) ;
 	}
 	
 	Language::Language( const Function& function): DottedPair() {
-		setSEXP( Rf_lcons( function, R_NilValue ) ) ;		
+		setSEXP( Rf_lang1( function ) ) ;		
 	}
 	
 	Language::~Language(){}

Modified: pkg/Rcpp/src/Module.cpp
===================================================================
--- pkg/Rcpp/src/Module.cpp	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/src/Module.cpp	2011-01-11 15:04:45 UTC (rev 2859)
@@ -318,7 +318,7 @@
 		CLASS_MAP::iterator it = classes.begin() ;
 		std::string buffer ;
 		for( int i=0; i<n; i++, ++it){
-			names[i] = it->first ;
+		    names[i] = it->first ;
 			info[i]  = CppClass( this , it->second, buffer ) ;
 		}
 		info.names() = names ;

Modified: pkg/Rcpp/src/Reference.cpp
===================================================================
--- pkg/Rcpp/src/Reference.cpp	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/src/Reference.cpp	2011-01-11 15:04:45 UTC (rev 2859)
@@ -53,15 +53,10 @@
 	}
 	
 	Reference::Reference( const std::string& klass ) throw(S4_creation_error,reference_creation_error) : S4(){
-		// using callback to R as apparently R_do_new_object always makes the same environment
-	    SEXP call = Rf_lcons( 
-		    Rf_install( "new" ), 
-		        Rf_cons( 
-		            Rf_mkString( klass.c_str() ), 
-		            R_NilValue
-		        )
-		    ) ;
-		setSEXP( Rcpp::internal::try_catch( call ) ) ;
+	    // using callback to R as apparently R_do_new_object always makes the same environment
+	    SEXP call = PROTECT( Rf_lang2( Rf_install( "new" ), Rf_mkString( klass.c_str() ) ) ) ;
+	    setSEXP( Rcpp::internal::try_catch( call ) ) ;
+	    UNPROTECT(1) ; // call
 	}
 	
 	void Reference::set( SEXP x) throw(not_reference) {
@@ -85,29 +80,25 @@
     SEXP Reference::FieldProxy::get() const {
     	// TODO: get the field  
     	
-    	SEXP call = ::Rf_lcons( 
+    	SEXP call = PROTECT( Rf_lang3( 
     	    R_DollarSymbol, 
-    	    Rf_cons( const_cast<Reference&>(parent).asSexp() , 
-    	        Rf_cons( 
-    	            Rf_mkString( field_name.c_str() ),
-    	            R_NilValue 
-    	            ) ) ) ;
-    	
+    	    const_cast<Reference&>(parent).asSexp(), 
+    	    Rf_mkString( field_name.c_str() )
+    	    ) ) ;
     	return Rcpp::internal::try_catch( call ) ;
+    	UNPROTECT(1) ;
     }
     
     void Reference::FieldProxy::set( SEXP x) const {
     	// TODO: set the field
-        SEXP call = ::Rf_lcons( 
-    	    Rf_install( "$<-") , 
-    	    Rf_cons( const_cast<Reference&>(parent).asSexp() , 
-    	        Rf_cons( 
-    	            Rf_mkString( field_name.c_str() ),
-    	            Rf_cons( 
-    	               x,
-    	               R_NilValue 
-    	            ) ) ) ) ;
-    	const_cast<Reference&>(parent).setSEXP( Rf_eval( call, R_GlobalEnv ) );	            
+        SEXP call = PROTECT( Rf_lang4( 
+            Rf_install( "$<-"), 
+            const_cast<Reference&>(parent).asSexp(), 
+            Rf_mkString( field_name.c_str() ), 
+            x
+            ) ) ;
+        const_cast<Reference&>(parent).setSEXP( Rf_eval( call, R_GlobalEnv ) );	
+        UNPROTECT(1) ;
     }
 
     Reference::FieldProxy Reference::field( const std::string& name) const {

Modified: pkg/Rcpp/src/cache.cpp
===================================================================
--- pkg/Rcpp/src/cache.cpp	2011-01-11 12:59:44 UTC (rev 2858)
+++ pkg/Rcpp/src/cache.cpp	2011-01-11 15:04:45 UTC (rev 2859)
@@ -51,7 +51,10 @@
     Rcpp_cache = PROTECT( Rf_allocVector( VECSXP, 10 ) );
 	
     // the Rcpp namespace
-    SEXP RCPP = PROTECT( Rf_eval( Rf_lcons( Rf_install("getNamespace"), Rf_cons( Rf_mkString("Rcpp") , R_NilValue) ), R_GlobalEnv ) ) ;
+    SEXP RCPP = PROTECT( Rf_eval( 
+        Rf_lang2( Rf_install("getNamespace"), Rf_mkString("Rcpp") ), 
+        R_GlobalEnv
+    ) ) ;
     SET_VECTOR_ELT( Rcpp_cache, 0, RCPP ) ;
 	reset_current_error() ;
 	// SET_VECTOR_ELT( Rcpp_cache, 4, Rf_install("rcpp_tryCatch") ) ;



More information about the Rcpp-commits mailing list