From 727e760dc09421e48ddb868b63c050e40d49abed Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 9 Jun 2021 11:35:47 +0200 Subject: [PATCH] Switch to C --- .gitignore | 2 +- src/localthread.c | 0 src/main.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++ src/scheduler.c | 0 src/server.c | 0 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/localthread.c create mode 100644 src/main.c create mode 100644 src/scheduler.c create mode 100644 src/server.c diff --git a/.gitignore b/.gitignore index d346f76..53d923c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *.so *.o -*.c +*.deb bin/** diff --git a/src/localthread.c b/src/localthread.c new file mode 100644 index 0000000..e69de29 diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..0d09eed --- /dev/null +++ b/src/main.c @@ -0,0 +1,58 @@ +//=-------------------------------------------------------------------------=// +// Main // +// // +// 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 . // +//=-------------------------------------------------------------------------=// + +#include +#include +#include +#include "types.h" +#include "server.h" +#include "scheduler.h" + + +#define ARROW_NUMBER 150 +#define MAX_CYCLES 40000 +#define SPACE_SIZE 10000 +#define MAX_THREAD 0 + + +int main(int argc, char **argv) +{ + BoolArray_t *globalPreemptionSpace = NULL; + IntArray_t *globalDrawingSpace = NULL; + IntArray_t *arrowList = NULL; + IntArray_t *transitionTree = NULL; + + globalPreemptionSpace = (BoolArray_t*) malloc(sizeof(BoolArray_t)); + globalPreemptionSpace->space = (bool*) malloc(sizeof(bool)*SPACE_SIZE); + globalPreemptionSpace->size = SPACE_SIZE; + + globalDrawingSpace = (IntArray_t*) malloc(sizeof(IntArray_t)); + globalDrawingSpace->space = (int*) malloc(sizeof(int)*SPACE_SIZE); + globalDrawingSpace->size = SPACE_SIZE; + + arrowList = (IntArray_t*) malloc(sizeof(IntArray_t)); + arrowList->space = (int*) malloc(sizeof(int)*ARROW_NUMBER); + arrowList->size = ARROW_NUMBER; + + printf("globalPreemptionSpace: %p, size: %d\n", globalPreemptionSpace, globalDrawingSpace->size); + printf("globalDrawingSpace: %p, size: %d\n", globalDrawingSpace, globalDrawingSpace->size); + printf("arrowList: %p, size: %d\n", arrowList, arrowList->size); +} diff --git a/src/scheduler.c b/src/scheduler.c new file mode 100644 index 0000000..e69de29 diff --git a/src/server.c b/src/server.c new file mode 100644 index 0000000..e69de29