Deleted useless stuff

This commit is contained in:
theolem 2019-12-08 17:08:55 +01:00
parent 94979c3799
commit acb56fbde2
12 changed files with 0 additions and 144 deletions

109
$
View File

@ -1,109 +0,0 @@
#include <stdio.h>
#include "master.h"
int MASTERID = 0;
int activeNodes[10]; //nodes active in the network. Assumes that all nodes have a unique id.
char *currentPrograms[100]; //current programs : array of char pointers, each is a program string.
void main()
{
initCurrentProgramsArray();
int newProgramIndex = manageUserInput();
printf("New program : %s \n", currentPrograms[newProgramIndex]);
/*
for(;;)
{
manageUserInput();
printf("Entrez le nom d'un programme : \n >> ") ;
scanf("%s", program );
printf(" %d ", sizeof(program));
addToCurrentPrograms(program);
//calls roundRobin to decide where it should be executed
//sends it over the network
//gets program return output and print
}*/
}
void initCurrentProgramsArray()
{
int i=0;
while(i<sizeof(currentPrograms)){
currentPrograms[i] = NULL;
i++;
}
}
// adds the program string to current program array, and returns the index where it was added.
int addToCurrentPrograms(char* newProgram){
int i=0;
while(i<sizeof(currentPrograms))
{
if(currentPrograms[i] == "-1"){
currentPrograms[i] = newProgram;
printf("Empty program at %d", i);
break;
}
i++;
}
return i ;
}
int commandSlaveNode(int programIndex)
{
return 1;
}
int roundRobin()
{
return 1;
}
void printProgramOutput(char programName[])
{
}
/*********************
* UTIL ARRAY FUNCTIONS
*********************/
int returnsSizeOfOccupiedArray(char array[]){
int i=0;
while(i<sizeof(array))
{
if(array[i]==NULL)
break;
i++;
}
return i;
}
// copies content of bigger array to smaller one, fitting everything it cans in the smaller array.
void copyToSmallerArray(char bigArray[], char smallArray[])
{
int i=0;
while(i<sizeof(smallArray))
{
smallArray[i]=bigArray[i];
i++;
}
}
int manageUserInput()
{
char program[50];
printf("Entrez un programme à exécuter : \n");
scanf("%s", program );
char smallarray[returnsSizeOfOccupiedArray(program)];
copyToSmallerArray(program, smallarray);
int index = addToCurrentPrograms(smallarray);
return index;
}

View File

@ -1,15 +0,0 @@
MASTERNAME = master
SLAVENAME = slave
SRC_DIR = src
BUILD_DIR = build
all : $(BUILD_DIR)/$(MASTERNAME) $(BUILD_DIR)/$(SLAVENAME)
$(BUILD_DIR)/$(MASTERNAME) : $(SRC_DIR)/$(MASTERNAME)
gcc -o $(BUILD_DIR)/$(MASTERNAME) $(SRC_DIR)/$(MASTERNAME).c
$(BUILD_DIR)/$(SLAVENAME) : $(SRC_DIR)/$(SLAVENAME)
gcc -o $(BUILD_DIR)/$(SLAVENAME) $(SRC_DIR)/$(SLAVENAME).c
clean :
rm $(BUILD_DIR)/*

View File

@ -1 +0,0 @@
# PILS_load_balancer

1
TODO
View File

@ -1 +0,0 @@
* read/write to file instead of program variables for current programs, etc => better for recovery

View File

@ -1,2 +0,0 @@
make
./build/master

Binary file not shown.

Binary file not shown.

14
cc
View File

@ -1,14 +0,0 @@
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello

View File

@ -1,2 +0,0 @@
gcc
libc6-dev

View File

0
hello
View File

0
max]
View File