diff --git a/ChangeLog b/ChangeLog index a1eafbd49..5db0ca9d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2016-07-31 Qiang Kou + + * inst/examples/SugarPerformance/sugarBenchmarks.R: Remove usage of Rf_eval + * inst/include/Rcpp/Environment.h: Idem + * inst/include/Rcpp/Module.h: Idem + * inst/include/Rcpp/exceptions.h: Idem + * inst/include/Rcpp/proxy/FieldProxy.h: Idem + * inst/include/Rcpp/r_cast.h: Idem + * inst/unitTests/cpp/language.cpp: Idem + * src/barrier.cpp: Idem + 2016-07-24 Dirk Eddelbuettel * inst/unitTests/cpp/rmath.cpp: Added RNG unit tests for sugar variants diff --git a/inst/examples/SugarPerformance/sugarBenchmarks.R b/inst/examples/SugarPerformance/sugarBenchmarks.R index 177ce809b..ea0f35719 100755 --- a/inst/examples/SugarPerformance/sugarBenchmarks.R +++ b/inst/examples/SugarPerformance/sugarBenchmarks.R @@ -53,7 +53,7 @@ src <- sprintf( ' timer.Reset(); timer.Start(); for (unsigned int i=0; i call( Rf_lang2(internalSym, Rf_lang4(removeSym, Rf_mkString(name.c_str()), Storage::get__(), Rf_ScalarLogical( FALSE )) ) ); - Rf_eval( call, R_GlobalEnv ) ; + Rcpp_eval( call, R_GlobalEnv ) ; } } else{ throw no_such_binding(name) ; diff --git a/inst/include/Rcpp/Module.h b/inst/include/Rcpp/Module.h index 1c6de04aa..ad9dd05ce 100644 --- a/inst/include/Rcpp/Module.h +++ b/inst/include/Rcpp/Module.h @@ -454,7 +454,7 @@ static VARIABLE_IS_NOT_USED SEXP moduleSym = NULL; // this macro is called by code wanting to load a module -- see RInside's rinside_module_sample0.cpp #define LOAD_RCPP_MODULE(NAME) \ Shield __load_module_call__( Rf_lang2( GET_MODULE_SYM, _rcpp_module_boot_##NAME() ); \ - Rf_eval(__load_module_call__), R_GlobalEnv ); + Rcpp_eval(__load_module_call__), R_GlobalEnv ); #endif diff --git a/inst/include/Rcpp/exceptions.h b/inst/include/Rcpp/exceptions.h index d2007f544..107344af4 100644 --- a/inst/include/Rcpp/exceptions.h +++ b/inst/include/Rcpp/exceptions.h @@ -129,7 +129,7 @@ namespace Rcpp{ inline SEXP get_last_call(){ SEXP sys_calls_symbol = Rf_install( "sys.calls" ) ; Rcpp::Shield sys_calls_expr( Rf_lang1(sys_calls_symbol) ); - Rcpp::Shield calls( Rf_eval( sys_calls_expr, R_GlobalEnv ) ); + Rcpp::Shield calls( Rcpp_eval( sys_calls_expr, R_GlobalEnv ) ); SEXP res = calls ; while( !Rf_isNull(CDR(res)) ) res = CDR(res); return CAR(res) ; diff --git a/inst/include/Rcpp/proxy/FieldProxy.h b/inst/include/Rcpp/proxy/FieldProxy.h index dfb27fd19..552763cb0 100644 --- a/inst/include/Rcpp/proxy/FieldProxy.h +++ b/inst/include/Rcpp/proxy/FieldProxy.h @@ -42,12 +42,12 @@ class FieldProxyPolicy { SEXP get() const { Shield call( Rf_lang3( R_DollarSymbol, parent, Rf_mkString(field_name.c_str()) ) ) ; - return Rf_eval( call, R_GlobalEnv ) ; + return Rcpp_eval( call, R_GlobalEnv ) ; } void set(SEXP x ) { SEXP dollarGetsSym = Rf_install( "$<-"); Shield call( Rf_lang4( dollarGetsSym, parent, Rf_mkString(field_name.c_str()) , x ) ) ; - parent.set__( Rf_eval( call, R_GlobalEnv ) ); + parent.set__( Rcpp_eval( call, R_GlobalEnv ) ); } } ; @@ -67,7 +67,7 @@ class FieldProxyPolicy { SEXP get() const { Shield call( Rf_lang3( R_DollarSymbol, parent, Rf_mkString(field_name.c_str()) ) ) ; - return Rf_eval( call, R_GlobalEnv ) ; + return Rcpp_eval( call, R_GlobalEnv ) ; } } ; diff --git a/inst/include/Rcpp/r_cast.h b/inst/include/Rcpp/r_cast.h index a2e04ce37..496a4d996 100644 --- a/inst/include/Rcpp/r_cast.h +++ b/inst/include/Rcpp/r_cast.h @@ -95,7 +95,7 @@ namespace Rcpp{ // return Rf_coerceVector( x, STRSXP ); // coerceVector does not work for some reason Shield call( Rf_lang2( Rf_install( "as.character" ), x ) ) ; - Shield res( Rf_eval( call, R_GlobalEnv ) ) ; + Shield res( Rcpp_eval( call, R_GlobalEnv ) ) ; return res ; } case CHARSXP: diff --git a/inst/unitTests/cpp/language.cpp b/inst/unitTests/cpp/language.cpp index 6802d356f..c638f94c4 100644 --- a/inst/unitTests/cpp/language.cpp +++ b/inst/unitTests/cpp/language.cpp @@ -68,7 +68,7 @@ Language runit_lang_square_lv(){ SEXP runit_lang_fun( Function fun, IntegerVector x ){ Language call( fun ); call.push_back(x) ; - return Rf_eval( call, R_GlobalEnv ) ; + return Rcpp_eval( call, R_GlobalEnv ) ; } // [[Rcpp::export]] diff --git a/src/barrier.cpp b/src/barrier.cpp index c4a371fbd..0d65ee2a7 100644 --- a/src/barrier.cpp +++ b/src/barrier.cpp @@ -28,6 +28,8 @@ #include #include +namespace Rcpp { SEXP Rcpp_eval(SEXP, SEXP); } + // [[Rcpp::register]] SEXP get_string_elt(SEXP x, int i) { return STRING_ELT(x, i); @@ -95,7 +97,7 @@ SEXP get_rcpp_cache() { SEXP getNamespaceSym = Rf_install("getNamespace"); // cannot be gc()'ed once in symbol table Rcpp::Shield RcppString(Rf_mkString("Rcpp")); Rcpp::Shield call(Rf_lang2(getNamespaceSym, RcppString)); - Rcpp::Shield RCPP(Rf_eval(call, R_GlobalEnv)); + Rcpp::Shield RCPP(Rcpp_eval(call, R_GlobalEnv)); Rcpp_cache = Rf_findVarInFrame(RCPP, Rf_install(".rcpp_cache")); Rcpp_cache_know = true; @@ -137,7 +139,7 @@ SEXP init_Rcpp_cache() { SEXP getNamespaceSym = Rf_install("getNamespace"); // cannot be gc()'ed once in symbol table Rcpp::Shield RcppString(Rf_mkString("Rcpp")); Rcpp::Shield call(Rf_lang2(getNamespaceSym, RcppString)); - Rcpp::Shield RCPP(Rf_eval(call, R_GlobalEnv)); + Rcpp::Shield RCPP(Rcpp_eval(call, R_GlobalEnv)); Rcpp::Shield cache(Rf_allocVector(VECSXP, RCPP_CACHE_SIZE)); // the Rcpp namespace