From 0b0ecbff6bc702273b3fcdcde03aff400a35b2b8 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 28 Sep 2021 18:54:37 +0200 Subject: [PATCH] Parsing model continued --- src/parsing.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/parsing.c b/src/parsing.c index 73d4d8d..b288db0 100644 --- a/src/parsing.c +++ b/src/parsing.c @@ -111,10 +111,12 @@ int parseSpaceSizeFieldXML (xmlDocPtr doc, xmlNodePtr currentNode) { xmlChar *x, *y, *z; + Model_t *destination = + (Model_t*)ModelTable->table[currentParser].destination; x = xmlGetProp(currentNode, (xmlChar*)"x"); - y = xmlGetProp(currentNode, (xmlChar*)"x"); - z = xmlGetProp(currentNode, (xmlChar*)"x"); + y = xmlGetProp(currentNode, (xmlChar*)"y"); + z = xmlGetProp(currentNode, (xmlChar*)"z"); // Detect children if (currentNode->xmlChildrenNode) { @@ -132,7 +134,10 @@ int parseSpaceSizeFieldXML (xmlDocPtr doc, return -1; } - // TODO store space size and creates it + // Store space size + destination->space_xMax = atoi((const char*)x); + destination->space_yMax = atoi((const char*)y); + destination->space_zMax = atoi((const char*)z); xmlFree(x); xmlFree(y); @@ -317,7 +322,22 @@ int ParseModelIdentityXML(Model_t *model, Parameters_t *params) {(const xmlChar *)"owner_id", parseStubFieldXML, model->owner_id}, {(const xmlChar *)"date", parseIntFieldXML, &model->date}, - {(const xmlChar *)"version", parseTextFieldXML, model->version} + {(const xmlChar *)"version", parseTextFieldXML, model->version}, + + // PARAMETERS + {(const xmlChar *)"parameters", parseParentFieldPropsXML, model}, + // MODELIZATION + {(const xmlChar *)"modelization", parseParentFieldXML, model}, + {(const xmlChar *)"max_thread", parseStubFieldXML, model}, + {(const xmlChar *)"max_cycles", parseStubFieldXML, model}, + // SPACE + {(const xmlChar *)"space_param", parseParentFieldXML, model}, + {(const xmlChar *)"dimension", parseStubFieldXML, model}, + {(const xmlChar *)"size", parseSpaceSizeFieldXML, model}, + {(const xmlChar *)"site_multiplicity", parseStubFieldXML, model}, + + // TODO lacking implementation (model side) + {(const xmlChar *)"boundaries", parseStubFieldXML, model}, }; ModelParserTableXML_t identityParserTable = @@ -462,24 +482,9 @@ int ParseModelXML(Model_t *model) ParserTableXML_t table[] = { - // PARAMETERS - {(const xmlChar *)"parameters", parseParentFieldPropsXML, model}, - // MODELIZATION - {(const xmlChar *)"modelization", parseParentFieldXML, model}, - {(const xmlChar *)"max_thread", parseStubFieldXML, model}, - {(const xmlChar *)"max_cycles", parseStubFieldXML, model}, - // SPACE - {(const xmlChar *)"space_param", parseParentFieldXML, model}, - {(const xmlChar *)"dimension", parseDimensionFieldXML, model}, - {(const xmlChar *)"size", parseSizeFieldXML, model}, - {(const xmlChar *)"site_multiplicity", parseSiteMulFieldXML, model}, - - // TODO lacking implementation (model side) - {(const xmlChar *)"boundaries", parseStubFieldXML, model}, - // OBJECTS - {(const xmlChar *)"objects", parseParentFieldXML, model}, - {(const xmlChar *)"object", parseParentFieldPropsXML, model}, + // {(const xmlChar *)"objects", parseParentFieldXML, model}, + // {(const xmlChar *)"object", parseParentFieldPropsXML, model}, // SAVESTATES {(const xmlChar *)"savestates", parseParentFieldPropsXML, model},