forked from Honza0297/IMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathotherlib.h
More file actions
65 lines (51 loc) · 1.36 KB
/
otherlib.h
File metadata and controls
65 lines (51 loc) · 1.36 KB
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
57
58
59
60
61
62
63
64
65
/**
* @author Daniel Bubenicek (xbuben05)
* Projekt do predmetu IMS na FIT VUT v Brne (2019/2020)
* @date 5.12.2019
*/
#ifndef IMS_OTHERLIB_H
#define IMS_OTHERLIB_H
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include "modelib.h"
#include <stdio.h>
int err;
#define NUMBER_OF_INPUT_FLAGS 11 //number of tags in config file
#define FLAG_MAX_LEN 32 //maximum length of input tag in file
#define VALUE_MAX_LEN 32 //maximum length of input value in file
#define FILENAME_MAX_LEN 100
/**
* Returns name of conf file or null if the args are incorrect
* @param argc
* @param argv
* @return
*/
void parseArg(int argc, char **argv, char *filename);
/**
* parses, checks and sets all variables initialized by config file
* @param filename
*/
void parseConfiguration(char *filename);
/**
* Reads value from file position in file needs to be set to ':' prior first char of value
* @param fd
* @return -1 in case of error, number if it is ok
*/
long parseValue(FILE *fd);
/**
* Sets all variables initiated from config file
* @param values of variables in the right order
*/
void setVarNamesFromConfFile(const long *values);
enum errors{
errFileOpen = 1, errFileFormat, errSum100, errArgs
};
void messageAndExit();
/**
* Returns 10**power, works only for power >= 0!
* @param power
* @return
*/
long Mpow10(unsigned int power);
#endif //IMS_OTHERLIB_H