-
Notifications
You must be signed in to change notification settings - Fork 0
/
assembler.c
47 lines (36 loc) · 901 Bytes
/
assembler.c
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
/*
Author: Aviv Dolev, ID 201534070
Course: 20465 2018b
MMN 14
*/
/*__________________ Assembler exectuable __________________*/
#include "header.h"
int main(int argc, char *argv[]) {
/*Check command line argument, if absent prompt message and exit.*/
if (!--argc) {
printf(PROMPT);
return OK;
}
/*Main loop over command line arguments*/
while (argc--) {
Control ctrl = CONTROL_INIT;
Control *ctrlp = &ctrl;
/*Get next source file*/
get_next_file(ctrlp, *++argv);
/*Start proccessing source file*/
if (is_empty_list(&ctrlp->errors_array)) {
assembler_first_go(ctrlp);
}
/*Create output files*/
if (is_empty_list(&ctrlp->errors_array)) {
;
}
/*Log errors, no output created*/
else {
dump_errors(ctrlp);
}
/*Clean everything before next source file*/
cleanup(ctrlp);
}
return OK;
}