Make dive.h a bit slimmer. It's only a drop in the bucket - but at
least when modifying tag functions not the *whole* application is
rebuilt anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To extend the undo system to dive sites, the importers and downloaders
must not parse directly into the global dive site table. Instead,
pass a dive_site_table argument to parse into.
For now, always pass the global dive_site_table so that this commit
should not cause any functional change.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To allow parsing into arbitrary trip_tables, add the corresponding
parameter to the parsing functions and the parser state. Currently,
all callers pass the global trip_table so there should be no change
in functionality. These arguments will be replaced in subsequent commits.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Introduce a parser_state structure, which describes (most) of the
global parser state. Create such a structure in the entry routines
to the parser and pass it down to the individual functions. The
parser state is initialized and freed with the init_parser_state()
and free_parser_state() functions.
The main benefits are:
1) Isolation of parser state.
2) Keeping the global name space tidy.
3) Prevent memory leaks which could happen in truncated files by
freeing all the parser state after parse.
A somewhat controversial point might be that the individual
parsing functions are split in those that need parser-state and
those that don't. This means that there are now two versions of
the MATCH macro, viz. one for the former and one for the latter.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Suunto has updated SampleBlob to use 30 byte blobs. This adds support
for the increased size. Note that this only parses the same fields we
have parsed before. (Currently I have no idea what the increased size is
used for.)
Note also that I do not currently have data with the new format so I
only tested this still works with old data.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Same as default branch, but as 0x01 appears to be converted from DM4 to
DM5, let's just be explicit about it.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Currently the best guess of sampleBlob format. Unfortunately there seems
to be some version of DM that stores the temperature in different
location that I have not been able to figure out yet. Note that some
version of DM does not utilize sampleBlob but specific blobs for each
value (temperature, pressure, ...).
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>