Skip to content

Commit

Permalink
Removed non-API calls to R: 'PRENV', 'PRVALUE', 'R_PromiseExpr'.
Browse files Browse the repository at this point in the history
  • Loading branch information
aviezerl committed Sep 29, 2024
1 parent e5f6bc7 commit 75ed0f6
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 28 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 2.6.26
Date: 2024-01-14 19:09:33 UTC
SHA: 2c56e06dccf3c5d22dbbd12e4dc746887ff0c28a
Version: 2.6.30
Date: 2024-09-27 08:34:48 UTC
SHA: f465f7137992d8df2e04d2dfa10365e421076390
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: naryn
Title: Native Access Medical Record Retriever for High Yield Analytics
Version: 2.6.29
Version: 2.6.30
Authors@R: c(
person("Misha", "Hoichman", , "[email protected]", role = "aut"),
person("Aviezer", "Lifshitz", , "[email protected]", role = c("aut", "cre")),
Expand Down Expand Up @@ -54,4 +54,4 @@ Language: en-US
LazyLoad: yes
NeedsCompilation: yes
OS_type: unix
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# naryn 2.6.30

* Removed non-API calls to R in the C++ code.

# naryn 2.6.29

* Fixed *noRemap* additional issue by adding `Rf_` prefix in the c++ code.

# naryn 2.6.28

* Fix: `emr_track.mv` did not move track attributes.
* "exists" virtual track function without parameters now checks for existance of any value.
* "exists" virtual track function without parameters now checks for existence of any value.

# naryn 2.6.27

Expand Down
1 change: 1 addition & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
0 errors | 0 warnings | 0 notes

* Fixed *noRemap* additional issue.
* Removed non-API calls to R: 'PRENV', 'PRVALUE', 'R_PromiseExpr'.
4 changes: 3 additions & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ MAXTIME
MINID
MINTIME
Makevars
Mendelson
NA's
NaN
PARAM
PKGDIR
POSIXct
Postmyocardial
Pre
Prefetch
Expand Down Expand Up @@ -68,6 +69,7 @@ mylist
naryndb
ndarray
ness
noRemap
numpy
param
params
Expand Down
6 changes: 3 additions & 3 deletions src/NRIdTimeInterval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ void NRIdTimeIntervals::convert_rid_time_intervals(SEXP rintervs, EMRIdTimeInter
intervs->clear();

if (TYPEOF(rintervs) == PROMSXP) {
if (PRENV(rintervs) == R_NilValue)
rintervs = PRVALUE(rintervs);
if (NARYN_PRENV(rintervs) == R_NilValue)
rintervs = NARYN_PRVALUE(rintervs);
else
rintervs = eval_in_R(R_PromiseExpr(rintervs), PRENV(rintervs));
rintervs = eval_in_R(NARYN_PREXPR(rintervs), NARYN_PRENV(rintervs));
}

if (!Rf_isVector(rintervs))
Expand Down
1 change: 1 addition & 0 deletions src/NRIdTimeInterval.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#undef error
#endif

#include "naryn.h"
#include "EMRIdTimeInterval.h"

using namespace std;
Expand Down
12 changes: 6 additions & 6 deletions src/NRPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ void NRPoint::convert_rpoints(SEXP rpoints, vector<EMRPoint> *points, const char
points->clear();

if (TYPEOF(rpoints) == PROMSXP) {
if (PRENV(rpoints) == R_NilValue)
rpoints = PRVALUE(rpoints);
if (NARYN_PRENV(rpoints) == R_NilValue)
rpoints = NARYN_PRVALUE(rpoints);
else
rpoints = eval_in_R(R_PromiseExpr(rpoints), PRENV(rpoints));
rpoints = eval_in_R(NARYN_PREXPR(rpoints), NARYN_PRENV(rpoints));
}

if (!Rf_isVector(rpoints))
Expand Down Expand Up @@ -193,10 +193,10 @@ void NRPoint::convert_rids(SEXP rids, vector<unsigned> *ids, const char *error_m
ids->clear();

if (TYPEOF(rids) == PROMSXP) {
if (PRENV(rids) == R_NilValue)
rids = PRVALUE(rids);
if (NARYN_PRENV(rids) == R_NilValue)
rids = NARYN_PRVALUE(rids);
else
rids = eval_in_R(R_PromiseExpr(rids), PRENV(rids));
rids = eval_in_R(NARYN_PREXPR(rids), NARYN_PRENV(rids));
}

if (!Rf_isVector(rids))
Expand Down
7 changes: 4 additions & 3 deletions src/NRPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "EMRPoint.h"
#include "EMRTrack.h"
#include "naryn.h"
#include <cstdint>

struct NRPoint {
Expand Down Expand Up @@ -33,10 +34,10 @@ template<class T>
void NRPoint::convert_rpoints_vals(SEXP rsrc, EMRTrackData<T> &data, const char *error_msg_prefix)
{
if (TYPEOF(rsrc) == PROMSXP) {
if (PRENV(rsrc) == R_NilValue)
rsrc = PRVALUE(rsrc);
if (NARYN_PRENV(rsrc) == R_NilValue)
rsrc = NARYN_PRVALUE(rsrc);
else
rsrc = eval_in_R(R_PromiseExpr(rsrc), PRENV(rsrc));
rsrc = eval_in_R(NARYN_PREXPR(rsrc), NARYN_PRENV(rsrc));
}

SEXP colnames = Rf_getAttrib(rsrc, R_NamesSymbol);
Expand Down
6 changes: 3 additions & 3 deletions src/NRTimeInterval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ void NRTimeIntervals::convert_rtime_intervals(SEXP rintervs, EMRTimeIntervals *i
intervs->clear();

if (TYPEOF(rintervs) == PROMSXP) {
if (PRENV(rintervs) == R_NilValue)
rintervs = PRVALUE(rintervs);
if (NARYN_PRENV(rintervs) == R_NilValue)
rintervs = NARYN_PRVALUE(rintervs);
else
rintervs = eval_in_R(R_PromiseExpr(rintervs), PRENV(rintervs));
rintervs = eval_in_R(NARYN_PREXPR(rintervs), NARYN_PRENV(rintervs));
}

if (!Rf_isVector(rintervs))
Expand Down
1 change: 1 addition & 0 deletions src/NRTimeInterval.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#undef error
#endif

#include "naryn.h"
#include "EMRTimeInterval.h"
#include "EMRTimeStamp.h"

Expand Down
6 changes: 3 additions & 3 deletions src/NRTrackExpressionVars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ void NRTrackExpressionVars::add_vtrack_var(const string &vtrack, SEXP rvtrack, b
static const char *COL_NAMES[NUM_COLS] = { "id1", "id2", "time.shift" };

if (TYPEOF(rid_map) == PROMSXP) {
if (PRENV(rid_map) == R_NilValue)
rid_map = PRVALUE(rid_map);
if (NARYN_PRENV(rid_map) == R_NilValue)
rid_map = NARYN_PRVALUE(rid_map);
else
rid_map = eval_in_R(R_PromiseExpr(rid_map), PRENV(rid_map));
rid_map = eval_in_R(NARYN_PREXPR(rid_map), NARYN_PRENV(rid_map));
}

if (!Rf_isVector(rid_map) || Rf_xlength(rid_map) < NUM_COLS - 1)
Expand Down
6 changes: 3 additions & 3 deletions src/NRVtrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ SEXP emr_check_vtrack_attr_id_map(SEXP _id_map, SEXP _envir) {
NRTrackExpressionVars::IdMap id_map;

if (TYPEOF(_id_map) == PROMSXP) {
if (PRENV(_id_map) == R_NilValue)
_id_map = PRVALUE(_id_map);
if (NARYN_PRENV(_id_map) == R_NilValue)
_id_map = NARYN_PRVALUE(_id_map);
else
_id_map = eval_in_R(R_PromiseExpr(_id_map), PRENV(_id_map));
_id_map = eval_in_R(NARYN_PREXPR(_id_map), NARYN_PRENV(_id_map));
}

if (!Rf_isVector(_id_map) || Rf_xlength(_id_map) < NUM_COLS - 1)
Expand Down
4 changes: 4 additions & 0 deletions src/naryn.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#define RNARYN
#endif

#define NARYN_PRENV(x) TAG(x)
#define NARYN_PRVALUE(x) CAR(x)
#define NARYN_PREXPR(x) R_BytecodeExpr(CDR(x))

using namespace std;

// should be used instead of R_CheckUserInterrupt. Throws exception if the command is interrupted.
Expand Down

0 comments on commit 75ed0f6

Please sign in to comment.