MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / init_Rcpp_cache

Function init_Rcpp_cache

src/barrier.cpp:188–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188SEXP init_Rcpp_cache() {
189 SEXP getNamespaceSym = Rf_install("getNamespace"); // cannot be gc()'ed once in symbol table
190 Rcpp::Shield<SEXP> RcppString(Rf_mkString("Rcpp"));
191 Rcpp::Shield<SEXP> call(Rf_lang2(getNamespaceSym, RcppString));
192 Rcpp::Shield<SEXP> RCPP(Rf_eval(call, R_GlobalEnv));
193 Rcpp::Shield<SEXP> cache(Rf_allocVector(VECSXP, RCPP_CACHE_SIZE));
194
195 // the Rcpp namespace
196 SET_VECTOR_ELT(cache, 0, RCPP);
197 set_error_occured(cache, Rf_ScalarLogical(FALSE)); // error occured
198 set_current_error(cache, R_NilValue); // current error
199 SET_VECTOR_ELT(cache, 3, R_NilValue); // stack trace
200 Rcpp::Shield<SEXP> tmp(Rf_allocVector(INTSXP, RCPP_HASH_CACHE_INITIAL_SIZE));
201 SET_VECTOR_ELT(cache, RCPP_HASH_CACHE_INDEX, tmp);
202 Rf_defineVar(Rf_install(".rcpp_cache"), cache, RCPP);
203
204 return cache;
205}
206
207// [[Rcpp::register]]
208SEXP reset_current_error() { // #nocov start

Callers 1

R_init_RcppFunction · 0.85

Calls 2

set_error_occuredFunction · 0.85
set_current_errorFunction · 0.85

Tested by

no test coverage detected