[Rcpp-commits] r2885 - pkg/Rcpp pkg/Rcpp/inst/include/Rcpp scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 25 21:59:41 CET 2011


Author: edd
Date: 2011-01-25 21:59:41 +0100 (Tue, 25 Jan 2011)
New Revision: 2885

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h
   scripts/DataFrame.R
Log:
more Rf_install() to local SEXP, this time via generated script


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2011-01-25 20:17:23 UTC (rev 2884)
+++ pkg/Rcpp/ChangeLog	2011-01-25 20:59:41 UTC (rev 2885)
@@ -1,3 +1,8 @@
+2011-01-25  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/Rcpp/DataFrame_generated.h: Assign Rf_install() result
+	to local SEXP (by modifying generator script creating the file)
+
 2011-01-25  Douglas Bates  <bates at stat.wisc.edu>
 
 	* src/exceptions.cpp: Assign Rf_install() result to local SEXP

Modified: pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h	2011-01-25 20:17:23 UTC (rev 2884)
+++ pkg/Rcpp/inst/include/Rcpp/DataFrame_generated.h	2011-01-25 20:59:41 UTC (rev 2885)
@@ -1,9 +1,9 @@
 
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
 // DataFrame_generated.h: Rcpp R/C++ interface class library -- data frames
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2011  Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -26,283 +26,223 @@
 
 
 template <typename T1>
-static DataFrame create( const T1& t1 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1 ) )
-				) ) ;
-	} catch( eval_error& __ex__){
-		throw not_compatible("error calling the data.frame function") ;
-	}
-}
+static DataFrame create( const T1& t1 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2>
-static DataFrame create( const T1& t1, const T2& t2 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2 ) )
-				) ) ;
-	} catch( eval_error& __ex__){
-		throw not_compatible("error calling the data.frame function") ;
-	}
-}
+static DataFrame create( const T1& t1, const T2& t2 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3>
-static DataFrame create( const T1& t1, const T2& t2, const T3& t3 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3 ) )
-				) ) ;
-	} catch( eval_error& __ex__){
-		throw not_compatible("error calling the data.frame function") ;
-	}
-}
+static DataFrame create( const T1& t1, const T2& t2, const T3& t3 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4>
-static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::Rcpp_lcons( ::Rf_install( "data.frame"), pairlist( t1, t2, t3, t4 ) )
-				) ) ;
-	} catch( eval_error& __ex__){
-		throw not_compatible("error calling the data.frame function") ;
-	}
-}
+static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3, t4))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4, typename T5>
-static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3, t4, t5))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
-static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3, t4, t5, t6))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
-static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3, t4, t5, t6, t7))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
-static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3, t4, t5, t6, t7, t8))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} 
 
 
-
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
 
-
 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>
-static DataFrame create( 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 ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::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") ;
-	}
-}
+static DataFrame create( 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 ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, 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") ;
+    }
+} 
 
-
 #endif
 

Modified: scripts/DataFrame.R
===================================================================
--- scripts/DataFrame.R	2011-01-25 20:17:23 UTC (rev 2884)
+++ scripts/DataFrame.R	2011-01-25 20:59:41 UTC (rev 2885)
@@ -1,36 +1,33 @@
-#
-# use this script to generate the file DataFrame_generated.h
-#
+#!/usr/bin/r
+##
+## use this script to generate the file DataFrame_generated.h
+##
 
-DataFrame_generator <- function( i ){
-	
-sprintf( '
+DataFrame_generator <- function( i ) {
+    src <-
+    sprintf('
 template <%s>
-static DataFrame create( %s ) throw(not_compatible){
-	try{
-		return DataFrame( 
-			internal::try_catch( 
-				::Rf_lcons( ::Rf_install( "data.frame"), pairlist( %s ) )
-				) ) ;
-	} catch( eval_error& __ex__){
-		throw not_compatible("error calling the data.frame function") ;
-	}
+static DataFrame create( %s ) throw(not_compatible) {
+    try{
+	SEXP dataFrameSym = ::Rf_install( "data.frame"); // cannot be gc()ed once in symbol table
+	return DataFrame(internal::try_catch(::Rf_lcons(dataFrameSym, pairlist(%s))));
+    } catch( eval_error& __ex__){
+	throw not_compatible("error calling the data.frame function") ;
+    }
+} ',
+            paste( sprintf( "typename T%d", 1:i ), collapse = ", "),
+            paste( sprintf( "const T%d& t%d", 1:i, 1:i ), collapse = ", "),
+            paste( sprintf( "t%d", 1:i ), collapse = ", ")
+            )
 }
-', 
-paste( sprintf( "typename T%d", 1:i ), collapse = ", "), 
-paste( sprintf( "const T%d& t%d", 1:i, 1:i ), collapse = ", "), 
-paste( sprintf( "t%d", 1:i ), collapse = ", ")
-)
-	
-}
 
 
 content <- sprintf( '
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
 //
 // DataFrame_generated.h: Rcpp R/C++ interface class library -- data frames
 //
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2011  Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -54,8 +51,8 @@
 %s
 
 #endif
-' , 
+' ,
 paste( sapply( 1:20, DataFrame_generator ), collapse = "\n\n" )
 )
-writeLines( content, "Rcpp/inst/include/Rcpp/DataFrame_generated.h" ) 
+writeLines( content, "Rcpp/inst/include/Rcpp/DataFrame_generated.h" )
 



More information about the Rcpp-commits mailing list