Skip to content

Commit

Permalink
Merge pull request #22 from nlmixr2/work-around-api-warning-for-older-R
Browse files Browse the repository at this point in the history
Version that works with old version of R
  • Loading branch information
mattfidler authored Oct 22, 2024
2 parents e20190f + 2346113 commit f2d18a9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 28 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ dparser.*\.(zip|pdf)$
^_pkgdown\.yml$
^docs$
^pkgdown$
^revdep$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ inst/doc
/src/dparser/.*
*.so
docs
revdep/
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-12
Date: 2024-09-17 21:41:28 UTC
SHA: 02f72d4ec4bef5c2fb321730e07cfc1ae372231b
Version: 1.3.1-13
Date: 2024-10-22 18:41:22 UTC
SHA: dc90eb4f4927f916970d2e282e79f55e725e823d
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# dparser 1.3.1-13

- R version specific code for calling R within C to match version
specific requirements (#19)
- Changed `Makevars` header order, strict options so that `dparser`
will compile on older versions of R (#19, #20, #22)

# dparser 1.3.1-12

Expand Down
6 changes: 1 addition & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# dparser

- This fixes the `Strict` issues flagged by CRAN.

- This also adds a non-abi interface to dparser from C. This means
this can be updated without updating all of the
'rxode2'/'nlmixr2est' ecosystem in the future.
- This fix allows older version of `R` to compile
4 changes: 1 addition & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
PKG_CFLAGS = -DUSE_FREELISTS -DTRACK_PNODES -DSTRICT_R_HEADERS=1
SOURCES_C = parse.c scan.c dsymtab.c util.c mkdparse.c write_tables.c grammar.g.c gram.c lex.c lr.c version.c read_binary.c dparser.c mkdparser.c rdparse.c
OBJECTS = $(SOURCES_C:.c=.o)
PKG_CFLAGS = -DUSE_FREELISTS -DTRACK_PNODES
19 changes: 4 additions & 15 deletions src/rdparse.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "gramgram.h"
#include "d.h"
#include "mkdparse.h"
#include "dparse.h"
#define R_NO_REMAP
#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
#include <Rmath.h>
#include "gramgram.h"
#include "d.h"
#include "mkdparse.h"
#include "dparse.h"
extern int d_use_file_name;
extern char *d_file_name;
extern int d_use_r_headers;
Expand All @@ -27,12 +26,7 @@ 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 @@ -57,12 +51,7 @@ 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 f2d18a9

Please sign in to comment.