From 4527c77a6bfa0d65bf49f90547e7e32a0ae6364a Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Fri, 19 Aug 2016 23:21:40 +0200 Subject: [PATCH] Add strings as extradata in xml 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 Signed-off-by: Dirk Hohndel --- 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, "\n", + str.desc, str.value); + + } + // Parse the sample data. message ("Parsing the sample data.\n"); status = dc_parser_samples_foreach (parser, sample_cb, &sampledata);