[Rcpp-commits] r392 - in pkg: inst src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jan 17 13:52:11 CET 2010
Author: romain
Date: 2010-01-17 13:52:11 +0100 (Sun, 17 Jan 2010)
New Revision: 392
Modified:
pkg/inst/ChangeLog
pkg/src/RcppCommon.cpp
pkg/src/RcppCommon.h
pkg/src/exceptions.cpp
Log:
less dumb exception code in non gcc compilers
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2010-01-17 11:12:02 UTC (rev 391)
+++ pkg/inst/ChangeLog 2010-01-17 12:52:11 UTC (rev 392)
@@ -1,5 +1,10 @@
2010-01-16 Romain Francois <francoisromain at free.fr>
+ * src/exceptions.cpp: slightly less dumb exception logic
+ on non GCC compilers. exceptions will now trigger an R error
+ with a default message (we don't attempt to get the
+ exception class or message because we don't know how to)
+
* src/Rcpp/Pairlist.h: Pairlist lacked a default constructor
which is needed when the variadic templates are not
available
Modified: pkg/src/RcppCommon.cpp
===================================================================
--- pkg/src/RcppCommon.cpp 2010-01-17 11:12:02 UTC (rev 391)
+++ pkg/src/RcppCommon.cpp 2010-01-17 12:52:11 UTC (rev 392)
@@ -141,54 +141,8 @@
}
}
-/* garbage collection machinery */
-// static SEXP Rcpp_PreciousList = NULL ;
-
SEXP initRcpp(){
initUncaughtExceptionHandler() ;
- // Rcpp_PreciousList = R_NilValue ;
- // R_PreserveObject(Rcpp_PreciousList) ;
return R_NilValue ;
}
-// later
-// static SEXP ReleaseObj(SEXP object, SEXP list) {
-// if (!Rf_isNull(list)) {
-// if (CAR(list) != object) {
-// SEXP c = list;
-// while (!Rf_isNull(CDR(c))) {
-// if (CADR(c) == object) {
-// SETCDR(c, CDDR(c));
-// break;
-// }
-// c = CDR(c);
-// }
-// } else return CDR(list);
-// }
-// return list;
-// }
-//
-//
-// void Rcpp_PreserveObject(SEXP object){
-// Rcpp_PreciousList = Rf_cons(object, Rcpp_PreciousList);
-// // Rprintf( "preserve, stack size: %d\n", stacksize) ;
-// // R_PreserveObject(object);
-// }
-// void Rcpp_ReleaseObject(SEXP object){
-// // Rprintf( "release , stack size: %d\n", stacksize) ;
-// // R_ReleaseObject(object);
-// // if (CAR(Rcpp_PreciousList) == object) {
-// // Rcpp_PreciousList = CDR(Rcpp_PreciousList);
-// // } else {
-// // SEXP c = Rcpp_PreciousList;
-// // while (!Rf_isNull(CDR(c))) {
-// // if (CADR(c) == object) {
-// // SETCDR(c, CDDR(c));
-// // break;
-// // }
-// // c = CDR(c) ;
-// // }
-// // }
-// Rcpp_PreciousList = ReleaseObj( object, Rcpp_PreciousList) ;
-// }
-
Modified: pkg/src/RcppCommon.h
===================================================================
--- pkg/src/RcppCommon.h 2010-01-17 11:12:02 UTC (rev 391)
+++ pkg/src/RcppCommon.h 2010-01-17 12:52:11 UTC (rev 392)
@@ -72,10 +72,7 @@
#endif
/* in exceptions.cpp */
-#ifdef __GNUC__
void forward_uncaught_exceptions_to_r() ;
-#endif
-
RcppExport SEXP initUncaughtExceptionHandler() ;
/* just testing variadic templates */
@@ -92,7 +89,4 @@
const char * const sexp_to_name(int sexp_type);
RcppExport SEXP initRcpp() ;
-void Rcpp_PreserveObject(SEXP object) ;
-void Rcpp_ReleaseObject(SEXP object) ;
-
#endif
Modified: pkg/src/exceptions.cpp
===================================================================
--- pkg/src/exceptions.cpp 2010-01-17 11:12:02 UTC (rev 391)
+++ pkg/src/exceptions.cpp 2010-01-17 12:52:11 UTC (rev 392)
@@ -80,16 +80,20 @@
}
+#else
+void forward_uncaught_exceptions_to_r(){
+ Rf_eval(
+ Rf_lang3(
+ Rf_install("cpp_exception"),
+ Rf_mkString("exception : we don't know how to get the exception message with your compiler, patches welcome"),
+ R_NilValue ), R_FindNamespace(Rf_mkString("Rcpp"))
+ ) ;
+}
+#endif
SEXP initUncaughtExceptionHandler(){
/* FIXME: we might want to restore the original handler as the package
gets unloaded */
std::set_terminate(forward_uncaught_exceptions_to_r);
return R_NilValue ;
}
-#else
-SEXP initUncaughtExceptionHandler(){
- Rf_warning( "exception handling not supported by your compiler" ) ;
- return R_NilValue ;
-}
-#endif
More information about the Rcpp-commits
mailing list