Parsing model continued

This commit is contained in:
Adrien Bourmault 2021-09-28 18:54:37 +02:00
parent da6c223e92
commit 0b0ecbff6b
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 26 additions and 21 deletions

View File

@ -111,10 +111,12 @@ int parseSpaceSizeFieldXML (xmlDocPtr doc,
xmlNodePtr currentNode) xmlNodePtr currentNode)
{ {
xmlChar *x, *y, *z; xmlChar *x, *y, *z;
Model_t *destination =
(Model_t*)ModelTable->table[currentParser].destination;
x = xmlGetProp(currentNode, (xmlChar*)"x"); x = xmlGetProp(currentNode, (xmlChar*)"x");
y = xmlGetProp(currentNode, (xmlChar*)"x"); y = xmlGetProp(currentNode, (xmlChar*)"y");
z = xmlGetProp(currentNode, (xmlChar*)"x"); z = xmlGetProp(currentNode, (xmlChar*)"z");
// Detect children // Detect children
if (currentNode->xmlChildrenNode) { if (currentNode->xmlChildrenNode) {
@ -132,7 +134,10 @@ int parseSpaceSizeFieldXML (xmlDocPtr doc,
return -1; 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(x);
xmlFree(y); xmlFree(y);
@ -317,7 +322,22 @@ int ParseModelIdentityXML(Model_t *model, Parameters_t *params)
{(const xmlChar *)"owner_id", parseStubFieldXML, model->owner_id}, {(const xmlChar *)"owner_id", parseStubFieldXML, model->owner_id},
{(const xmlChar *)"date", parseIntFieldXML, &model->date}, {(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 = ModelParserTableXML_t identityParserTable =
@ -462,24 +482,9 @@ int ParseModelXML(Model_t *model)
ParserTableXML_t table[] = 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 // OBJECTS
{(const xmlChar *)"objects", parseParentFieldXML, model}, // {(const xmlChar *)"objects", parseParentFieldXML, model},
{(const xmlChar *)"object", parseParentFieldPropsXML, model}, // {(const xmlChar *)"object", parseParentFieldPropsXML, model},
// SAVESTATES // SAVESTATES
{(const xmlChar *)"savestates", parseParentFieldPropsXML, model}, {(const xmlChar *)"savestates", parseParentFieldPropsXML, model},