Add unit-aware cylinder size string parserc

Whittling down on the string parsing that doesn't check user-specified
units.  Still need to handle temperatures (and will do percentages to
match the pattern too), but this is getting us closer to always honoring
user-specified units.

With this you can say that you have a "10l" cylinder at "3000psi", and
it will do the right thing (it's basically a 72 cuft cylinder in
imperial measurements).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2014-01-09 10:34:25 +08:00 committed by Dirk Hohndel
parent 9c06938adc
commit 4f982c1758
2 changed files with 41 additions and 22 deletions

1
dive.h
View file

@ -819,6 +819,7 @@ extern double strtod_flags(const char *str, const char **ptr, unsigned int flags
extern weight_t string_to_weight(const char *str);
extern depth_t string_to_depth(const char *str);
extern pressure_t string_to_pressure(const char *str);
extern volume_t string_to_volume(const char *str, pressure_t workp);
#include "pref.h"