File tree Expand file tree Collapse file tree 3 files changed +14
-19
lines changed
Expand file tree Collapse file tree 3 files changed +14
-19
lines changed Original file line number Diff line number Diff line change 1+ 2017-12-05 Kevin Ushey <
[email protected] >
2+
3+ * inst/include/Rcpp/Environment.h: Use public R APIs
4+ * inst/include/Rcpp/api/meat/Environment.h: Idem
5+
162017-12-04 Kevin Ushey <
[email protected] >
27
38 * inst/include/Rcpp/RObject.h: Protect temporary wrapped SEXPs
Original file line number Diff line number Diff line change 2323#ifndef Rcpp_Environment_h
2424#define Rcpp_Environment_h
2525
26- // From 'R/Defn.h'
27- // NOTE: can't include header directly as it checks for some C99 features
28- extern " C" SEXP R_NewHashedEnv (SEXP, SEXP);
29-
3026namespace Rcpp {
3127
3228 RCPP_API_CLASS (Environment_Impl),
@@ -406,21 +402,6 @@ namespace Rcpp{
406402
407403typedef Environment_Impl<PreserveStorage> Environment ;
408404
409- inline Environment new_env (int size = 29 ) {
410- Shield<SEXP> sizeSEXP (Rf_ScalarInteger (size));
411- return R_NewHashedEnv (R_EmptyEnv, sizeSEXP);
412- }
413-
414- inline Environment new_env (SEXP parent, int size = 29 ) {
415- Shield<SEXP> sizeSEXP (Rf_ScalarInteger (size));
416- Shield<SEXP> parentSEXP (parent);
417- if (!Rf_isEnvironment (parentSEXP)) {
418- stop (" parent is not an environment" );
419- }
420- return R_NewHashedEnv (parentSEXP, sizeSEXP);
421- }
422-
423-
424405} // namespace Rcpp
425406
426407#endif
Original file line number Diff line number Diff line change @@ -44,6 +44,15 @@ Environment_Impl<StoragePolicy>::Environment_Impl( int pos ){
4444 Storage::set__ (env) ;
4545}
4646
47+ inline Environment new_env (int size = 29 ) {
48+ Function newEnv (" new.env" , R_BaseNamespace);
49+ return newEnv (_[" size" ] = size, _[" parent" ] = R_EmptyEnv);
50+ }
51+
52+ inline Environment new_env (SEXP parent, int size = 29 ) {
53+ Function newEnv (" new.env" , R_BaseNamespace);
54+ return newEnv (_[" size" ] = size, _[" parent" ] = parent);
55+ }
4756
4857} // namespace Rcpp
4958
You can’t perform that action at this time.
0 commit comments