Skip to content

Commit

Permalink
Merge pull request #19 from nlmixr2/19-fix-r-4.3
Browse files Browse the repository at this point in the history
Old versions of R cannot compile dparser anymore
  • Loading branch information
mattfidler authored Sep 29, 2024
2 parents 02f72d4 + dc6c68e commit e20190f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.3.1-11
Date: 2023-12-07 16:23:34 UTC
SHA: a687b5c193525bb604191c63751e64c441e4decb
Version: 1.3.1-12
Date: 2024-09-17 21:41:28 UTC
SHA: 02f72d4ec4bef5c2fb321730e07cfc1ae372231b
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dparser
Title: Port of 'Dparser' Package
Version: 1.3.1-12
Version: 1.3.1-13
Authors@R: c(person("Matthew", "Fidler", email = "[email protected]", role = c("aut", "cre")),
person("John", "Plevyak", role = c("aut", "cph"), email = "[email protected]"))
Imports:
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# dparser 1.3.1-13

- R version specific code for calling R within C to match version
specific requirements (#19)

# dparser 1.3.1-12

- Changed language access to not use `SET_TYPEOF` (as required by CRAN)
Expand Down
10 changes: 10 additions & 0 deletions src/rdparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ void callparsefn(char *name, char *value, int pos, int depth, SEXP fn, SEXP env)
fn(name = name, value = value, pos = pos, depth = depth)
*/
SEXP s, t;
#if R_MAJOR > 4 || (R_MAJOR == 4 && R_MINOR >= 4)
t = s = PROTECT(LCONS(R_NilValue, Rf_allocList(4)));
#else
t = s = PROTECT(Rf_allocList(5));
SET_TYPEOF(s, LANGSXP);
#endif
SETCAR(t, fn); t = CDR(t);
// name = name
SETCAR(t, Rf_mkString(name));
Expand All @@ -52,7 +57,12 @@ int callskipchildrenfn(char *name, char *value, int pos, int depth, SEXP skip_fn
*/
SEXP s, t;
int ret;
#if R_MAJOR > 4 || (R_MAJOR == 4 && R_MINOR >= 4)
t = s = PROTECT(LCONS(R_NilValue, Rf_allocList(4)));
#else
t = s = PROTECT(Rf_allocList(5));
SET_TYPEOF(s, LANGSXP);
#endif
SETCAR(t, skip_fn); t = CDR(t);
// name = name
SETCAR(t, Rf_mkString(name));
Expand Down

0 comments on commit e20190f

Please sign in to comment.