[Rcpp-commits] r1295 - in pkg/Rcpp: inst/include/Rcpp inst/unitTests src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 20 15:50:32 CEST 2010


Author: romain
Date: 2010-05-20 15:50:32 +0200 (Thu, 20 May 2010)
New Revision: 1295

Modified:
   pkg/Rcpp/inst/include/Rcpp/Vector.h
   pkg/Rcpp/inst/unitTests/runit.Module.R
   pkg/Rcpp/src/Module.cpp
   pkg/Rcpp/src/RcppCommon.cpp
Log:
better throw declaration for vector_from_string template (needs also to declare that it throws parse_error)

Modified: pkg/Rcpp/inst/include/Rcpp/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Vector.h	2010-05-20 13:45:38 UTC (rev 1294)
+++ pkg/Rcpp/inst/include/Rcpp/Vector.h	2010-05-20 13:50:32 UTC (rev 1295)
@@ -260,12 +260,12 @@
 	} ;
 	
 	template <int RTYPE>
-	SEXP vector_from_string( const std::string& st ) throw(not_compatible) {
+	SEXP vector_from_string( const std::string& st ) throw(parse_error,not_compatible) {
 		return r_cast<RTYPE>( Rf_mkString( st.c_str() ) ) ;
 	}
 	
 	template <int RTYPE>
-	SEXP vector_from_string_expr( const std::string& code) throw(parse_error) {
+	SEXP vector_from_string_expr( const std::string& code) throw(parse_error,not_compatible) {
 		ParseStatus status;
 		SEXP expr = PROTECT( ::Rf_mkString( code.c_str() ) );
 		SEXP res  = PROTECT( ::R_ParseVector(expr, -1, &status, R_NilValue));
@@ -282,7 +282,7 @@
 	}
 	
 	template <>
-	inline SEXP vector_from_string<EXPRSXP>( const std::string& st ) throw(not_compatible) {
+	inline SEXP vector_from_string<EXPRSXP>( const std::string& st ) throw(parse_error,not_compatible) {
 		return vector_from_string_expr<EXPRSXP>( st ) ;
 	}
 	

Modified: pkg/Rcpp/inst/unitTests/runit.Module.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Module.R	2010-05-20 13:45:38 UTC (rev 1294)
+++ pkg/Rcpp/inst/unitTests/runit.Module.R	2010-05-20 13:50:32 UTC (rev 1295)
@@ -17,7 +17,8 @@
 # You should have received a copy of the GNU General Public License
 # along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-test.Argument <- function(){
+if( Rcpp:::capabilities()[["Rcpp modules"]] )
+test.Module <- function(){
 
 	inc  <- '
 	

Modified: pkg/Rcpp/src/Module.cpp
===================================================================
--- pkg/Rcpp/src/Module.cpp	2010-05-20 13:45:38 UTC (rev 1294)
+++ pkg/Rcpp/src/Module.cpp	2010-05-20 13:50:32 UTC (rev 1295)
@@ -76,5 +76,8 @@
 	}
 	
 }
+#else
+/* quiet ranlib */ 
+void dummy(){}
 #endif
 

Modified: pkg/Rcpp/src/RcppCommon.cpp
===================================================================
--- pkg/Rcpp/src/RcppCommon.cpp	2010-05-20 13:45:38 UTC (rev 1294)
+++ pkg/Rcpp/src/RcppCommon.cpp	2010-05-20 13:50:32 UTC (rev 1295)
@@ -42,8 +42,8 @@
 }
 
 SEXP capabilities(){
-	SEXP cap = PROTECT( Rf_allocVector( LGLSXP, 5) ) ;
-	SEXP names = PROTECT( Rf_allocVector( STRSXP, 5 ) ) ;
+	SEXP cap = PROTECT( Rf_allocVector( LGLSXP, 6) ) ;
+	SEXP names = PROTECT( Rf_allocVector( STRSXP, 6 ) ) ;
 #ifdef HAS_VARIADIC_TEMPLATES
 	LOGICAL(cap)[0] = TRUE ;
 #else
@@ -69,11 +69,18 @@
 	LOGICAL(cap)[4] = FALSE ;
 #endif
 
+#ifdef RCPP_EXPERIMENTAL
+	LOGICAL(cap)[5] = TRUE ;
+#else
+	LOGICAL(cap)[5] = FALSE ;
+#endif
+
 	SET_STRING_ELT(names, 0, Rf_mkChar("variadic templates") ) ;
 	SET_STRING_ELT(names, 1, Rf_mkChar("initializer lists") ) ;
 	SET_STRING_ELT(names, 2, Rf_mkChar("exception handling") ) ;
 	SET_STRING_ELT(names, 3, Rf_mkChar("tr1 unordered maps") ) ;
 	SET_STRING_ELT(names, 4, Rf_mkChar("tr1 unordered sets") ) ;
+	SET_STRING_ELT(names, 5, Rf_mkChar("Rcpp modules") ) ;
 	Rf_setAttrib( cap, R_NamesSymbol, names ) ;
 	UNPROTECT(2) ;
 	return cap ;



More information about the Rcpp-commits mailing list