[Rcpp-commits] r2286 - in pkg/Rcpp: . R inst/include/Rcpp src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Oct 7 14:40:23 CEST 2010
Author: romain
Date: 2010-10-07 14:40:23 +0200 (Thu, 07 Oct 2010)
New Revision: 2286
Modified:
pkg/Rcpp/NAMESPACE
pkg/Rcpp/R/exceptions.R
pkg/Rcpp/inst/include/Rcpp/cache.h
pkg/Rcpp/inst/include/Rcpp/routines.h
pkg/Rcpp/src/Rcpp_init.c
pkg/Rcpp/src/cache.cpp
Log:
register native routines
Modified: pkg/Rcpp/NAMESPACE
===================================================================
--- pkg/Rcpp/NAMESPACE 2010-10-07 12:27:18 UTC (rev 2285)
+++ pkg/Rcpp/NAMESPACE 2010-10-07 12:40:23 UTC (rev 2286)
@@ -12,6 +12,11 @@
Module__has_class,Module__has_function,Module__functions_arity,
Module__name, CppObject__finalize,
+ get_rcpp_cache, init_Rcpp_cache, reset_current_error,
+ rcpp_error_recorder, rcpp_set_current_error, rcpp_get_current_error,
+ rcpp_set_error_occured, rcpp_get_error_occured,
+ rcpp_set_stack_trace, rcpp_get_stack_trace,
+
# .External functions
CppMethod__invoke, InternalFunction_invoke, Module__invoke, class__newInstance
)
Modified: pkg/Rcpp/R/exceptions.R
===================================================================
--- pkg/Rcpp/R/exceptions.R 2010-10-07 12:27:18 UTC (rev 2285)
+++ pkg/Rcpp/R/exceptions.R 2010-10-07 12:40:23 UTC (rev 2286)
@@ -28,14 +28,14 @@
}
# used by Rcpp::Evaluator
-setCurrentError <- function( condition = NULL) .Call( "rcpp_set_current_error", condition, PACKAGE = "Rcpp" )
-getCurrentError <- function() .Call( "rcpp_get_current_error", PACKAGE = "Rcpp" )
+setCurrentError <- function( condition = NULL) .Call( rcpp_set_current_error, condition )
+getCurrentError <- function() .Call( rcpp_get_current_error )
-setErrorOccured <- function(error_occured = TRUE) .Call( "rcpp_set_error_occured", error_occured, PACKAGE = "Rcpp" )
-getErrorOccured <- function() .Call( "rcpp_get_error_occured", PACKAGE = "Rcpp" )
+setErrorOccured <- function(error_occured = TRUE) .Call( rcpp_set_error_occured, error_occured )
+getErrorOccured <- function() .Call( rcpp_get_error_occured )
-setStackTrace <- function(trace = TRUE) .Call( "rcpp_set_stack_trace", trace, PACKAGE = "Rcpp" )
-getStackTrace <- function() .Call( "rcpp_get_stack_trace", PACKAGE = "Rcpp" )
+setStackTrace <- function(trace = TRUE) .Call( rcpp_set_stack_trace, trace )
+getStackTrace <- function() .Call( rcpp_get_stack_trace)
# all below are called from Evaluator::run
# on the C++ side, don't change them unless you also change
@@ -44,12 +44,12 @@
getCurrentErrorMessage <- function() conditionMessage( getCurrentError() )
errorOccured <- function() getErrorOccured()
.rcpp_error_recorder <- function(e){
- invisible( .Call( "rcpp_error_recorder", e, PACKAGE = "Rcpp" ) )
+ invisible( .Call( rcpp_error_recorder, e ) )
}
# simplified version of utils::tryCatch
rcpp_tryCatch <- function(expr, unused){ # unused is kept for compatibility, but is indeed not used
- .Call("reset_current_error", PACKAGE = "Rcpp")
+ .Call(reset_current_error)
rcpp_doTryCatch <- function(expr, env) {
.Internal(.addCondHands("error", list(.rcpp_error_recorder),
env, environment(), FALSE))
Modified: pkg/Rcpp/inst/include/Rcpp/cache.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/cache.h 2010-10-07 12:27:18 UTC (rev 2285)
+++ pkg/Rcpp/inst/include/Rcpp/cache.h 2010-10-07 12:40:23 UTC (rev 2286)
@@ -30,16 +30,4 @@
}
}
-extern "C" SEXP get_rcpp_cache() ;
-extern "C" SEXP init_Rcpp_cache() ;
-extern "C" void maybe_init() ;
-extern "C" SEXP reset_current_error() ;
-extern "C" SEXP rcpp_error_recorder(SEXP) ;
-extern "C" SEXP rcpp_set_current_error(SEXP) ;
-extern "C" SEXP rcpp_get_current_error() ;
-extern "C" SEXP rcpp_set_error_occured(SEXP) ;
-extern "C" SEXP rcpp_get_error_occured() ;
-extern "C" SEXP rcpp_set_stack_trace(SEXP) ;
-extern "C" SEXP rcpp_get_stack_trace() ;
-
#endif
Modified: pkg/Rcpp/inst/include/Rcpp/routines.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/routines.h 2010-10-07 12:27:18 UTC (rev 2285)
+++ pkg/Rcpp/inst/include/Rcpp/routines.h 2010-10-07 12:40:23 UTC (rev 2286)
@@ -53,6 +53,18 @@
CALLFUN_1(Module__name);
CALLFUN_2(CppObject__finalize);
+CALLFUN_0(get_rcpp_cache);
+CALLFUN_0(init_Rcpp_cache);
+CALLFUN_0(reset_current_error);
+CALLFUN_1(rcpp_error_recorder);
+CALLFUN_1(rcpp_set_current_error);
+CALLFUN_0(rcpp_get_current_error);
+CALLFUN_1(rcpp_set_error_occured);
+CALLFUN_0(rcpp_get_error_occured);
+CALLFUN_1(rcpp_set_stack_trace);
+CALLFUN_0(rcpp_get_stack_trace);
+
+
/* .External functions */
EXTFUN(CppMethod__invoke) ;
EXTFUN(InternalFunction_invoke) ;
Modified: pkg/Rcpp/src/Rcpp_init.c
===================================================================
--- pkg/Rcpp/src/Rcpp_init.c 2010-10-07 12:27:18 UTC (rev 2285)
+++ pkg/Rcpp/src/Rcpp_init.c 2010-10-07 12:40:23 UTC (rev 2286)
@@ -53,6 +53,17 @@
CALLDEF(Module__functions_arity,1),
CALLDEF(Module__name,1),
+ CALLDEF(get_rcpp_cache,0),
+ CALLDEF(init_Rcpp_cache,0),
+ CALLDEF(reset_current_error,0),
+ CALLDEF(rcpp_error_recorder,1),
+ CALLDEF(rcpp_set_current_error,1),
+ CALLDEF(rcpp_get_current_error,0),
+ CALLDEF(rcpp_set_error_occured,1),
+ CALLDEF(rcpp_get_error_occured,0),
+ CALLDEF(rcpp_set_stack_trace,1),
+ CALLDEF(rcpp_get_stack_trace,0),
+
{NULL, NULL, 0}
};
Modified: pkg/Rcpp/src/cache.cpp
===================================================================
--- pkg/Rcpp/src/cache.cpp 2010-10-07 12:27:18 UTC (rev 2285)
+++ pkg/Rcpp/src/cache.cpp 2010-10-07 12:40:23 UTC (rev 2286)
@@ -23,7 +23,11 @@
static SEXP Rcpp_cache = R_NilValue ;
static bool Rcpp_cache_ready = false ;
-
+
+void maybe_init() {
+ if( ! Rcpp_cache_ready ) init_Rcpp_cache() ;
+}
+
namespace Rcpp{
namespace internal{
SEXP get_Rcpp_namespace(){
@@ -36,9 +40,6 @@
// only used for debugging
SEXP get_rcpp_cache() { return Rcpp_cache ; }
-void maybe_init() {
- if( ! Rcpp_cache_ready ) init_Rcpp_cache() ;
-}
SEXP init_Rcpp_cache(){
Rcpp_cache = PROTECT( Rf_allocVector( VECSXP, 10 ) );
More information about the Rcpp-commits
mailing list