7 /* new merged main program for C compiler pass [01], makes own tempfiles */
14 int main(argc, argv) int argc; char **argv; {
16 register struct kwtab *ip;
21 if (strcmp(argv[1], "-P") == 0)
23 else if (strcmp(argv[1], "-W") == 0 || strcmp(argv[1], "-w") == 0)
31 if (argc >= 2 && strcmp(argv[1], "-") != 0 && freopen(argv[1], "r", stdin) == 0) {
32 error0("Can't find %s", argv[1]);
35 for (i = 0; i < 2; ++i) {
36 strcpy(temp_name, "/tmp/ccomXXXXXX");
37 fd = mkstemp(temp_name);
38 if (fd == -1 || (temp_fp[i] = fdopen(fd, "w+")) == 0 /*|| unlink(temp_name)*/) {
39 error0("Can't create temp: %s", temp_name);
44 setbuf(temp_fp[0], buf1);
45 setbuf(temp_fp[1], buf2);
50 * The hash table locations of the keywords
51 * are marked; if an identifier hashes to one of
52 * these locations, it is looked up in in the keyword
55 for (ip=kwtab; ip->kwname; ip++) {
57 kwhash[i/LNBPW] |= 1 << (i%LNBPW);
59 coremax = locbase = /*sbrk(0);*/ funcbase = curbase = sbrk(0);
63 fprintf(stderr, "%ld %ld\n", ftell(temp_fp[0]), ftell(temp_fp[1]));
74 if (argc >= 3 && strcmp(argv[2], "-") != 0 && freopen(argv[2], "w", stdin) == 0) {
75 error0("Can't create %s", argv[2]);
80 /*funcbase = curbase = coremax = sbrk(0);*/
85 * If any floating-point instructions
86 * were used, generate a reference that
87 * pulls in the floating-point part of printf.
90 printf(".globl fltused\n");
92 * tack on the string file.
94 printf(".globl\n.data\n");
98 if (totspace >= (_UNSIGNED_INT)56000)
99 werror1("possibly too much data");