diff options
author | Robert C. Helling <helling@atdotde.de> | 2018-05-08 16:24:51 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-05-14 23:47:00 +0300 |
commit | 969dfee9ec088acb942e211cb90329d2b8c0751f (patch) | |
tree | 89571c94dde158e2027108ba3dde7c8468caf351 /core | |
parent | 0b836f12fc714f0dfee6303699c9510f4cdf3b17 (diff) | |
download | subsurface-969dfee9ec088acb942e211cb90329d2b8c0751f.tar.gz |
Rename enum dive_comp_type to divemode_t
...as the usuage is not anymore about a computer but
a momentary dive mode. Rename the end indicator as well.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/deco.c | 2 | ||||
-rw-r--r-- | core/dive.c | 6 | ||||
-rw-r--r-- | core/dive.h | 18 | ||||
-rw-r--r-- | core/divelist.c | 2 | ||||
-rw-r--r-- | core/load-git.c | 6 | ||||
-rw-r--r-- | core/parse-xml.c | 6 | ||||
-rw-r--r-- | core/planner.c | 18 | ||||
-rw-r--r-- | core/plannernotes.c | 2 | ||||
-rw-r--r-- | core/profile.c | 6 | ||||
-rw-r--r-- | core/save-xml.c | 2 | ||||
-rw-r--r-- | core/statistics.c | 2 |
11 files changed, 35 insertions, 35 deletions
diff --git a/core/deco.c b/core/deco.c index b8780557c..5daa45cca 100644 --- a/core/deco.c +++ b/core/deco.c @@ -478,7 +478,7 @@ void calc_crushing_pressure(struct deco_state *ds, double pressure) } /* add period_in_seconds at the given pressure and gas to the deco calculation */ -void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, enum dive_comp_type divemode, int sac) +void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, enum divemode_t divemode, int sac) { (void) sac; int ci; diff --git a/core/dive.c b/core/dive.c index 9ec95c141..255631ec3 100644 --- a/core/dive.c +++ b/core/dive.c @@ -245,7 +245,7 @@ void add_extra_data(struct divecomputer *dc, const char *key, const char *value) * saving the dive mode for each event. When the events occur AFTER 'time' seconds, the last stored divemode * is returned. This function is self-tracking, relying on setting the event pointer 'evp' so that, in each iteration * that calls this function, the search does not have to begin at the first event of the dive */ -enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum dive_comp_type *divemode) +enum divemode_t get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum divemode_t *divemode) { struct event *ev = *evp; if (*divemode == UNDEF_COMP_TYPE) { @@ -253,7 +253,7 @@ enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, stru ev = dc ? get_next_event(dc->events, "modechange") : NULL; } while (ev && ev->time.seconds < time) { - *divemode = (enum dive_comp_type) ev->value; + *divemode = (enum divemode_t) ev->value; ev = get_next_event(ev->next, "modechange"); } *evp = ev; @@ -2071,7 +2071,7 @@ int gasmix_distance(const struct gasmix *a, const struct gasmix *b) * divemode = the dive mode pertaining to this point in the dive profile. * This function called by: calculate_gas_information_new() in profile.c; add_segment() in deco.c. */ -extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum dive_comp_type divemode) +extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum divemode_t divemode) { if ((divemode != OC) && po2) { // This is a rebreather dive where pressures->o2 is defined if (po2 >= amb_pressure) { diff --git a/core/dive.h b/core/dive.h index 54935226d..9b1640f9c 100644 --- a/core/dive.h +++ b/core/dive.h @@ -27,7 +27,7 @@ extern "C" { extern int last_xml_version; -enum dive_comp_type {OC, CCR, PSCR, FREEDIVE, NUM_DC_TYPE, UNDEF_COMP_TYPE}; // Flags (Open-circuit and Closed-circuit-rebreather) for setting dive computer type +enum divemode_t {OC, CCR, PSCR, FREEDIVE, NUM_DIVEMODE, UNDEF_COMP_TYPE}; // Flags (Open-circuit and Closed-circuit-rebreather) for setting dive computer type enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NOT_USED, NUM_GAS_USE}; // The different uses for cylinders extern const char *cylinderuse_text[]; @@ -84,7 +84,7 @@ struct event { int flags, value; /* .. and this is our "extended" data for some event types */ union { - enum dive_comp_type divemode; // for divemode change events + enum divemode_t divemode; // for divemode change events /* * NOTE! The index may be -1, which means "unknown". In that * case, the get_cylinder_index() function will give the best @@ -132,7 +132,7 @@ struct gas_pressures { double o2, n2, he; }; -extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum dive_comp_type dctype); +extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum divemode_t dctype); extern void sanitize_gasmix(struct gasmix *mix); extern int gasmix_distance(const struct gasmix *a, const struct gasmix *b); @@ -259,7 +259,7 @@ struct divecomputer { depth_t maxdepth, meandepth; temperature_t airtemp, watertemp; pressure_t surface_pressure; - enum dive_comp_type divemode; // dive computer type: OC(default) or CCR + enum divemode_t divemode; // dive computer type: OC(default) or CCR uint8_t no_o2sensors; // rebreathers: number of O2 sensors used int salinity; // kg per 10000 l const char *model, *serial, *fw_version; @@ -362,9 +362,9 @@ struct dive_components { unsigned int weights : 1; }; -extern enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum dive_comp_type *divemode); +extern enum divemode_t get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum divemode_t *divemode); extern struct event *get_next_divemodechange(struct event **evd, bool update_pointer); -extern enum dive_comp_type get_divemode_at_time(struct divecomputer *dc, int dtime, struct event **ev_dmc); +extern enum divemode_t get_divemode_at_time(struct divecomputer *dc, int dtime, struct event **ev_dmc); /* picture list and methods related to dive picture handling */ struct picture { @@ -853,7 +853,7 @@ struct deco_state { bool icd_warning; }; -extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, enum dive_comp_type divemode, int sac); +extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, enum divemode_t divemode, int sac); extern void clear_deco(struct deco_state *ds, double surface_pressure); extern void dump_tissues(struct deco_state *ds); extern void set_gf(short gflow, short gfhigh); @@ -874,7 +874,7 @@ struct divedatapoint { int setpoint; bool entered; struct divedatapoint *next; - enum dive_comp_type divemode; + enum divemode_t divemode; }; struct diveplan { @@ -891,7 +891,7 @@ struct diveplan { int surface_interval; }; -struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum dive_comp_type divemode); +struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode); struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po2); #if DEBUG_PLAN void dump_plan(struct diveplan *diveplan); diff --git a/core/divelist.c b/core/divelist.c index acac8ec6b..d5dc37271 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -416,7 +416,7 @@ static void add_dive_to_deco(struct deco_state *ds, struct dive *dive) struct gasmix *gasmix = NULL; int i; struct event *ev = NULL, *evd = NULL; - enum dive_comp_type current_divemode = UNDEF_COMP_TYPE; + enum divemode_t current_divemode = UNDEF_COMP_TYPE; if (!dc) return; diff --git a/core/load-git.c b/core/load-git.c index 67a2dfa29..731045087 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -162,9 +162,9 @@ static duration_t get_duration(const char *line) return d; } -static enum dive_comp_type get_dctype(const char *line) +static enum divemode_t get_dctype(const char *line) { - for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) { + for (enum divemode_t i = 0; i < NUM_DIVEMODE; i++) { if (strcmp(line, divemode_text[i]) == 0) return i; } @@ -725,7 +725,7 @@ static void parse_dc_watertemp(char *line, struct membuffer *str, void *_dc) int get_divemode(const char *divemodestring) { - for (int i = 0; i < NUM_DC_TYPE; i++) { + for (int i = 0; i < NUM_DIVEMODE; i++) { if (!strcmp(divemodestring, divemode_text[i])) return i; } diff --git a/core/parse-xml.c b/core/parse-xml.c index fa7572ac9..c2b8b26c9 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -437,10 +437,10 @@ static void event_name(char *buffer, char *name) const char *libdc_divemode_text[] = { "oc", "cc", "pscr", "freedive", "gauge"}; /* Extract the dive computer type from the xml text buffer */ -static void get_dc_type(char *buffer, enum dive_comp_type *dct) +static void get_dc_type(char *buffer, enum divemode_t *dct) { if (trimspace(buffer)) { - for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) { + for (enum divemode_t i = 0; i < NUM_DIVEMODE; i++) { if (strcmp(buffer, divemode_text[i]) == 0) *dct = i; else if (strcmp(buffer, libdc_divemode_text[i]) == 0) @@ -459,7 +459,7 @@ static void event_divemode(char *buffer, int *value) if (size >= MAX_EVENT_NAME) size = MAX_EVENT_NAME - 1; buffer[size] = 0x0; - for (int i = 0; i < NUM_DC_TYPE; i++) { + for (int i = 0; i < NUM_DIVEMODE; i++) { if (!strcmp(buffer,divemode_text[i])) { *value = i; break; diff --git a/core/planner.c b/core/planner.c index c12a81998..f05fe119a 100644 --- a/core/planner.c +++ b/core/planner.c @@ -115,7 +115,7 @@ int get_gasidx(struct dive *dive, struct gasmix *mix) return find_best_gasmix_match(mix, dive->cylinder, 0); } -void interpolate_transition(struct deco_state *ds, struct dive *dive, duration_t t0, duration_t t1, depth_t d0, depth_t d1, const struct gasmix *gasmix, o2pressure_t po2, enum dive_comp_type divemode) +void interpolate_transition(struct deco_state *ds, struct dive *dive, duration_t t0, duration_t t1, depth_t d0, depth_t d1, const struct gasmix *gasmix, o2pressure_t po2, enum divemode_t divemode) { int32_t j; @@ -152,7 +152,7 @@ int tissue_at_end(struct deco_state *ds, struct dive *dive, struct deco_state ** psample = sample = dc->sample; struct event *evdm = NULL; - enum dive_comp_type divemode = UNDEF_COMP_TYPE; + enum divemode_t divemode = UNDEF_COMP_TYPE; for (i = 0; i < dc->samples; i++, sample++) { o2pressure_t setpoint; @@ -231,7 +231,7 @@ void fill_default_cylinder(cylinder_t *cyl) /* calculate the new end pressure of the cylinder, based on its current end pressure and the * latest segment. */ -static void update_cylinder_pressure(struct dive *d, int old_depth, int new_depth, int duration, int sac, cylinder_t *cyl, bool in_deco, enum dive_comp_type divemode) +static void update_cylinder_pressure(struct dive *d, int old_depth, int new_depth, int duration, int sac, cylinder_t *cyl, bool in_deco, enum divemode_t divemode) { volume_t gas_used; pressure_t delta_p; @@ -267,7 +267,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive, int lasttime = 0, last_manual_point = 0; depth_t lastdepth = {.mm = 0}; int lastcylid; - enum dive_comp_type type = dive->dc.divemode; + enum divemode_t type = dive->dc.divemode; if (!diveplan || !diveplan->dp) return; @@ -417,7 +417,7 @@ void add_to_end_of_diveplan(struct diveplan *diveplan, struct divedatapoint *dp) dp->time += lasttime; } -struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum dive_comp_type divemode) +struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode) { struct divedatapoint *dp = create_dp(duration, depth, cylinderid, po2); dp->entered = entered; @@ -553,7 +553,7 @@ int ascent_velocity(int depth, int avg_depth, int bottom_time) } } -void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom_time, bool safety_stop, enum dive_comp_type divemode) +void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom_time, bool safety_stop, enum divemode_t divemode) { while (depth > 0) { int deltad = ascent_velocity(depth, avg_depth, bottom_time) * TIMESTEP; @@ -569,7 +569,7 @@ void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom } // Determine whether ascending to the next stop will break the ceiling. Return true if the ascent is ok, false if it isn't. -bool trial_ascent(struct deco_state *ds, int wait_time, int trial_depth, int stoplevel, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, struct dive *dive, enum dive_comp_type divemode) +bool trial_ascent(struct deco_state *ds, int wait_time, int trial_depth, int stoplevel, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, struct dive *dive, enum divemode_t divemode) { bool clear_to_ascend = true; @@ -634,7 +634,7 @@ bool enough_gas(int current_cylinder) * So we always test at the upper bundary, not in the middle! */ -int wait_until(struct deco_state *ds, struct dive *dive, int clock, int min, int leap, int stepsize, int depth, int target_depth, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, enum dive_comp_type divemode) +int wait_until(struct deco_state *ds, struct dive *dive, int clock, int min, int leap, int stepsize, int depth, int target_depth, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, enum divemode_t divemode) { // When a deco stop exceeds two days, there is something wrong... if (min >= 48 * 3600) @@ -699,7 +699,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i int laststoptime = timestep; bool o2breaking = false; int decostopcounter = 0; - enum dive_comp_type divemode = dive->dc.divemode; + enum divemode_t divemode = dive->dc.divemode; set_gf(diveplan->gflow, diveplan->gfhigh); set_vpmb_conservatism(diveplan->vpmb_conservatism); diff --git a/core/plannernotes.c b/core/plannernotes.c index 9927ad26a..efd71b16c 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -537,7 +537,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d /* Print warnings for pO2 */ dp = diveplan->dp; bool o2warning_exist = false; - enum dive_comp_type current_divemode; + enum divemode_t current_divemode; double amb; struct event *evd = NULL; current_divemode = UNDEF_COMP_TYPE; diff --git a/core/profile.c b/core/profile.c index 229d7867a..401228600 100644 --- a/core/profile.c +++ b/core/profile.c @@ -907,7 +907,7 @@ static void setup_gas_sensor_pressure(struct dive *dive, struct divecomputer *dc #ifndef SUBSURFACE_MOBILE /* calculate DECO STOP / TTS / NDL */ -static void calculate_ndl_tts(struct deco_state *ds, struct dive *dive, struct plot_data *entry, struct gasmix *gasmix, double surface_pressure,enum dive_comp_type divemode) +static void calculate_ndl_tts(struct deco_state *ds, struct dive *dive, struct plot_data *entry, struct gasmix *gasmix, double surface_pressure,enum divemode_t divemode) { /* FIXME: This should be configurable */ /* ascent speed up to first deco stop */ @@ -1018,7 +1018,7 @@ void calculate_deco_information(struct deco_state *ds, struct deco_state *planne ds->first_ceiling_pressure.mbar = depth_to_mbar(first_ceiling, dive); struct gasmix *gasmix = NULL; struct event *ev = NULL, *evd = NULL; - enum dive_comp_type current_divemode = UNDEF_COMP_TYPE; + enum divemode_t current_divemode = UNDEF_COMP_TYPE; for (i = 1; i < pi->nr; i++) { struct plot_data *entry = pi->entry + i; @@ -1207,7 +1207,7 @@ static void calculate_gas_information_new(struct dive *dive, struct divecomputer double amb_pressure; struct gasmix *gasmix = NULL; struct event *evg = NULL, *evd = NULL; - enum dive_comp_type current_divemode = UNDEF_COMP_TYPE; + enum divemode_t current_divemode = UNDEF_COMP_TYPE; for (i = 1; i < pi->nr; i++) { int fn2, fhe; diff --git a/core/save-xml.c b/core/save-xml.c index 90587163d..9eece665e 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -402,7 +402,7 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer if (dc->duration.seconds && dc->duration.seconds != dive->dc.duration.seconds) put_duration(b, dc->duration, " duration='", " min'"); if (dc->divemode != OC) { - for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) + for (enum divemode_t i = 0; i < NUM_DIVEMODE; i++) if (dc->divemode == i) show_utf8(b, divemode_text[i], " dctype='", "'", 1); if (dc->no_o2sensors) diff --git a/core/statistics.c b/core/statistics.c index 9dd495b51..d8ddf914c 100644 --- a/core/statistics.c +++ b/core/statistics.c @@ -123,7 +123,7 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive) free(stats_by_type); size = sizeof(stats_t) * (dive_table.nr + 1); - tsize = sizeof(stats_t) * (NUM_DC_TYPE + 1); + tsize = sizeof(stats_t) * (NUM_DIVEMODE + 1); stats_yearly = malloc(size); stats_monthly = malloc(size); stats_by_trip = malloc(size); |