From 78279b3a18e1ebd3c7b520aea4a4da11bc6eedcf Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Wed, 6 Sep 2023 17:48:52 -0500 Subject: [PATCH] Fix struct for rxode2parse --- inst/include/rxode2parseStruct.h | 31 +++++++++++++++++++++++++++++++ src/comp.c | 29 +++++++---------------------- src/tran.h | 3 +++ src/utilcpp.cpp | 20 -------------------- 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/inst/include/rxode2parseStruct.h b/inst/include/rxode2parseStruct.h index de464cb7..ca98af0a 100644 --- a/inst/include/rxode2parseStruct.h +++ b/inst/include/rxode2parseStruct.h @@ -1,3 +1,10 @@ +#ifndef __RXODE2PARSESTRUCT_H__ +#define __RXODE2PARSESTRUCT_H__ + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct sbuf { char *s; /* curr print buffer */ int sN; @@ -415,3 +422,27 @@ typedef double (*t_getTime)(int idx, rx_solving_options_ind *ind); typedef int (*t_locateTimeIndex)(double obs_time, rx_solving_options_ind *ind); typedef int (*t_handle_evidL)(int evid, double *yp, double xout, rx_solving_options_ind *ind) ; typedef double (*t_getDur)(int l, rx_solving_options_ind *ind, int backward, unsigned int *p); + +#ifdef _isrxode2parse_ + + extern rx_solving_options _rxode2parse_op_global; + extern rx_solve _rxode2parse_rx_global; + extern t_handle_evidL _rxode2parse_handle_evidL; + extern t_getDur _rxode2parse_getDur; + extern t_getTime _rxode2parse_getTime; +#define op_global _rxode2parse_op_global +#define rx_global _rxode2parse_rx_global +#define AMT _rxode2parse_AMT +#define LAG _rxode2parse_LAG +#define RATE _rxode2parse_RATE +#define DUR _rxode2parse_DUR +#define calc_mtime _rxode2parse_calc_mtime +#define getTime _rxode2parse_getTime +#define _locateTimeIndex _rxode2parse_locateTimeIndex + +#endif + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/src/comp.c b/src/comp.c index 3af67bd8..20fe93ba 100644 --- a/src/comp.c +++ b/src/comp.c @@ -25,36 +25,21 @@ #define _(String) (String) #endif -#define op_global _rxode2parse_op_global -#define rx_global _rxode2parse_rx_global -#define AMT _rxode2parse_AMT -#define LAG _rxode2parse_LAG -#define RATE _rxode2parse_RATE -#define DUR _rxode2parse_DUR -#define calc_mtime _rxode2parse_calc_mtime -#define getTime_ _rxode2parse_getTime_ -#define getTime _rxode2parse_getTime -#define _locateTimeIndex _rxode2parse_locateTimeIndex -#define handle_evidL _rxode2parse_handle_evidL - -#include "../inst/include/rxode2parse.h" -#define _calcDerived _rxode2parse_calcDerived - -extern rx_solving_options _rxode2parse_op_global; -extern rx_solve _rxode2parse_rx_global; -extern t_handle_evidL _rxode2parse_handle_evidL; -extern t_getDur _rxode2parse_getDur; -#define _getDur _rxode2parse_getDur +#ifndef max2 +#define max2( a , b ) ( (a) > (b) ? (a) : (b) ) +#endif -#include "../inst/include/rxode2parseHandleEvid.h" -#include "../inst/include/rxode2parseGetTime.h" #include "../inst/include/rxode2parseHandleSs.h" + #ifndef max2 #define max2( a , b ) ( (a) > (b) ? (a) : (b) ) #endif + #include "solComp.h" #include "compSSc.h" #include "comp.h" + + void solveWith1Pt_lin(double *yp, double xout, double xp, int *i, diff --git a/src/tran.h b/src/tran.h index 7e2e2c37..206956c7 100644 --- a/src/tran.h +++ b/src/tran.h @@ -99,6 +99,8 @@ extern vLines centralLines; extern vLines sbPm, sbPmDt, sbNrmL; +#undef RATE +#undef DUR #define FBIO 1 #define ALAG 2 @@ -338,3 +340,4 @@ void _rxode2parse_unprotect(void); char *getLine (char *src, int line, int *lloc); #endif // __TRAN_H__ + diff --git a/src/utilcpp.cpp b/src/utilcpp.cpp index b9059cd0..0e627e9e 100644 --- a/src/utilcpp.cpp +++ b/src/utilcpp.cpp @@ -22,26 +22,6 @@ using namespace Rcpp; -extern "C" { -#define op_global _rxode2parse_op_global -#define rx_global _rxode2parse_rx_global -#define AMT _rxode2parse_AMT -#define LAG _rxode2parse_LAG -#define RATE _rxode2parse_RATE -#define DUR _rxode2parse_DUR -#define calc_mtime _rxode2parse_calc_mtime -#define getTime_ _rxode2parse_getTime_ -#define getTime _rxode2parse_getTime -#define _locateTimeIndex _rxode2parse_locateTimeIndex - - extern rx_solving_options _rxode2parse_op_global; - extern rx_solve _rxode2parse_rx_global; - extern t_handle_evidL _rxode2parse_handle_evidL; - extern t_getDur _rxode2parse_getDur; - extern t_getTime _rxode2parse_getTime; -#define _getDur _rxode2parse_getDur -} - #include "../inst/include/rxode2parseHandleEvid.h" #include "../inst/include/rxode2parseGetTime.h" #include "../inst/include/rxode2parseHandleSs.h"