Skip to content

Commit 003555a

Browse files
committed
Use pointer functions instead of binary linkage functions
1 parent 9ac9724 commit 003555a

File tree

15 files changed

+34
-151
lines changed

15 files changed

+34
-151
lines changed

R/zzz.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
.dparserLoad <- function() {
2+
.Call(`_nonmem2rx_iniDparserPtr`,
3+
dparser::.dparsePtr(),
4+
PACKAGE = "nonmem2rx")
5+
}
16
.onLoad <- function(libname, pkgname) {
7+
.dparserLoad()
28
.Call(`_nonmem2rx_r_parseIni`)
39
if (requireNamespace("nlme", quietly=TRUE)) {
410
rxode2::.s3register("nlme::getData", "nonmem2rx")
@@ -9,5 +15,6 @@
915
rxode2::.s3register("rxode2::rxUiGet", "simulationModelIwres")
1016
}
1117
.onAttach <- function(libname,pkgname){
18+
.dparserLoad()
1219
.Call(`_nonmem2rx_r_parseIni`)
1320
}

src/abbrec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>

src/abbrev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>

src/data.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>
@@ -164,7 +164,7 @@ void trans_data(const char* parse){
164164
// problems with R's garbage collection, so duplicate the string.
165165
gBuf = (char*)(parse);
166166
gBufFree=0;
167-
167+
168168
eBuf = gBuf;
169169
eBufLast = 0;
170170
errP = curP;

src/dparser3.h

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ SEXP _nonmem2rx_r_parseFree(void);
2828
SEXP _nonmem2rx_r_parseIni(void);
2929
SEXP _nonmem2rx_fixNonmemTies(SEXP idS, SEXP timeS, SEXP deltaS);
3030
SEXP _nonmem2rx_setRecord(SEXP rec);
31+
SEXP _nonmem2rx_iniDparserPtr(SEXP ptr);
3132
void R_init_nonmem2rx(DllInfo *info) {
3233
R_CallMethodDef callMethods[] = {
34+
{"_nonmem2rx_iniDparserPtr", (DL_FUNC) &_nonmem2rx_iniDparserPtr, 1},
3335
{"_nonmem2rx_fromNonmemToRxId_", (DL_FUNC) &_nonmem2rx_fromNonmemToRxId_, 2},
3436
{"_nonmem2rx_setRecord", (DL_FUNC) &_nonmem2rx_setRecord, 1},
3537
{"_nonmem2rx_fixNonmemTies", (DL_FUNC) &_nonmem2rx_fixNonmemTies, 3},

src/input.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>
@@ -68,7 +68,7 @@ void parseFree(int last) {
6868
typedef void (print_node_fn_t)(int depth, char *token_name, char *token_value, void *client_data);
6969

7070
void wprint_node_input(int depth, char *name, char *value, void *client_data) {
71-
71+
7272
}
7373

7474
extern char * rc_dup_str(const char *s, const char *e);
@@ -123,7 +123,7 @@ void trans_input(const char* parse){
123123
// problems with R's garbage collection, so duplicate the string.
124124
gBuf = (char*)(parse);
125125
gBufFree=0;
126-
126+
127127
eBuf = gBuf;
128128
eBufLast = 0;
129129
errP = curP;

src/lst.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>
@@ -160,7 +160,7 @@ void trans_lst(const char* parse){
160160
// problems with R's garbage collection, so duplicate the string.
161161
gBuf = (char*)(parse);
162162
gBufFree=0;
163-
163+
164164
eBuf = gBuf;
165165
eBufLast = 0;
166166
errP = curP;

src/mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>

src/model.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>

src/omega.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>
@@ -68,7 +68,7 @@ void parseFree(int last) {
6868
extern char * rc_dup_str(const char *s, const char *e);
6969
typedef void (print_node_fn_t)(int depth, char *token_name, char *token_value, void *client_data);
7070
void wprint_node_omega(int depth, char *token_name, char *token_value, void *client_data) {
71-
71+
7272
}
7373

7474
int nonmem2rx_unintFix = 0;
@@ -337,10 +337,10 @@ int omegaParseOmeg0(_arg_) {
337337
} else {
338338
if (fix[0] != 0) {
339339
if ((fix[0] == 'u' || fix[0] == 'U')){
340-
if (nonmem2rx_unintFix)
341-
nonmem2rx_omegaFixed = 1;
340+
if (nonmem2rx_unintFix)
341+
nonmem2rx_omegaFixed = 1;
342342
} else {
343-
nonmem2rx_omegaFixed = 1;
343+
nonmem2rx_omegaFixed = 1;
344344
}
345345
}
346346
addOmegaBlockItem(v);

src/records.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include <dparser.h>
9+
10+
#define iniDparserPtr _nonmem2rx_iniDparserPtr
11+
#include <dparserPtr.h>
12+
dparserPtrIni;
13+
1014
#include <R.h>
1115
#include <Rinternals.h>
1216
#include <R_ext/Rdynload.h>

src/sub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>
@@ -240,7 +240,7 @@ void trans_sub(const char* parse){
240240
// problems with R's garbage collection, so duplicate the string.
241241
gBuf = (char*)(parse);
242242
gBufFree=0;
243-
243+
244244
eBuf = gBuf;
245245
eBufLast = 0;
246246
errP = curP;

src/tab.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>

src/theta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//#include "ode.h"
77
#include <rxode2parseSbuf.h>
88
#include <errno.h>
9-
#include "dparser3.h"
9+
#include <dparserPtr.h>
1010
#include <R.h>
1111
#include <Rinternals.h>
1212
#include <R_ext/Rdynload.h>

0 commit comments

Comments
 (0)