diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 3caedb3..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,37 +0,0 @@
-#=----------------------------------------------------------------------------=#
-# Project authors file #
-# #
-# Copyright © 2021 The Gem-graph Project #
-# #
-# This file is part of gem-graph. #
-# #
-# This program is free software: you can redistribute it and/or modify #
-# it under the terms of the GNU Affero General Public License as #
-# published by the Free Software Foundation, either version 3 of the #
-# License, or (at your option) any later version. #
-# #
-# This program is distributed in the hope that it will be useful, #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
-# GNU Affero General Public License for more details. #
-# #
-# You should have received a copy of the GNU Affero General Public License #
-# along with this program. If not, see . #
-#=----------------------------------------------------------------------------=#
-
-The gem-graph development team (named in the sources The Gem-graph Project) is
-composed of all core contributors of the project. Its representatives are the
-owners of the gem-graph project repository, and own the copyright in it.
-
- Founders and owner of the gem-graph project repository
-
- Jean Sirmai (jean)
- Adrien Bourmault (neox)
-
- Main contributors
-
- Jean Sirmai (jean)
- Adrien Bourmault (neox)
-
-
- Contact : -
diff --git a/Makefile b/Makefile
index 0a1f301..1d5cc68 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
#=----------------------------------------------------------------------------=#
# Makefile #
# #
-# Copyright © 2021 The Gem-graph Project #
+# Copyright © 2021 Libre en Communs (contact@a-lec.org) #
+# Copyright © 2021 Adrien Bourmault (neox@a-lec.org) #
# #
# This file is part of gem-graph. #
# #
@@ -136,5 +137,3 @@ run-cli: all
@bin/gem-graph-ctl
run-tests: tests
@bin/tests/scheduler
-
-include $(DEPS)
diff --git a/debian/control b/debian/control
index eef2923..8341870 100644
--- a/debian/control
+++ b/debian/control
@@ -6,5 +6,5 @@ Depends: libxml2
Architecture: amd64
Essential: no
Installed-Size: 112760
-Maintainer: The Gem-graph Project
+Maintainer: Libre en Communs (contact@a-lec.org)
Description: The wonderful gem-graph computation server
diff --git a/debian/copyright b/debian/copyright
index f73fe76..60bafbd 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,7 +2,7 @@ This is a packacked upstream version of gem-graph-server
The sources may be found at .
-Copyright © 2021 The Gem-graph Project
+Copyright © 2021 Libre en Communs (contact@a-lec.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
diff --git a/include/arrows.h b/include/arrows.h
index 8543726..ef887ff 100644
--- a/include/arrows.h
+++ b/include/arrows.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Local workers definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
@@ -50,3 +51,9 @@ static inline int ArrowsReleaseLock(ArrowArray_t *arrowArray)
{
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);
diff --git a/include/base.h b/include/base.h
index 14881e2..c348dcf 100644
--- a/include/base.h
+++ b/include/base.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// base definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/centers.h b/include/centers.h
index f1007e1..be2c188 100644
--- a/include/centers.h
+++ b/include/centers.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Local workers definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/cmds.h b/include/cmds.h
index 720c583..705f42b 100644
--- a/include/cmds.h
+++ b/include/cmds.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Server supported commands definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/model.h b/include/model.h
index 9e1666d..845b657 100644
--- a/include/model.h
+++ b/include/model.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Model definitions //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/parsing.h b/include/parsing.h
index 9952b9a..128a1f9 100644
--- a/include/parsing.h
+++ b/include/parsing.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// XML parsing module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/scheduler.h b/include/scheduler.h
index eeec788..83e1a95 100644
--- a/include/scheduler.h
+++ b/include/scheduler.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Scheduler definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/server.h b/include/server.h
index f03d624..203938d 100644
--- a/include/server.h
+++ b/include/server.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Server definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/supervisor.h b/include/supervisor.h
index 5932f1b..6605c87 100644
--- a/include/supervisor.h
+++ b/include/supervisor.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Supervisor definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/terminal.h b/include/terminal.h
index 1a5107e..436e6b1 100644
--- a/include/terminal.h
+++ b/include/terminal.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Terminal management tools //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/worker.h b/include/worker.h
index b00f18b..c80a144 100644
--- a/include/worker.h
+++ b/include/worker.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Local workers definition //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/include/xml.h b/include/xml.h
index d56d876..4809a57 100644
--- a/include/xml.h
+++ b/include/xml.h
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// XML management tools //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/arrows.c b/src/arrows.c
index b808069..7634932 100644
--- a/src/arrows.c
+++ b/src/arrows.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Arrows management module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/centers.c b/src/centers.c
index 0984b87..2eba517 100644
--- a/src/centers.c
+++ b/src/centers.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Centers management module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/cli.c b/src/cli.c
index 1631b3d..7b40808 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Command line interface main file //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/cmds.c b/src/cmds.c
index 9de3fd4..4940869 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Server management module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/main.c b/src/main.c
index a7e9667..42ded6c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Main //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
@@ -27,7 +28,7 @@
static Server_t *server;
-static void SigIntTermHandler(int signum)
+static void sigtermHandler(int signum)
{
server->pleaseStop = true;
printLog("Server stopping\n");
@@ -36,9 +37,6 @@ static void SigIntTermHandler(int signum)
printLog("All model shutted down\n");
}
-// TODO parse args to discover :
-// - config files directory
-// - models & users directories
int main(int argc, char **argv)
{
int options;
@@ -50,17 +48,17 @@ int main(int argc, char **argv)
switch (options) {
case 'C':
printLog("Config : %s\n", optarg);
- parameters.configDir = (char*) calloc(1, strlen(optarg) + 1);
+ parameters.configDir = calloc(1, strlen(optarg) + 1);
strcpy(parameters.configDir, optarg);
break;
case 'M':
printLog("Models : %s\n", optarg);
- parameters.modelDir = (char*) calloc(1, strlen(optarg) + 1);
+ parameters.modelDir = calloc(1, strlen(optarg) + 1);
strcpy(parameters.modelDir, optarg);
break;
case 'U':
printLog("Users : %s\n", optarg);
- parameters.userDir = (char*) calloc(1, strlen(optarg) + 1);
+ parameters.userDir = calloc(1, strlen(optarg) + 1);
strcpy(parameters.userDir, optarg);
break;
case ':':
@@ -111,14 +109,14 @@ int main(int argc, char **argv)
printLog("Starting gem-graph-server...\n");
// Register new interrupt handler
- signal(SIGINT, SigIntTermHandler);
- signal(SIGTERM, SigIntTermHandler);
+ signal(SIGINT, sigtermHandler);
+ signal(SIGTERM, sigtermHandler);
// Initializing random generator
t = time(&t);
srand((unsigned) t);
- server = (Server_t*) calloc(1, sizeof(Server_t));
+ server = calloc(1, sizeof(*server));
// Initializing model system
ModelSystemInit(¶meters);
diff --git a/src/model.c b/src/model.c
index a89af1a..db08dbd 100644
--- a/src/model.c
+++ b/src/model.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Model management module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
@@ -66,7 +67,8 @@ int ModelLoad(int id)
// Creating structure for the Scheduler
- knownModel[id-1]->scheduler = (Scheduler_t*) calloc(1, sizeof(Scheduler_t));
+ knownModel[id-1]->scheduler =
+ calloc(1, sizeof(*knownModel[id-1]->scheduler));
loadedModelSize++;
@@ -164,9 +166,9 @@ void ModelAddToKnown(Model_t **newModel)
knownModelSize++;
// create socket
knownModel =
- (Model_t**) realloc(knownModel, knownModelSize * sizeof(Model_t*));
+ (Model_t**) realloc(knownModel, knownModelSize * sizeof(*knownModel));
// populate socket
- knownModel[knownModelSize-1] = (Model_t*) calloc(1, sizeof(Model_t));
+ knownModel[knownModelSize-1] = calloc(1, sizeof(**knownModel));
// populate model
knownModel[knownModelSize-1]->id = knownModelSize;
// return value
@@ -176,16 +178,16 @@ void ModelAddToKnown(Model_t **newModel)
// continue. model population
knownModel[knownModelSize-1]->name =
- (char *) calloc(1, sizeof(char) * MODEL_STRING_SIZE);
+ calloc(1, sizeof(char) * MODEL_STRING_SIZE);
knownModel[knownModelSize-1]->filename =
- (char *) calloc(1, sizeof(char) * MODEL_STRING_SIZE);
+ calloc(1, sizeof(char) * MODEL_STRING_SIZE);
knownModel[knownModelSize-1]->owner =
- (char *) calloc(1, sizeof(char) * MODEL_STRING_SIZE);
+ calloc(1, sizeof(char) * MODEL_STRING_SIZE);
knownModel[knownModelSize-1]->version =
- (char *) calloc(1, sizeof(char) * MODEL_STRING_SIZE);
+ calloc(1, sizeof(char) * MODEL_STRING_SIZE);
knownModel[knownModelSize-1]->space_xMax = XMAX;
knownModel[knownModelSize-1]->space_yMax = YMAX;
@@ -232,9 +234,9 @@ void ModelSystemInit(Parameters_t *parameters)
Model_t *newModel;
char *extensionPosition;
- loadedModel = (Model_t**) calloc(1, sizeof(Model_t*));
+ loadedModel = calloc(1, sizeof(*loadedModel));
- knownModel = (Model_t**) calloc(1, sizeof(Model_t*));
+ knownModel = calloc(1, sizeof(*knownModel));
knownModelSize = 0;
loadedModelSize = 0;
diff --git a/src/parsing.c b/src/parsing.c
index f625df8..35839cb 100644
--- a/src/parsing.c
+++ b/src/parsing.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// XML parsing module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
@@ -20,6 +21,7 @@
//=-------------------------------------------------------------------------=//
#include "../include/parsing.h"
+#include "../include/arrows.h"
#include "../include/model.h"
// -------------------------------------------------------------------------- //
@@ -71,11 +73,14 @@ int parseArrowFieldXML (xmlDocPtr doc,
int currentParser,
xmlNodePtr currentNode)
{
- xmlChar *x, *y, *z;
+ Model_t *destination = ModelTable->table[currentParser].destination;
+ xmlChar *x, *y, *z, *siteId, *weight;
x = xmlGetProp(currentNode, (xmlChar*)"x");
y = xmlGetProp(currentNode, (xmlChar*)"y");
z = xmlGetProp(currentNode, (xmlChar*)"z");
+ siteId = xmlGetProp(currentNode, (xmlChar*)"siteId");
+ weight = xmlGetProp(currentNode, (xmlChar*)"weight");
// Detect children
if (currentNode->xmlChildrenNode) {
@@ -93,7 +98,18 @@ int parseArrowFieldXML (xmlDocPtr doc,
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(y);
@@ -102,9 +118,6 @@ int parseArrowFieldXML (xmlDocPtr doc,
return 0;
}
-// -------------------------------------------------------------------------- //
-// Parsing an arrow (but yeah that prints) //
-// -------------------------------------------------------------------------- //
int parseSpaceSizeFieldXML (xmlDocPtr doc,
ModelParserTableXML_t *ModelTable,
int currentParser,
@@ -339,7 +352,8 @@ int ParseModelIdentityXML(Model_t *model, Parameters_t *params)
{(const xmlChar *)"space_param", parseParentFieldXML, model},
{(const xmlChar *)"dimension", parseStubFieldXML, model},
{(const xmlChar *)"size", parseSpaceSizeFieldXML, model},
- {(const xmlChar *)"site_multiplicity", parseStubFieldXML, model},
+ {(const xmlChar *)"site_multiplicity", parseIntFieldXML,
+ &model->siteNumber},
// TODO lacking implementation (model side)
{(const xmlChar *)"boundaries", parseStubFieldXML, model},
@@ -352,7 +366,7 @@ int ParseModelIdentityXML(Model_t *model, Parameters_t *params)
};
// Allocating space for schema file path
- schemPath = (char*) calloc(1, strlen(params->modelDir)
+ schemPath = calloc(1, strlen(params->modelDir)
+ strlen("/schemas/model_ .xmls"));
printLog("Preparsing model %s\n", model->name);
diff --git a/src/scheduler.c b/src/scheduler.c
index 82a9268..00dddb4 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Scheduler module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
@@ -51,7 +52,7 @@ static Center_t *findWorkArea(Center_t *centersList, Arrow_t *electedArrow,
register Center_t *currentCenter, *newCenter;
currentCenter = centersList->next;
- newCenter = (Center_t*) malloc(sizeof(Center_t));
+ newCenter = malloc(sizeof(Center_t));
while (currentCenter){
if ( (xmax && (abs(electedArrow->x - currentCenter->x) <= ruleRadius))
@@ -100,9 +101,9 @@ static void *schedulerMain(void *scheduler)
printLog("%d threads available.\n", ncpu);
// Data structures
- workerArray = (Worker_t*) calloc(ncpu, sizeof(Worker_t));
+ workerArray = calloc(ncpu, sizeof(*workerArray));
nworker = 0;
- centersList = (Center_t*) calloc(1, sizeof(Center_t));
+ centersList = calloc(1, sizeof(*centersList));
// Initiate the arrowArray lock
if (err = ArrowsInitLock(args->arrowArray), err != 0) {
diff --git a/src/server.c b/src/server.c
index 4ee5352..ff738a8 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Server management module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/supervisor.c b/src/supervisor.c
index 9849f8b..03cf758 100644
--- a/src/supervisor.c
+++ b/src/supervisor.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Supervisor module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/tests/arrows.c b/src/tests/arrows.c
index 4756857..60c915a 100644
--- a/src/tests/arrows.c
+++ b/src/tests/arrows.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Arrows tests //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/tests/centers.c b/src/tests/centers.c
index 3796519..b11344b 100644
--- a/src/tests/centers.c
+++ b/src/tests/centers.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Centers tests //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
@@ -45,14 +46,14 @@ bool TestCenterRemove
Center_t *anyCenter = NULL;
// adding a something to a bad pointer
- centerRemove(anyCenter);
+ CenterRemove(anyCenter);
//printf("* Status of centers list after deleting NULL\n");
//printCenters(anyCenter);
assert(anyCenter == NULL);
- anyCenter = (Center_t*) calloc(1, sizeof(Center_t));
+ anyCenter = calloc(1, sizeof(*anyCenter));
//printf("* Initial status of centers list\n");
//printCenters(anyCenter);
@@ -62,25 +63,20 @@ bool TestCenterRemove
assert(anyCenter != NULL);
// Deleting a lonely pointer
- centerRemove(anyCenter);
+ CenterRemove(anyCenter);
//printf("* Status of centers list after deleting a lonely center\n");
//printCenters(anyCenter);
- anyCenter = (Center_t*) calloc(1, sizeof(Center_t));
- centerAdd(anyCenter, (Center_t*) calloc(1, sizeof(Center_t)));
- centerAdd(anyCenter, (Center_t*) calloc(1, sizeof(Center_t)));
- centerAdd(anyCenter, (Center_t*) calloc(1, sizeof(Center_t)));
- centerAdd(anyCenter, (Center_t*) calloc(1, sizeof(Center_t)));
- centerAdd(anyCenter, (Center_t*) calloc(1, sizeof(Center_t)));
+ anyCenter = calloc(1, sizeof(*anyCenter));
Center_t *oldfirst = anyCenter->next;
Center_t *oldsecond = anyCenter->next->next;
// Deleting a the first pointer
- centerRemove(anyCenter->next);
+ CenterRemove(anyCenter->next);
//printf("* Status of centers list after deleting the head center\n");
//printCenters(anyCenter);
@@ -95,14 +91,14 @@ bool TestCenterAdd(void)
Center_t *anyCenter = NULL;
// adding a something to a bad pointer
- centerAdd(anyCenter, NULL);
+ CenterAdd(anyCenter, NULL);
//printf("* Status of centers list after adding something to NULL\n");
//printCenters(anyCenter);
assert(anyCenter == NULL);
- anyCenter = (Center_t*) calloc(1, sizeof(Center_t));
+ anyCenter = calloc(1, sizeof(Center_t));
//printf("* Initial status of centers list\n");
//printCenters(anyCenter);
@@ -112,7 +108,7 @@ bool TestCenterAdd(void)
assert(anyCenter != NULL);
// adding a bad pointer
- centerAdd(anyCenter, NULL);
+ CenterAdd(anyCenter, NULL);
//printf("* Status of centers list after adding NULL\n");
//printCenters(anyCenter);
@@ -122,8 +118,8 @@ bool TestCenterAdd(void)
assert(anyCenter != NULL);
// adding a good pointer
- Center_t *goodpointer = (Center_t*) calloc(1, sizeof(Center_t));
- centerAdd(anyCenter, goodpointer);
+ Center_t *goodpointer = calloc(1, sizeof(Center_t));
+ CenterAdd(anyCenter, goodpointer);
//printf("* Status of centers list after adding a center\n");
//printCenters(anyCenter);
@@ -135,8 +131,8 @@ bool TestCenterAdd(void)
assert(goodpointer->next == NULL);
// adding another good pointer
- Center_t *newgoodpointer = (Center_t*) calloc(1, sizeof(Center_t));
- centerAdd(anyCenter, newgoodpointer);
+ Center_t *newgoodpointer = calloc(1, sizeof(Center_t));
+ CenterAdd(anyCenter, newgoodpointer);
//printf("* Status of centers list after adding another center\n");
//printCenters(anyCenter);
@@ -148,10 +144,10 @@ bool TestCenterAdd(void)
assert(newgoodpointer->next == goodpointer);
// adding another good pointer
- Center_t *strangepointer = (Center_t*) calloc(1, sizeof(Center_t));
+ Center_t *strangepointer = calloc(1, sizeof(Center_t));
strangepointer->next = (Center_t*)0xCAFEBABE;
strangepointer->prev = (Center_t*)0xCAFEBABE;
- centerAdd(anyCenter, strangepointer);
+ CenterAdd(anyCenter, strangepointer);
//printf("* Status of centers list after adding a strange center\n");
//printCenters(anyCenter);
@@ -169,13 +165,13 @@ bool TestCenterAdd(void)
int main(int argc, char **argv)
{
- printf("\n==== Testing centers.c/centerAdd() ====\n");
+ printf("\n==== Testing centers.c/CenterAdd() ====\n");
TestCenterAdd();
- printf("\n==== Testing centers.c/centerAdd() ==== : OK\n");
+ printf("\n==== Testing centers.c/CenterAdd() ==== : OK\n");
- printf("\n==== Testing centers.c/centerRemove() ====\n");
+ printf("\n==== Testing centers.c/CenterRemove() ====\n");
TestCenterRemove();
- printf("\n==== Testing centers.c/centerRemove() ==== : OK\n");
+ printf("\n==== Testing centers.c/CenterRemove() ==== : OK\n");
return 0;
}
diff --git a/src/tests/localworker.c b/src/tests/localworker.c
index 3b87380..a8d7d3a 100644
--- a/src/tests/localworker.c
+++ b/src/tests/localworker.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Local worker tests //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/tests/scheduler.c b/src/tests/scheduler.c
index 6764c2b..141b386 100644
--- a/src/tests/scheduler.c
+++ b/src/tests/scheduler.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Scheduler tests //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/tests/server.c b/src/tests/server.c
index 80f92af..76f36d3 100644
--- a/src/tests/server.c
+++ b/src/tests/server.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Server tests //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
diff --git a/src/tests/test_realloc.c b/src/tests/test_realloc.c
index 1ddeab6..6a28911 100644
--- a/src/tests/test_realloc.c
+++ b/src/tests/test_realloc.c
@@ -3,7 +3,7 @@
int main(void)
{
- int *a = (int*) malloc(7 * sizeof(int));
+ int *a = malloc(7 * sizeof(int));
printf("Salut! Tableau d'entiers à l'adresse %p\n", a);
diff --git a/src/worker.c b/src/worker.c
index a943360..19d9b5c 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -1,7 +1,8 @@
//=-------------------------------------------------------------------------=//
// Local worker module //
// //
-// Copyright © 2021 The Gem-graph Project //
+// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
+// Copyright © 2021 Adrien Bourmault (neox@a-lec.org) //
// //
// This file is part of gem-graph. //
// //
@@ -28,7 +29,7 @@ static void *WorkerMain(void *worker);
/* -------------------------------------------------------------------------- */
// -------------------------------------------------------------------------- //
-// Scheduler init function //
+// Worker init function //
// -------------------------------------------------------------------------- //
void WorkerInit(Worker_t *worker)
{
@@ -39,7 +40,7 @@ void WorkerInit(Worker_t *worker)
}
// -------------------------------------------------------------------------- //
-// Scheduler thread main function //
+// Worker thread main function //
// -------------------------------------------------------------------------- //
static void *WorkerMain(void *worker)
{
@@ -51,38 +52,7 @@ static void *WorkerMain(void *worker)
int size = args->globalDrawingSpace->size;
- /* In each cell: the West (left) site is 0, the East (right) site is 1 */
- for (int orig=0; orig < size; orig++){
- int nxt1 = (orig + 1) % size,
- nxt2 = (orig + 2) % size,
- prv1 = (orig - 1 + size) % size;
-
- if(
- args->globalDrawingSpace->space[orig].sites[1].nArrow == 1
- && args->globalDrawingSpace->space[nxt2].sites[0].nArrow == 0
-
- ) {
- args->globalDrawingSpace->space[orig].sites[1].nArrow = 0;
- args->globalDrawingSpace->space[nxt1].sites[0].nArrow = 0;
- args->globalDrawingSpace->space[nxt1].sites[1].nArrow = 1;
- args->globalDrawingSpace->space[nxt2].sites[0].nArrow = 1;
-
- /* TODO args->arrowArray->array[1].siteId = 0;*/
- }
-
- else if(
- args->globalDrawingSpace->space[orig].sites[1].nArrow == 1
- && args->globalDrawingSpace->space[prv1].sites[0].nArrow == 0
-
- ) {
- args->globalDrawingSpace->space[orig].sites[1].nArrow = 0;
- args->globalDrawingSpace->space[nxt1].sites[0].nArrow = 0;
- args->globalDrawingSpace->space[orig].sites[0].nArrow = 1;
- args->globalDrawingSpace->space[prv1].sites[1].nArrow = 1;
-
- /* TODO args->arrowArray->array[1].siteId = 0;*/
- }
- }
+ // TODO execute rule comparison
args->returnValue = a;
args->terminated = true;