summaryrefslogtreecommitdiffstats
path: root/core/deco.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-05 23:23:10 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-08-08 16:26:31 -0700
commitddff68ddaec734449d83c6b056739c5474fb0b49 (patch)
tree7cdab0e27a875e86d5ddb8bec2fa51ced10eb6ad /core/deco.h
parent852239e6de541bfeb28b37ec1677a4d1637a7052 (diff)
downloadsubsurface-ddff68ddaec734449d83c6b056739c5474fb0b49.tar.gz
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 <bstoeger@mail.tuwien.ac.at> Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/deco.h')
-rw-r--r--core/deco.h11
1 files changed, 8 insertions, 3 deletions
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
}