aboutsummaryrefslogtreecommitdiffstats
path: root/dive.h
AgeCommit message (Collapse)Author
2011-09-01Add ability to 'save' divesGravatar Linus Torvalds
This just generates another xml file. Don't get me wrong: I still don't like xml, but this way we can save in the same format we load things from. Except the save-format is a *lot* cleaner than the abortion that is Suunto or libdivecomputer xml. Don't bother with some crazy xml library crap for saving. Just do it! Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01gasmix: stop tracking nitrogen percentagesGravatar Linus Torvalds
The only thing you can do with that thing is screw things up (like libdivecomputer did). There's no value in tracking the "filler" gas, since you can always just calculate it from the gases that actually matter. So just track Oxygen and Helium - and make sure they have sane values. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01Start parsing gas mixesGravatar Linus Torvalds
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>
2011-08-31Start cleaning up dive accessorsGravatar Linus Torvalds
I'm going to add a menu to import (and eventually export) dives, and so we'd like to be able to start out with no dives at all. Right now we croak if that happens - it's not like the code has been written with actual end users in mind. So start cleaning things up. First make the 'current_dive' macro work right even for invalid dives. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Split up profile frame generation into its own file.Gravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Generate a default name for a dive, if it doesn't have one alreadyGravatar Linus Torvalds
The name is a string containint date, time, depth and length. So it's useful even with nothing else going on. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Start moving some of the non-parsing stuff out of 'parse.c'Gravatar Linus Torvalds
Create a 'main.c' with the main routine and argument "parsing" etc. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Split up dive data structure declarations into 'dive.h'Gravatar Linus Torvalds
The dive parser should eventually be just a part of the program, not the whole thing. So start preparing for that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>