From 130c602ecb680f3f44ac7b78b131cb29e21df3cd Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 14 Sep 2021 09:20:33 +0000 Subject: [PATCH] Mass renaming of symbols/functions --- include/xml.h | 25 ++++++++++++++----------- src/cli.c | 8 ++++---- src/model.c | 33 ++++++++++++++++----------------- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/include/xml.h b/include/xml.h index 0f58fed..3747f7e 100644 --- a/include/xml.h +++ b/include/xml.h @@ -140,7 +140,9 @@ static inline xmlNodePtr findWorkingRoot(const char *tagName, } if (cur->xmlChildrenNode) { - if ((recur = findRoot(tagName, cur->xmlChildrenNode)) != NULL) + if ((recur = + findWorkingRoot(tagName, + (xmlNodePtr)cur->xmlChildrenNode)) != NULL) return recur; } @@ -160,7 +162,7 @@ static inline int XmlParseTree(ModelField_t *curTree) int curValueLen; while (curTree) { - if (findRoot( + if (findWorkingRoot( curTree->tag, currentDocumentRoot->parent ) == NULL) { @@ -171,23 +173,24 @@ static inline int XmlParseTree(ModelField_t *curTree) //printLog("Asked for %s\n", curTree->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 - if (curTree->value[0]) - if (!(curTree->value[0] == '\0')) { - curValueLen = strlen(curTree->value); + if (curTree->destination[0]) + if (!(curTree->destination[0] == '\0')) { + curValueLen = strlen(curTree->destination); // Delete \n chars for(int i = 0; i < curValueLen; i++) { - if(curTree->value[i] == '\n') { - memmove(&curTree->value[i], - &curTree->value[i+1], + if(curTree->destination[i] == '\n') { + memmove(&curTree->destination[i], + &curTree->destination[i+1], curValueLen - i); curValueLen--; i--; } } - printLog("Field %s: %s\n", curTree->tag, curTree->value); + printLog("Field %s: %s\n", curTree->tag, curTree->destination); } } else { // There aren't values in that tag @@ -199,7 +202,7 @@ static inline int XmlParseTree(ModelField_t *curTree) } if (curTree->son) - currentOrSonCorrectlyParsed |= parseTree(curTree->son); + currentOrSonCorrectlyParsed |= XmlParseTree(curTree->son); curTree = curTree->next; } diff --git a/src/cli.c b/src/cli.c index 2147658..3927441 100644 --- a/src/cli.c +++ b/src/cli.c @@ -59,9 +59,9 @@ void CliDecorateMonitor(int signum) const char infosSchedulerText[] = "Scheduler id"; const char infosScThreadsText[] = "+ threads "; - TermTermGetScreenSize(signum); + TermGetScreenSize(signum); - TermTermClearScreen(); + TermClearScreen(); TermSetCursorLocation(1,1); printf(C_COLOR_NORMAL C_COLOR_WHITE_ON_BLUE); @@ -261,7 +261,7 @@ void CliConnectedCommandLine(int sockfd) ); TermRestoreCursorLocation(); - moveCursorBackward(); + TermMoveCursorBackward(); } break; @@ -314,7 +314,7 @@ void CliConnectedCommandLine(int sockfd) case KEY_ARROW_LEFT: if (curPosition > 0) { - moveCursorBackward(); + TermMoveCursorBackward(); curPosition--; } break; diff --git a/src/model.c b/src/model.c index 2049b76..90917d0 100644 --- a/src/model.c +++ b/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 knownModelSize++; @@ -272,7 +272,7 @@ void ModelSystemInit(Parameters_t *parameters) if ((extensionPosition = strstr(modelDirEntry->d_name, ".xml"))) { // Creating model - ModelCreate(&newModel); + ModelAddToKnown(&newModel); // Write file path in filename strncpy(newModel->filename, parameters->modelDir, @@ -326,15 +326,15 @@ void ModelSystemDestroy(void) static inline void CreateField(ModelField_t *modelField, const char *tag, const bool mandatory, - const char *value, - const size_t valueSize, - const ModelField_t *son, - const ModelField_t *next) + char *value, + size_t valueSize, + ModelField_t *son, + ModelField_t *next) { strncpy(modelField->tag, tag, 25); modelField->mandatory = mandatory; - modelField->value = value; - modelField->valueSize = valueSize; + modelField->destination = value; + modelField->size = valueSize; modelField->son = son; modelField->next = next; } @@ -371,30 +371,29 @@ static inline int ModelParseFile(Model_t *model) "version", true, model->version, MAX_VERSION_SIZE, NULL, NULL); CreateField(¶metersField, - "parameters", false, NULL, NULL, NULL, NULL); + "parameters", false, NULL, 0, NULL, NULL); CreateField(¶metersModelizationField, - "modelization", false, NULL, NULL, NULL, NULL); + "modelization", false, NULL, 0, NULL, NULL); CreateField(¶metersSpaceField, - "space", false, NULL, NULL, NULL, NULL); + "space", false, NULL, 0, NULL, NULL); // TODO modify model according to things in file 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"); - closeCurrentDocument(); return EBADF; } - closeCurrentDocument(); - // Interpret what needs to be model->date = strtol(date, NULL, 0);