Skip to content

Commit

Permalink
Changes to get closer to compiling binary
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Jul 11, 2024
1 parent f3de07d commit 587d2c2
Show file tree
Hide file tree
Showing 32 changed files with 651 additions and 742 deletions.
4 changes: 2 additions & 2 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ etTransEvidIsObs <- function(isObsSexp) {
#' @keywords internal
#'
#' @export
etTransParse <- function(inData, mv, addCmt = FALSE, dropUnits = FALSE, allTimeVar = FALSE, keepDosingOnly = FALSE, combineDvid = NULL, keep = character(0), addlKeepsCov = FALSE, addlDropSs = TRUE, ssAtDoseTime = TRUE) {
.Call(`_rxode2_etTransParse`, inData, mv, addCmt, dropUnits, allTimeVar, keepDosingOnly, combineDvid, keep, addlKeepsCov, addlDropSs, ssAtDoseTime)
etTrans <- function(inData, mv, addCmt = FALSE, dropUnits = FALSE, allTimeVar = FALSE, keepDosingOnly = FALSE, combineDvid = NULL, keep = character(0), addlKeepsCov = FALSE, addlDropSs = TRUE, ssAtDoseTime = TRUE) {
.Call(`_rxode2_etTrans`, inData, mv, addCmt, dropUnits, allTimeVar, keepDosingOnly, combineDvid, keep, addlKeepsCov, addlDropSs, ssAtDoseTime)
}

rxEtTransAsDataFrame_ <- function(inData1) {
Expand Down
19 changes: 2 additions & 17 deletions inst/include/rxode2.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,14 @@
#define rxLlikSaveSize 9

#include <stdbool.h>
#include <rxode2parse.h>
#include "rxode2parse.h"
#include <R.h>
#include <Rinternals.h>
#include <Rversion.h>
#include <Rmath.h>
#include <R_ext/Rdynload.h>

#define rc_buf_read _rxode2_rc_buf_read
#define sIniTo _rxode2_sIniTo
#define sFree _rxode2_sFree
#define sFreeIni _rxode2_sFreeIni
#define sAppendN _rxode2_sAppendN
#define sAppend _rxode2_sAppend
#define sPrint _rxode2_sPrint
#define lineIni _rxode2_lineIni
#define lineFree _rxode2_lineFree
#define addLine _rxode2_addLine
#define curLineProp _rxode2_curLineProp
#define curLineType _rxode2_curLineType
#define doDot _rxode2_doDot
#define doDot2 _rxode2_doDot2

#include <rxode2parseSbuf.h>
#include "rxode2parseSbuf.h"

#include <float.h>
#include <stdio.h>
Expand Down
97 changes: 1 addition & 96 deletions inst/include/rxode2_control.h
Original file line number Diff line number Diff line change
@@ -1,100 +1,5 @@
#pragma once
#ifndef __rxode2_control_H__
#define __rxode2_control_H__
#include <rxode2parse_control.h>
#define Rxc_scale 0
#define Rxc_method 1
#define Rxc_atol 2
#define Rxc_rtol 3
#define Rxc_maxsteps 4
#define Rxc_hmin 5
#define Rxc_hmax 6
#define Rxc_hini 7
#define Rxc_maxordn 8
#define Rxc_maxords 9
#define Rxc_covsInterpolation 10
#define Rxc_addCov 11
#define Rxc_returnType 12
#define Rxc_sigma 13
#define Rxc_sigmaDf 14
#define Rxc_nCoresRV 15
#define Rxc_sigmaIsChol 16
#define Rxc_sigmaSeparation 17
#define Rxc_sigmaXform 18
#define Rxc_nDisplayProgress 19
#define Rxc_amountUnits 20
#define Rxc_timeUnits 21
#define Rxc_addDosing 22
#define Rxc_stateTrim 23
#define Rxc_updateObject 24
#define Rxc_omega 25
#define Rxc_omegaDf 26
#define Rxc_omegaIsChol 27
#define Rxc_omegaSeparation 28
#define Rxc_omegaXform 29
#define Rxc_nSub 30
#define Rxc_thetaMat 31
#define Rxc_thetaDf 32
#define Rxc_thetaIsChol 33
#define Rxc_nStud 34
#define Rxc_dfSub 35
#define Rxc_dfObs 36
#define Rxc_seed 37
#define Rxc_nsim 38
#define Rxc_minSS 39
#define Rxc_maxSS 40
#define Rxc_strictSS 41
#define Rxc_infSSstep 42
#define Rxc_istateReset 43
#define Rxc_subsetNonmem 44
#define Rxc_hmaxSd 45
#define Rxc_maxAtolRtolFactor 46
#define Rxc_from 47
#define Rxc_to 48
#define Rxc_by 49
#define Rxc_length_out 50
#define Rxc_iCov 51
#define Rxc_keep 52
#define Rxc_keepF 53
#define Rxc_drop 54
#define Rxc_warnDrop 55
#define Rxc_omegaLower 56
#define Rxc_omegaUpper 57
#define Rxc_sigmaLower 58
#define Rxc_sigmaUpper 59
#define Rxc_thetaLower 60
#define Rxc_thetaUpper 61
#define Rxc_indLinPhiM 62
#define Rxc_indLinPhiTol 63
#define Rxc_indLinMatExpType 64
#define Rxc_indLinMatExpOrder 65
#define Rxc_idFactor 66
#define Rxc_mxhnil 67
#define Rxc_hmxi 68
#define Rxc_warnIdSort 69
#define Rxc_ssAtol 70
#define Rxc_ssRtol 71
#define Rxc_safeZero 72
#define Rxc_sumType 73
#define Rxc_prodType 74
#define Rxc_sensType 75
#define Rxc_linDiff 76
#define Rxc_linDiffCentral 77
#define Rxc_resample 78
#define Rxc_resampleID 79
#define Rxc_maxwhile 80
#define Rxc_cores 81
#define Rxc_atolSens 82
#define Rxc_rtolSens 83
#define Rxc_ssAtolSens 84
#define Rxc_ssRtolSens 85
#define Rxc_simVariability 86
#define Rxc_nLlikAlloc 87
#define Rxc_useStdPow 88
#define Rxc_naTimeHandle 89
#define Rxc_addlKeepsCov 90
#define Rxc_addlDropSs 91
#define Rxc_ssAtDoseTime 92
#define Rxc_ss2cancelAllPending 93
#define Rxc__zeros 94
#include "rxode2parse_control.h"
#endif // __rxode2_control_H__
34 changes: 1 addition & 33 deletions inst/include/rxode2parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,8 @@
#include <stdio.h>
#include <stdarg.h>

#include "rxode2parse_control.h"
#include "rxode2_control.h"
#include <stdint.h> // for uint64_t rather than unsigned long long

#ifdef _isrxode2parse_
#define max2( a , b ) ( (a) > (b) ? (a) : (b) )
#define isSameTime(xout, xp) (fabs((xout)-(xp)) <= DBL_EPSILON*max2(fabs(xout),fabs(xp)))
// use ~dop853 definition of same time
#define isSameTimeDop(xout, xp) (0.1 * fabs((xout)-(xp)) <= fabs(xout) * 2.3E-16)
#define _linCmtParse _rxode2parse_linCmtParse
#define _rxode2_linCmtGen _rxode2parse_linCmtGen
#define rc_buf_read _rxode2parse_rc_buf_read
#define sIniTo _rxode2parse_sIniTo
#define sFree _rxode2parse_sFree
#define sFreeIni _rxode2parse_sFreeIni
#define sAppendN _rxode2parse_sAppendN
#define sAppend _rxode2parse_sAppend
#define sPrint _rxode2parse_sPrint
#define lineIni _rxode2parse_lineIni
#define lineFree _rxode2parse_lineFree
#define addLine _rxode2parse_addLine
#define curLineProp _rxode2parse_curLineProp
#define curLineType _rxode2parse_curLineType
#define doDot _rxode2parse_doDot
#define doDot2 _rxode2parse_doDot2
#define _setSilentErr _rxode2parse__setSilentErr
#define _isRstudio2 _rxode2parse_isRstudio2
#define setSilentErr _rxode2parse_setSilentErr
#define setRstudioPrint _rxode2parse_setRstudioPrint
#define getSilentErr _rxode2parse_getSilentErr
#define getRstudioPrint _rxode2parse_getRstudioPrint
#define RSprintf _rxode2parse_RSprintf
#define parseFree _rxode2parse_parseFree
#define parseFreeLast _rxode2parse_parseFreeLast
#define reset _rxode2parse_reset
#endif
#include "rxode2parseStruct.h"
#endif
57 changes: 0 additions & 57 deletions inst/include/rxode2parseConvertMethod.h

This file was deleted.

1 change: 0 additions & 1 deletion inst/include/rxode2parseSbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ void addLine(vLines *sbb, const char *format, ...);
void curLineProp(vLines *sbb, int propId);

void curLineType(vLines *sbb, int propId);

void doDot(sbuf *out, char *buf);

void doDot2(sbuf *sb, sbuf *sbDt, char *buf);
Expand Down
8 changes: 4 additions & 4 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// etTransParse
List etTransParse(List inData, List mv, bool addCmt, bool dropUnits, bool allTimeVar, bool keepDosingOnly, Nullable<LogicalVector> combineDvid, CharacterVector keep, bool addlKeepsCov, bool addlDropSs, bool ssAtDoseTime);
RcppExport SEXP _rxode2_etTransParse(SEXP inDataSEXP, SEXP mvSEXP, SEXP addCmtSEXP, SEXP dropUnitsSEXP, SEXP allTimeVarSEXP, SEXP keepDosingOnlySEXP, SEXP combineDvidSEXP, SEXP keepSEXP, SEXP addlKeepsCovSEXP, SEXP addlDropSsSEXP, SEXP ssAtDoseTimeSEXP) {
// etTrans
List etTrans(List inData, List mv, bool addCmt, bool dropUnits, bool allTimeVar, bool keepDosingOnly, Nullable<LogicalVector> combineDvid, CharacterVector keep, bool addlKeepsCov, bool addlDropSs, bool ssAtDoseTime);
RcppExport SEXP _rxode2_etTrans(SEXP inDataSEXP, SEXP mvSEXP, SEXP addCmtSEXP, SEXP dropUnitsSEXP, SEXP allTimeVarSEXP, SEXP keepDosingOnlySEXP, SEXP combineDvidSEXP, SEXP keepSEXP, SEXP addlKeepsCovSEXP, SEXP addlDropSsSEXP, SEXP ssAtDoseTimeSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Expand All @@ -301,7 +301,7 @@ BEGIN_RCPP
Rcpp::traits::input_parameter< bool >::type addlKeepsCov(addlKeepsCovSEXP);
Rcpp::traits::input_parameter< bool >::type addlDropSs(addlDropSsSEXP);
Rcpp::traits::input_parameter< bool >::type ssAtDoseTime(ssAtDoseTimeSEXP);
rcpp_result_gen = Rcpp::wrap(etTransParse(inData, mv, addCmt, dropUnits, allTimeVar, keepDosingOnly, combineDvid, keep, addlKeepsCov, addlDropSs, ssAtDoseTime));
rcpp_result_gen = Rcpp::wrap(etTrans(inData, mv, addCmt, dropUnits, allTimeVar, keepDosingOnly, combineDvid, keep, addlKeepsCov, addlDropSs, ssAtDoseTime));
return rcpp_result_gen;
END_RCPP
}
Expand Down
4 changes: 2 additions & 2 deletions src/approx.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <stdio.h>
#include <stdarg.h>
#include "../inst/include/rxode2.h"
#include <rxode2parseHandleEvid.h>
#include <rxode2parseGetTime.h>
#include "../inst/include/rxode2parseHandleEvid.h"
#include "../inst/include/rxode2parseGetTime.h"

#define safe_zero(a) ((a) == 0 ? DBL_EPSILON : (a))
#define _as_zero(a) (fabs(a) < sqrt(DBL_EPSILON) ? 0.0 : a)
Expand Down
2 changes: 1 addition & 1 deletion src/cbindThetaOmega.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define STRICT_R_HEADERS
#include <Rcpp.h>
#include <R.h>
#include <rxode2parse.h>
#include "../inst/include/rxode2parse.h"


#ifdef ENABLE_NLS
Expand Down
2 changes: 1 addition & 1 deletion src/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ void writeSb(sbuf *sbb, FILE *fp){

extern SEXP _goodFuns;

SEXP _rxode2parse_codegen(SEXP c_file, SEXP prefix, SEXP libname,
SEXP _rxode2_codegen(SEXP c_file, SEXP prefix, SEXP libname,
SEXP pMd5, SEXP timeId, SEXP mvLast,
SEXP goodFuns){
_goodFuns = PROTECT(goodFuns); _rxode2parse_protected++;
Expand Down
5 changes: 3 additions & 2 deletions src/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define _(String) (String)
#endif
#include "../inst/include/rxode2parse.h"
#include "../inst/include/rxode2_control.h"
#include "tran.h"
#include "../inst/include/rxode2parseSbuf.h"

Expand Down Expand Up @@ -261,7 +262,7 @@ static inline void printCModelVars(const char *prefix) {
sAppend(&sbOut, "extern SEXP %smodel_vars(void){\n int pro=0;\n", prefix);
sAppend(&sbOut, " SEXP _mv = PROTECT(_rxGetModelLib(\"%smodel_vars\"));pro++;\n", prefix);
sAppendN(&sbOut, " if (!_rxIsCurrentC(_mv)){\n", 28);
sAppendN(&sbOut, " SEXP hash = PROTECT(allocVector(STRSXP, 1));pro++;\n", 58);
sAppendN(&sbOut, " SEXP hash = PROTECT(Rf_allocVector(STRSXP, 1));pro++;\n", 61);
sAppend(&sbOut, "#define __doBuf__ snprintf(buf, __doBufN__, \"", _mv.o+1);
int off=0;
int off2 = 0;
Expand Down Expand Up @@ -355,7 +356,7 @@ void writeSb(sbuf *sbb, FILE *fp);
CHAR(STRING_ELT(libname, 1))); \
writeSb(&sbOut, fpIO);

SEXP _rxode2parse_codegen(SEXP c_file, SEXP prefix, SEXP libname,
SEXP _rxode2_codegen(SEXP c_file, SEXP prefix, SEXP libname,
SEXP pMd5, SEXP timeId, SEXP mvLast, SEXP goodFuns);

extern int fullPrint;
Expand Down
Loading

0 comments on commit 587d2c2

Please sign in to comment.