Commit graph

57 commits

Author SHA1 Message Date
Linus Torvalds
820cbe96da Parse key/value pairs in dive computer samples too
This gets us the stopdepth, cns, bearing etc information.  We're getting
really close to parsing everything, but are still missing event parsing,
and cylinder/weight data.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:38 -07:00
Linus Torvalds
7991e36c56 Parse basic dive computer sample data
This doesn't yet parse the (less common) "key=value" type sample data,
so it's not complete, but the framework for that is in place too.

With this, we now parse all the basics, and the most noticeable missing
part is the cylinder and weigthsystem data.  Lack of cylinder data in
particular means that SAC-rates etc don't get calculated, but other than
that it looks almost complete - you don't miss the missing event and
sample details unless you look for them.

I'll get the missing pieces done too, but this basic sample parsing was
visually a big step.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:35 -07:00
Linus Torvalds
5fcb36f5a8 Parse basic trip and dive data from the git blobs
Some things are still missing: samples and events, and cylinder and
weightsystem information.  But most of the basics are there (although
the lack of sample data makes a big visual impact)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:35 -07:00
Linus Torvalds
719656b438 Start actually parsing the git object data
This implements the simple line parser (including the multiline strings
with escape characters).  What a difference a good file format makes:
this is nothing like the pain that is XML.

That said, it only does the line/string parsing right now, it doesn't
actually then look at what the lines say.  So no human-noticeable
improvements in the actual data shown by subsurface.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:34 -07:00
Linus Torvalds
34fb8240da git repository reading: start reading the actual file contents
If we want to scale to thousands of dives, we'll eventually want to read
the dive computer files lazily when actually needed, but for now we do
everything synchronously.  Even if that may actually be slower than
parsing one big XML file.

The git object store is pretty efficient, but especially with some
history, the compression and delta application will certainly not be
free.

This does all the git object unpacking, but none of the actual data
parsing yet.  But as part of looking up the file objects, we do get the
dive number (which is in the name of the dive file).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:33 -07:00
Linus Torvalds
f0985644b6 git dive loading: actually insert the dives into the dive table
The biggest part of this commit is the comment about the woeful state of
the "git_tree_walk()" interface - the interface is not really very good
for seeing any recursive state, since it just walks the tree pretty much
linearly.

But the only real recursive state we care about is the trip, and in all
normal situations the "trip this dive is in" is the same thing as "what
was the last trip directory we traversed", so a linear walk works fine.

The one exception is if a dive isn't in a trip at all, in which case
"last trip directory" obviously isn't what we want.

But rather than do our own tree walking by hand (and just passing the
trip information in the natural recursive manner when traversing the
tree), we hack around it by just looking at the path to the dive.

That one-liner trivial hack has now generated about 20 lines of
explanation of it.

ANYWAY.  With this, we parse the dive and trip hierarchy properly, and
instead of just printing out the data, we might as well insert the dives
and trips into the subsurface data structures.

Note: the only data we have about the dive and trip right now is what is
visible in the directory structure, since we don't look at the actual
dive file at all (not even the name of it, which contains the dive
number).  So the end result will be just a sea of empty dives and the
trips they are contained in.  The dives have a date and time, and the
trip has a date, though.

So this is *not* useful for actually saving and loading data, but the
data we do load is easily visualized inside subsurface, so as I'm
starting to add real dive data parsing code, it will all be much more
visually satisfying.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:32 -07:00
Linus Torvalds
cc3a184adf Add initial parser for git trees
It doesn't actually parse the files themselves, but it does walk the
object tree and print out the dives and trips it finds.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-08 07:46:50 -08:00