Displaying 5 results from an estimated 5 matches for "r_newhashedenv".
2006 Nov 15
1
Feature request: put NewEnvironment and R_NewhashedEnv into API
Hi,
I would like to be able to create new environments from package C
code. AFAICT, this isn't allowed since both NewEnvironment and
R_NewHashedEnv are declared in Defn.R.
If exposing this isn't controvertial, I would submit a patch.
However, I'm not sure where the declarations should go (Rdefines.h?)
and whether they need to change to Rf_*.
+ seth
2010 Aug 29
1
Feature request: put NewEnvironment and R_NewhashedEnv into API
Hi,
as Seth Falcon in 2006, I also need to create new environments from package C code. Unfortunately, both NewEnvironment and R_NewHashedEnv are not yet part of the public API, if I understand correctly.
Is it planned to add at least one of these functions to the public API in the near future? May I submit a patch? Otherwise I would need to re-implement much of the functionality of R environments in my own code.
Many thanks and best...
2023 Feb 08
1
On optimizing `R_NewEnv()`
...1e53627e1f0c220bdc5f752/src/main/envir.c#L3619-L3630
I have a use case where I'm likely to call this function a large
number of times to generate many small hashed environments, so I'd
like to optimize it as far as possible.
I noticed that it takes `int size`, converts that to a SEXP for
`R_NewHashedEnv()`, which then simply converts that back to an `int`
here:
https://github.com/wch/r-source/blob/625ab8d45f86f65561e53627e1f0c220bdc5f752/src/main/envir.c#L378
I wonder if we could cut out that intermediate SEXP (along with its
protection) by adjusting `R_NewHashedEnv()` to instead take `int
size`....
2009 Oct 01
2
creating environments in package's C code
Dear developers,
is it possible to create environments in C code of packages?
Simply using
SEXP env;
PROTECT (env = allocSExp(ENVSXP));
and assigning the enclosing environment with SET_ENCLOS seems to be
insufficient.
Best wishes,
Martin
--
Dr. Martin Becker
Statistics and Econometrics
Saarland University
Campus C3 1, Room 206
66123 Saarbruecken
Germany
2014 Mar 05
1
[PATCH] Code coverage support proof of concept
...)
+{
+ SEXP sexp;
+
+ if (growth_rate < 1.1)
+ growth_rate = 1.1;
+
+ if (R_Code_Coverage) return;
+ R_Code_Coverage = 1;
+ if (R_Cov_freqs_hash != NULL)
+ R_ReleaseObject(R_Cov_freqs_hash);
+
+ /* put the params nb_lines and growth_rate as hidden vars of the hashed env */
+ R_Cov_freqs_hash = R_NewHashedEnv(R_NilValue, ScalarInteger(0));
+ PROTECT(sexp = ScalarInteger(nb_lines));
+ defineVar(install(".nb_lines"), sexp, R_Cov_freqs_hash);
+
+ PROTECT(sexp = ScalarReal(growth_rate));
+ defineVar(install(".growth_rate"), sexp, R_Cov_freqs_hash);
+
+ R_PreserveObject(R_Cov_freqs_hash);...