Deleted useless stuff
This commit is contained in:
parent
94979c3799
commit
acb56fbde2
109
$
109
$
@ -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;
|
|
||||||
}
|
|
15
Makefile
15
Makefile
@ -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)/*
|
|
1
TODO
1
TODO
@ -1 +0,0 @@
|
|||||||
* read/write to file instead of program variables for current programs, etc => better for recovery
|
|
BIN
build/master
BIN
build/master
Binary file not shown.
BIN
build/slave
BIN
build/slave
Binary file not shown.
14
cc
14
cc
@ -1,14 +0,0 @@
|
|||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
hello
|
|
@ -1,2 +0,0 @@
|
|||||||
gcc
|
|
||||||
libc6-dev
|
|
Loading…
Reference in New Issue
Block a user