| 186 | } |
| 187 | |
| 188 | SEXP 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]] |
| 208 | SEXP reset_current_error() { // #nocov start |
no test coverage detected