Cleanup
This commit is contained in:
parent
0cc24b8a65
commit
6db8075c9b
|
@ -51,3 +51,9 @@ static inline int ArrowsReleaseLock(ArrowArray_t *arrowArray)
|
||||||
{
|
{
|
||||||
return pthread_spin_unlock(&arrowArray->lock);
|
return pthread_spin_unlock(&arrowArray->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Arrow_t *ArrowAdd(Scheduler_t *scheduler, int x, int y, int z, int siteId,
|
||||||
|
int weight);
|
||||||
|
|
||||||
|
bool ArrowRemove(Scheduler_t *scheduler, int x, int y, int z, int siteId,
|
||||||
|
int weight);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
//=-------------------------------------------------------------------------=//
|
//=-------------------------------------------------------------------------=//
|
||||||
|
|
||||||
#include "../include/parsing.h"
|
#include "../include/parsing.h"
|
||||||
|
#include "../include/arrows.h"
|
||||||
#include "../include/model.h"
|
#include "../include/model.h"
|
||||||
|
|
||||||
// -------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------- //
|
||||||
|
@ -72,11 +73,14 @@ int parseArrowFieldXML (xmlDocPtr doc,
|
||||||
int currentParser,
|
int currentParser,
|
||||||
xmlNodePtr currentNode)
|
xmlNodePtr currentNode)
|
||||||
{
|
{
|
||||||
xmlChar *x, *y, *z;
|
Model_t *destination = ModelTable->table[currentParser].destination;
|
||||||
|
xmlChar *x, *y, *z, *siteId, *weight;
|
||||||
|
|
||||||
x = xmlGetProp(currentNode, (xmlChar*)"x");
|
x = xmlGetProp(currentNode, (xmlChar*)"x");
|
||||||
y = xmlGetProp(currentNode, (xmlChar*)"y");
|
y = xmlGetProp(currentNode, (xmlChar*)"y");
|
||||||
z = xmlGetProp(currentNode, (xmlChar*)"z");
|
z = xmlGetProp(currentNode, (xmlChar*)"z");
|
||||||
|
siteId = xmlGetProp(currentNode, (xmlChar*)"siteId");
|
||||||
|
weight = xmlGetProp(currentNode, (xmlChar*)"weight");
|
||||||
|
|
||||||
// Detect children
|
// Detect children
|
||||||
if (currentNode->xmlChildrenNode) {
|
if (currentNode->xmlChildrenNode) {
|
||||||
|
@ -94,7 +98,18 @@ int parseArrowFieldXML (xmlDocPtr doc,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO create arrow in model
|
// Create arrow in model
|
||||||
|
if (destination->scheduler) {
|
||||||
|
ArrowAdd(destination->scheduler,
|
||||||
|
atoi((char*)x), atoi((char*)y), atoi((char*)z),
|
||||||
|
atoi((char*)siteId), atoi((char*)weight));
|
||||||
|
} else {
|
||||||
|
xmlFree(x);
|
||||||
|
xmlFree(y);
|
||||||
|
xmlFree(z);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
xmlFree(x);
|
xmlFree(x);
|
||||||
xmlFree(y);
|
xmlFree(y);
|
||||||
|
@ -103,9 +118,6 @@ int parseArrowFieldXML (xmlDocPtr doc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------- //
|
|
||||||
// Parsing an arrow (but yeah that prints) //
|
|
||||||
// -------------------------------------------------------------------------- //
|
|
||||||
int parseSpaceSizeFieldXML (xmlDocPtr doc,
|
int parseSpaceSizeFieldXML (xmlDocPtr doc,
|
||||||
ModelParserTableXML_t *ModelTable,
|
ModelParserTableXML_t *ModelTable,
|
||||||
int currentParser,
|
int currentParser,
|
||||||
|
@ -340,7 +352,8 @@ int ParseModelIdentityXML(Model_t *model, Parameters_t *params)
|
||||||
{(const xmlChar *)"space_param", parseParentFieldXML, model},
|
{(const xmlChar *)"space_param", parseParentFieldXML, model},
|
||||||
{(const xmlChar *)"dimension", parseStubFieldXML, model},
|
{(const xmlChar *)"dimension", parseStubFieldXML, model},
|
||||||
{(const xmlChar *)"size", parseSpaceSizeFieldXML, model},
|
{(const xmlChar *)"size", parseSpaceSizeFieldXML, model},
|
||||||
{(const xmlChar *)"site_multiplicity", parseStubFieldXML, model},
|
{(const xmlChar *)"site_multiplicity", parseIntFieldXML,
|
||||||
|
&model->siteNumber},
|
||||||
|
|
||||||
// TODO lacking implementation (model side)
|
// TODO lacking implementation (model side)
|
||||||
{(const xmlChar *)"boundaries", parseStubFieldXML, model},
|
{(const xmlChar *)"boundaries", parseStubFieldXML, model},
|
||||||
|
|
Loading…
Reference in New Issue