Merge branch 'master-amend' into 'master'
Mass renaming of symbols/functions See merge request gem-graph/gem-graph-server!1
This commit is contained in:
commit
d8f83d86c5
|
@ -140,7 +140,9 @@ static inline xmlNodePtr findWorkingRoot(const char *tagName,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur->xmlChildrenNode) {
|
if (cur->xmlChildrenNode) {
|
||||||
if ((recur = findRoot(tagName, cur->xmlChildrenNode)) != NULL)
|
if ((recur =
|
||||||
|
findWorkingRoot(tagName,
|
||||||
|
(xmlNodePtr)cur->xmlChildrenNode)) != NULL)
|
||||||
return recur;
|
return recur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +162,7 @@ static inline int XmlParseTree(ModelField_t *curTree)
|
||||||
int curValueLen;
|
int curValueLen;
|
||||||
|
|
||||||
while (curTree) {
|
while (curTree) {
|
||||||
if (findRoot(
|
if (findWorkingRoot(
|
||||||
curTree->tag,
|
curTree->tag,
|
||||||
currentDocumentRoot->parent
|
currentDocumentRoot->parent
|
||||||
) == NULL) {
|
) == NULL) {
|
||||||
|
@ -171,23 +173,24 @@ static inline int XmlParseTree(ModelField_t *curTree)
|
||||||
//printLog("Asked for %s\n", curTree->tag);
|
//printLog("Asked for %s\n", curTree->tag);
|
||||||
|
|
||||||
// Try to parse current tag
|
// Try to parse current tag
|
||||||
if (parseTag(curTree->tag, curTree->value, curTree->valueSize) != 0) {
|
if (XmlParseTag(curTree->tag, curTree->destination,
|
||||||
|
curTree->size) != 0) {
|
||||||
// There are values in that tag
|
// There are values in that tag
|
||||||
if (curTree->value[0])
|
if (curTree->destination[0])
|
||||||
if (!(curTree->value[0] == '\0')) {
|
if (!(curTree->destination[0] == '\0')) {
|
||||||
curValueLen = strlen(curTree->value);
|
curValueLen = strlen(curTree->destination);
|
||||||
|
|
||||||
// Delete \n chars
|
// Delete \n chars
|
||||||
for(int i = 0; i < curValueLen; i++) {
|
for(int i = 0; i < curValueLen; i++) {
|
||||||
if(curTree->value[i] == '\n') {
|
if(curTree->destination[i] == '\n') {
|
||||||
memmove(&curTree->value[i],
|
memmove(&curTree->destination[i],
|
||||||
&curTree->value[i+1],
|
&curTree->destination[i+1],
|
||||||
curValueLen - i);
|
curValueLen - i);
|
||||||
curValueLen--;
|
curValueLen--;
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printLog("Field %s: %s\n", curTree->tag, curTree->value);
|
printLog("Field %s: %s\n", curTree->tag, curTree->destination);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// There aren't values in that tag
|
// There aren't values in that tag
|
||||||
|
@ -199,7 +202,7 @@ static inline int XmlParseTree(ModelField_t *curTree)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curTree->son)
|
if (curTree->son)
|
||||||
currentOrSonCorrectlyParsed |= parseTree(curTree->son);
|
currentOrSonCorrectlyParsed |= XmlParseTree(curTree->son);
|
||||||
|
|
||||||
curTree = curTree->next;
|
curTree = curTree->next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,9 @@ void CliDecorateMonitor(int signum)
|
||||||
const char infosSchedulerText[] = "Scheduler id";
|
const char infosSchedulerText[] = "Scheduler id";
|
||||||
const char infosScThreadsText[] = "+ threads ";
|
const char infosScThreadsText[] = "+ threads ";
|
||||||
|
|
||||||
TermTermGetScreenSize(signum);
|
TermGetScreenSize(signum);
|
||||||
|
|
||||||
TermTermClearScreen();
|
TermClearScreen();
|
||||||
|
|
||||||
TermSetCursorLocation(1,1);
|
TermSetCursorLocation(1,1);
|
||||||
printf(C_COLOR_NORMAL C_COLOR_WHITE_ON_BLUE);
|
printf(C_COLOR_NORMAL C_COLOR_WHITE_ON_BLUE);
|
||||||
|
@ -261,7 +261,7 @@ void CliConnectedCommandLine(int sockfd)
|
||||||
);
|
);
|
||||||
|
|
||||||
TermRestoreCursorLocation();
|
TermRestoreCursorLocation();
|
||||||
moveCursorBackward();
|
TermMoveCursorBackward();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ void CliConnectedCommandLine(int sockfd)
|
||||||
|
|
||||||
case KEY_ARROW_LEFT:
|
case KEY_ARROW_LEFT:
|
||||||
if (curPosition > 0) {
|
if (curPosition > 0) {
|
||||||
moveCursorBackward();
|
TermMoveCursorBackward();
|
||||||
curPosition--;
|
curPosition--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
33
src/model.c
33
src/model.c
|
@ -175,7 +175,7 @@ int ModelStop(int id)
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void ModelCreate(Model_t **newModel) // TODO manage deletion and empty slots
|
void ModelAddToKnown(Model_t **newModel) // TODO manage deletion and empty slots
|
||||||
{
|
{
|
||||||
// increment index
|
// increment index
|
||||||
knownModelSize++;
|
knownModelSize++;
|
||||||
|
@ -272,7 +272,7 @@ void ModelSystemInit(Parameters_t *parameters)
|
||||||
if ((extensionPosition = strstr(modelDirEntry->d_name, ".xml"))) {
|
if ((extensionPosition = strstr(modelDirEntry->d_name, ".xml"))) {
|
||||||
|
|
||||||
// Creating model
|
// Creating model
|
||||||
ModelCreate(&newModel);
|
ModelAddToKnown(&newModel);
|
||||||
|
|
||||||
// Write file path in filename
|
// Write file path in filename
|
||||||
strncpy(newModel->filename, parameters->modelDir,
|
strncpy(newModel->filename, parameters->modelDir,
|
||||||
|
@ -326,15 +326,15 @@ void ModelSystemDestroy(void)
|
||||||
static inline void CreateField(ModelField_t *modelField,
|
static inline void CreateField(ModelField_t *modelField,
|
||||||
const char *tag,
|
const char *tag,
|
||||||
const bool mandatory,
|
const bool mandatory,
|
||||||
const char *value,
|
char *value,
|
||||||
const size_t valueSize,
|
size_t valueSize,
|
||||||
const ModelField_t *son,
|
ModelField_t *son,
|
||||||
const ModelField_t *next)
|
ModelField_t *next)
|
||||||
{
|
{
|
||||||
strncpy(modelField->tag, tag, 25);
|
strncpy(modelField->tag, tag, 25);
|
||||||
modelField->mandatory = mandatory;
|
modelField->mandatory = mandatory;
|
||||||
modelField->value = value;
|
modelField->destination = value;
|
||||||
modelField->valueSize = valueSize;
|
modelField->size = valueSize;
|
||||||
modelField->son = son;
|
modelField->son = son;
|
||||||
modelField->next = next;
|
modelField->next = next;
|
||||||
}
|
}
|
||||||
|
@ -371,30 +371,29 @@ static inline int ModelParseFile(Model_t *model)
|
||||||
"version", true, model->version, MAX_VERSION_SIZE, NULL, NULL);
|
"version", true, model->version, MAX_VERSION_SIZE, NULL, NULL);
|
||||||
|
|
||||||
CreateField(¶metersField,
|
CreateField(¶metersField,
|
||||||
"parameters", false, NULL, NULL, NULL, NULL);
|
"parameters", false, NULL, 0, NULL, NULL);
|
||||||
|
|
||||||
CreateField(¶metersModelizationField,
|
CreateField(¶metersModelizationField,
|
||||||
"modelization", false, NULL, NULL, NULL, NULL);
|
"modelization", false, NULL, 0, NULL, NULL);
|
||||||
|
|
||||||
CreateField(¶metersSpaceField,
|
CreateField(¶metersSpaceField,
|
||||||
"space", false, NULL, NULL, NULL, NULL);
|
"space", false, NULL, 0, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
// TODO modify model according to things in file
|
// TODO modify model according to things in file
|
||||||
|
|
||||||
printLog("Parsing model %s\n", model->name);
|
printLog("Parsing model %s\n", model->name);
|
||||||
openCurrentDocument(model->filename);
|
XmlSetNewDocument(model->filename);
|
||||||
|
|
||||||
resetDocumentRoot();
|
XmlResetWorkingRoot();
|
||||||
|
|
||||||
if (parseTree(&identityField) != 0) {
|
XmlCloseCurrentDocument();
|
||||||
|
|
||||||
|
if (XmlParseTree(&identityField) != 0) {
|
||||||
printLog("Invalid document, parsing can't succeed!\n");
|
printLog("Invalid document, parsing can't succeed!\n");
|
||||||
closeCurrentDocument();
|
|
||||||
return EBADF;
|
return EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
closeCurrentDocument();
|
|
||||||
|
|
||||||
// Interpret what needs to be
|
// Interpret what needs to be
|
||||||
model->date = strtol(date, NULL, 0);
|
model->date = strtol(date, NULL, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue