Merge branch 'master' of git.a-lec.org:gem-graph/gem-graph-server

This commit is contained in:
Jean Sirmai 2021-10-23 16:29:55 +02:00
commit f1062f2c05
Signed by untrusted user who does not match committer: jean
GPG Key ID: FB3115C340E057E3
33 changed files with 128 additions and 157 deletions

37
AUTHORS
View File

@ -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 <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
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 : -

View File

@ -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)

2
debian/control vendored
View File

@ -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

2
debian/copyright vendored
View File

@ -2,7 +2,7 @@ This is a packacked upstream version of gem-graph-server
The sources may be found at <https://gitlab.os-k.eu/gem-graph-team/gem-graph-server>.
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

View File

@ -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);

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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(&parameters);

View File

@ -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;

View File

@ -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);

View File

@ -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) {

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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;
}

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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. //
// //

View File

@ -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);

View File

@ -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;