-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileHandler.h
57 lines (50 loc) · 1.54 KB
/
fileHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* File: FileHandler.h
* Author: Danni Friedland & Yaniv Dudu
*
* Created on April 12, 2010, 8:16 PM
*/
#ifndef _FILEHANDLER_H
#define _FILEHANDLER_H
#include "jobs.h"
#define LINE_LENGTH 1000
#define GET_NEXT_LINE(aLine,aFile) {\
boolean aFoundChar = false;\
while (!aFoundChar) {\
temp = fgets(aLine, LINE_LENGTH, aFile);\
char* p = aLine;\
while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n')\
p++;\
if (*p != 0)\
aFoundChar = true;\
};\
aFoundChar,p=NULL;\
}
#define GET_NEXT_CHAR(aChar,aLine) {\
boolean aFoundChar = false;\
while (!aFoundChar) {\
aChar = &aLine;\
while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n')\
aChar++;\
if (*aChar != 0)\
aFoundChar = true;\
};\
aFoundChar=NULL;\
}
/*
* Reads the input file,
* file name - file in current directory
* jobDeps - Returns the job dependency matrix
* Jobs - Creates an array of jobs in a not-started manner
* JobsForThreads - self explained
* ThreadCount - returns K from file
*/
op_status readFile(string file_name, JobsDeps* jobDeps, Jobs* jobs, JobsForThreads* jobsForThreads, int* ThreadCount,int* JobsCount);
//Reads the k=x and returns x, -1 otherwise.
int readThreadAmount(string line);
int readJobsAmount(string line);
//returns a list of dependencies for the jobID as a list of booleans
boolean* readJobsDeps(string line, tID jobID);
//reads the job and thread connection
ThreadJobs readThead(string line);
#endif /* _FILEHANDLER_H */