From ddff68ddaec734449d83c6b056739c5474fb0b49 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 5 Aug 2019 23:23:10 +0200 Subject: Parser: remove global state The parser had global state in the form of a linear regression and the "plot_depth" variable. Collect that in the deco_state struct and pass it down the call-chain. Move out the code to update the regression data to not bother other callers of tissue_tolerance_calc(). Signed-off-by: Berthold Stoeger Signed-off-by: Robert C. Helling --- core/deco.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'core/deco.h') diff --git a/core/deco.h b/core/deco.h index 4bdc5840d..29a492c93 100644 --- a/core/deco.h +++ b/core/deco.h @@ -41,6 +41,10 @@ struct deco_state { double gf_low_pressure_this_dive; int deco_time; bool icd_warning; + int sum1; + long sumx, sumxx; + double sumy, sumxy; + int plot_depth; }; extern const double buehlmann_N2_t_halflife[]; @@ -63,9 +67,10 @@ extern void vpmb_start_gradient(struct deco_state *ds); extern void clear_vpmb_state(struct deco_state *ds); extern void add_segment(struct deco_state *ds, double pressure, struct gasmix gasmix, int period_in_seconds, int setpoint, enum divemode_t divemode, int sac); -extern double regressiona(); -extern double regressionb(); -extern void reset_regression(); +extern double regressiona(const struct deco_state *ds); +extern double regressionb(const struct deco_state *ds); +extern void reset_regression(struct deco_state *ds); +extern void update_regression(struct deco_state *ds, const struct dive *dive); #ifdef __cplusplus } -- cgit v1.2.3-70-g09d2