Cleanup: move unit-related functions to own translation unit

Create a units.c translation unit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-06-04 09:05:17 +02:00 committed by Dirk Hohndel
parent 7f4d9db962
commit bff80cf462
6 changed files with 191 additions and 186 deletions

View file

@ -319,15 +319,28 @@ struct units {
#define SI_UNITS \
{ \
.length = METERS, .volume = LITER, .pressure = BAR, .temperature = CELSIUS, .weight = KG, \
.vertical_speed_time = MINUTES, .duration_units = MIXED, .show_units_table = false \
.vertical_speed_time = MINUTES, .duration_units = MIXED, .show_units_table = false \
}
#define IMPERIAL_UNITS \
{ \
.length = FEET, .volume = CUFT, .pressure = PSI, .temperature = FAHRENHEIT, .weight = LBS, \
.vertical_speed_time = MINUTES, .duration_units = MIXED, .show_units_table = false \
.vertical_speed_time = MINUTES, .duration_units = MIXED, .show_units_table = false \
}
extern const struct units SI_units, IMPERIAL_units;
extern const struct units *get_units(void);
extern int get_pressure_units(int mb, const char **units);
extern double get_depth_units(int mm, int *frac, const char **units);
extern double get_volume_units(unsigned int ml, int *frac, const char **units);
extern double get_temp_units(unsigned int mk, const char **units);
extern double get_weight_units(unsigned int grams, int *frac, const char **units);
extern double get_vertical_speed_units(unsigned int mms, int *frac, const char **units);
extern depth_t units_to_depth(double depth);
extern int units_to_sac(double volume);
#ifdef __cplusplus
}
#endif