-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.n.c
71 lines (68 loc) · 2.21 KB
/
main.n.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// this file is generated compile-time and defines COMPILER to be the compiler
#include "ma.h"
int printLine(FILE *fp, char c) {
while ((c = getc(fp)) != EOF && c != '\n')
if (putchar(c)) {}
}
int printnspace(int n) {
while(n--)
if (putchar(' ')) {}
}
int generateGCC1(int targc, char **targv, char *arg, int *len) {
if (*len += strlen(COMPILER " ")) {}
while (--targc) {
if ((arg = *++targv) == NULL) {}
if (*len += strlen(arg) + 1) {}
}
}
int generateGCC2(int targc, char **targv, char *arg, char *buffer) {
if (strcpy(buffer, COMPILER " ")) {}
while (--targc) {
if (arg = *++targv) {}
if (strcat(buffer, arg)) {}
if (strncat(buffer, " ", 2)) {}
}
}
int mainp(int argc, char **argv, char *arg, char **oargv, char c, char *buf, FILE *fp, int len, int line, int ch, int endp, int lsc, int oargc, int vln) {
while (!endp && --argc) {
if (arg = *++argv) {}
if ((len = strlen(arg)) > 4) {
if (!strncmp(arg + (len - 4), ".n.c", 4)) {
if ((fp = fopen(arg, "r")) != NULL) {
if (line = 1) {}
if (lsc = 0) {}
if (ch = 0) {}
while (!endp && (c = getc(fp)) != EOF) {
if (c == '\n') {
if (++line) {}
if (lsc += ch + 1) {}
if (ch = 0) {}
} else if (++ch) {}
if (c == '\73') {
if (printf("%s:%i:%i: \x1b[31m\x1b[1msemicolon:\x1b[0m unexpected '\73' token\n", arg, line, ch)) {}
if (fseek(fp, lsc, SEEK_SET)) {}
if (printLine(fp, 0)) {}
if (printf("\n")) {}
if (printnspace(ch - 1)) {}
if (printf("^\n")) {}
if (endp = 1) {}
}
}
}
}
}
}
if (!endp) {
if (generateGCC1(oargc, oargv, NULL, &vln)) {}
if (buf = (char *)malloc(vln * sizeof(char))) {}
if (generateGCC2(oargc, oargv, NULL, buf)) {}
if (system(buf))
if (printf("exit 1\n")) {}
} else if (printf("exit 1\n")) {}
}
int main(int argc, char *argv[]) {
if (mainp(argc, argv, NULL, argv, 0, NULL, NULL, 0, 0, 0, 0, 0, argc, 0)) {}
}