-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
38 lines (30 loc) · 869 Bytes
/
main.cpp
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
#include <unistd.h>
#include "helper_funcs.h"
#include "assembler.h"
int main(int argc, char* argv[]) {
std::string path = "";
int opt;
while ((opt = getopt(argc, argv, "p:")) != -1) {
switch (opt) {
case 'p':
path = optarg;
break;
default:
std::cerr << "Usage: " << argv[0] << " -p <path>" << std::endl;
return 1;
}
}
if (path == "") {
std::cerr << "Usage: " << argv[0] << " -p <path>" << std::endl;
std::cerr << "Missing required arguments." << std::endl;
return 1;
}
std::cout << "Path: " << path << std::endl;
assembler asmbl;
std::vector<std::string> instrs;
for (auto p : GetFilesToParse(path)) {
asmbl.SetCurrentPath(fs::path(p));
asmbl.assemble();
}
return 0;
}