-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
47 lines (43 loc) · 870 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
39
40
41
42
43
44
45
46
47
#include "arc.h"
constexpr auto VERSION = "0.35";
void print_logo() {
printf("Arc++ %s\n", VERSION);
}
int main(int argc, char **argv)
{
if (argc == 1) { /* REPL */
print_logo();
arc::arc_init();
arc::repl();
puts("");
return 0;
}
else if (argc == 2) {
char *opt = argv[1];
if (strcmp(opt, "-h") == 0) {
puts("Usage: arcadia [OPTIONS...] [FILES...]");
puts("");
puts("OPTIONS:");
puts(" -h print this screen.");
puts(" -v print version.");
return 0;
}
else if (strcmp(opt, "-v") == 0) {
puts(VERSION);
return 0;
}
}
/* execute files */
arc::arc_init();
int i;
arc::error err;
for (i = 1; i < argc; i++) {
err = arc::arc_load_file(argv[i]);
if (err) {
fprintf(stderr, "In file %s:\n", argv[i]);
print_error(err);
break;
}
}
return 0;
}