aboutsummaryrefslogtreecommitdiffstats
path: root/core/units.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-06-04 09:05:17 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-06-19 13:11:10 -0700
commitbff80cf4625c4a97182e8333633403d06725a613 (patch)
tree0154f660c6e7db88ff79ad434f5a1df5bf6e076f /core/units.h
parent7f4d9db962e73aa5d5089c43c99b78b3690ffb87 (diff)
downloadsubsurface-bff80cf4625c4a97182e8333633403d06725a613.tar.gz
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>
Diffstat (limited to 'core/units.h')
-rw-r--r--core/units.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/units.h b/core/units.h
index 2307622e9..565b15d58 100644
--- a/core/units.h
+++ b/core/units.h
@@ -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