From e910a2958fd74a077907e2da6f63eb444c711d86 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Sun, 19 Sep 2021 19:13:10 +0200 Subject: [PATCH] Arrows readable. Got a space soon --- debian/var/models/example_II.xml | 21 ++++----- include/base.h | 2 +- src/parsing.c | 80 +++++++++++++++++++++++++++++++- 3 files changed, 89 insertions(+), 14 deletions(-) diff --git a/debian/var/models/example_II.xml b/debian/var/models/example_II.xml index 14acf41..cda49de 100644 --- a/debian/var/models/example_II.xml +++ b/debian/var/models/example_II.xml @@ -24,13 +24,10 @@ - - + + - - - - + @@ -39,13 +36,13 @@ + + + - - - @@ -64,7 +61,7 @@ - + @@ -95,10 +92,10 @@ - + https://www.a-lec.org - + This is a quote. diff --git a/include/base.h b/include/base.h index 334fc89..ee2155a 100644 --- a/include/base.h +++ b/include/base.h @@ -166,7 +166,7 @@ struct Model_t { char *version; char *filename; // Parameters - int space_xMax; + int space_xMax; // TODO more than 3 dimension ? int space_yMax; int space_zMax; int nmaxThread; diff --git a/src/parsing.c b/src/parsing.c index 9d15443..353b82a 100644 --- a/src/parsing.c +++ b/src/parsing.c @@ -63,6 +63,84 @@ int parseStubFieldXML (xmlDocPtr doc, return 0; } +// -------------------------------------------------------------------------- // +// Parsing an arrow (but yeah that prints) // +// -------------------------------------------------------------------------- // +int parseArrowFieldXML (xmlDocPtr doc, + ModelParserTableXML_t *ModelTable, + int currentParser, + xmlNodePtr currentNode) +{ + xmlChar *x, *y, *z; + + x = xmlGetProp(currentNode, (xmlChar*)"x"); + y = xmlGetProp(currentNode, (xmlChar*)"x"); + z = xmlGetProp(currentNode, (xmlChar*)"x"); + + // Detect children + if (currentNode->xmlChildrenNode) { + printLog("%s (stub) has children\n", + ModelTable->table[currentParser].tag); + } + + printLog("%s: x:%s, y:%s, z:%s\n", ModelTable->table[currentParser].tag, + x, y, z); + + if (!x || !y || !z) { + xmlFree(x); + xmlFree(y); + xmlFree(z); + return -1; + } + + // TODO create arrow in model + + xmlFree(x); + xmlFree(y); + xmlFree(z); + + return 0; +} + +// -------------------------------------------------------------------------- // +// Parsing an arrow (but yeah that prints) // +// -------------------------------------------------------------------------- // +int parseSpaceSizeFieldXML (xmlDocPtr doc, + ModelParserTableXML_t *ModelTable, + int currentParser, + xmlNodePtr currentNode) +{ + xmlChar *x, *y, *z; + + x = xmlGetProp(currentNode, (xmlChar*)"x"); + y = xmlGetProp(currentNode, (xmlChar*)"x"); + z = xmlGetProp(currentNode, (xmlChar*)"x"); + + // Detect children + if (currentNode->xmlChildrenNode) { + printLog("%s (stub) has children\n", + ModelTable->table[currentParser].tag); + } + + printLog("%s: x:%s, y:%s, z:%s\n", ModelTable->table[currentParser].tag, + x, y, z); + + if (!x || !y || !z) { + xmlFree(x); + xmlFree(y); + xmlFree(z); + return -1; + } + + // TODO store space size and creates it + + xmlFree(x); + xmlFree(y); + xmlFree(z); + + return 0; +} + // -------------------------------------------------------------------------- // // Parsing a text field // // -------------------------------------------------------------------------- // @@ -267,7 +345,7 @@ int ParseModelXML(Model_t *model) {(const xmlChar *)"then", parseParentFieldXML, model}, // ARROW - {(const xmlChar *)"arrow", parseStubFieldXML, model}, + {(const xmlChar *)"arrow", parseArrowFieldXML, model}, // REF {(const xmlChar *)"ref", parseStubFieldXML, model},