-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpacklr.c
More file actions
39 lines (30 loc) · 833 Bytes
/
Copy pathpacklr.c
File metadata and controls
39 lines (30 loc) · 833 Bytes
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
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
char *program = *argv++;
argc--;
if(argc == 0) {
fprintf(stderr, "expected a file to compile");
exit(1);
}
int donext = 1;
char *filepath = *argv++;
char command[4000] = {0};
sprintf(command, "./bin/packlc %s -code -out file.pasm\n", filepath);
if (system(command)) {
fprintf(stderr, "compilation failed\n");
donext = 0;
}
sprintf(command, "./bin/pasm file.pasm\n");
if (donext && system(command)) {
fprintf(stderr, "assembling failed\n");
donext = 0;
}
if (donext) {
sprintf(command, "./bin/pvmr file.pvm\n");
system(command);
}
sprintf(command, "rm -f file.pasm file.pvm\n");
system(command);
return 0;
}