diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-01 13:32:52 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-01 13:32:52 -0700 |
commit | 97419131248aacc96278ba7022b39af32359c26c (patch) | |
tree | 46372a7623b2130098dad9f01ef6e46f88a30f40 /dive.h | |
parent | 14d7601cdf8b5ba05c7889f6272fdad3fee03c80 (diff) | |
download | subsurface-97419131248aacc96278ba7022b39af32359c26c.tar.gz |
Start parsing gas mixes
The suunto xml is just completely crazy. What's the helium percentage
companion to "o2pct"? Would it be "hepct"? No. It's "hepct_0".
Ok, so they didn't number the first o2pct, which could be seen as sane:
that's the only mix value that should always exist. And they clearly
started their indexing with 0. So with multiple mixes, you'd then
expect "o2pct_1" and "hepct_1", right?
Wrong! Because XML people are crazy, the second O2 mix percentage is
obviously "o2pct_2". So the O2 percentages are one-based, with an
implicit one. But the He percentages are zero-based with an explicit
zero. So the second mix is "o2pct_2" and "hepct_1".
I'd like to ask what drugs Suunto people are on, but hey, it's a Finnish
company. No need to ask. Vodka explains everything. LOTS AND LOTS OF
VODKA.
In comparison, the libdivecomputer output is nice and sane, and uses a
'gasmix' node. Of course, now we have so many different XML nesting
nodes to check that I just made it an array of different noces. That
also allows me to mark the suunto case, so that we only do the "check
for crazy alcoholic xml entries" when it's a suunto file.
The "type of file" thing is probably a good idea for deciding on default
units too. Some day.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'dive.h')
-rw-r--r-- | dive.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -67,7 +67,7 @@ typedef struct { typedef struct { fraction_t o2; fraction_t n2; - fraction_t he2; + fraction_t he; } gasmix_t; typedef struct { @@ -100,6 +100,8 @@ struct sample { int tankindex; }; +#define MAX_MIXES (4) + struct dive { const char *name; time_t when; @@ -108,6 +110,7 @@ struct dive { depth_t visibility; temperature_t airtemp, watertemp; pressure_t beginning_pressure, end_pressure; + gasmix_t gasmix[MAX_MIXES]; int samples; struct sample sample[]; }; |