[Libdivecomputer PATCH] Add strings as extradata in xml
Anton Lundin
glance at acc.umu.se
Fri Aug 19 14:21:40 PDT 2016
This teaches the dctool about the subsurface special field strings, and
saves them in the xml output in a way which is compatible with
subsurface.
Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
examples/output_xml.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/examples/output_xml.c b/examples/output_xml.c
index 2baa329..45c95c2 100644
--- a/examples/output_xml.c
+++ b/examples/output_xml.c
@@ -393,6 +393,24 @@ dctool_xml_output_write (dctool_output_t *abstract, dc_parser_t *parser, const u
convert_pressure(atmospheric, output->units));
}
+ message ("Parsing strings.\n");
+ int idx;
+ for (idx = 0; idx < 100; idx++) {
+ dc_field_string_t str = { NULL };
+ status = dc_parser_get_field(parser, DC_FIELD_STRING, idx, &str);
+ if (status != DC_STATUS_SUCCESS && status != DC_STATUS_UNSUPPORTED) {
+ ERROR ("Error parsing strings");
+ goto cleanup;
+ }
+ if (status == DC_STATUS_UNSUPPORTED)
+ break;
+ if (!str.desc || !str.value)
+ break;
+ fprintf (output->ostream, "<extradata key='%s' value='%s' />\n",
+ str.desc, str.value);
+
+ }
+
// Parse the sample data.
message ("Parsing the sample data.\n");
status = dc_parser_samples_foreach (parser, sample_cb, &sampledata);
--
2.7.4
More information about the subsurface
mailing list