2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 /* $Id: options.c,v 1.10 1994/06/24 11:37:49 ceriel Exp $ */
6 /* USER-OPTION HANDLING */
14 char options[128]; /* one for every char */
15 int inc_pos = 1; /* place where next -I goes */
18 int do_preprocess = 1;
19 int do_dependencies = 0;
34 if (! strcmp(text, "ndef")) {
40 error("illegal option: %c", text[-1]);
42 case 'A' : /* for Amake */
43 case 'd' : /* dependency generation */
54 case 'o': /* ignore garbage after #else or #endif */
55 case 'C' : /* comment output */
56 options[*(text-1)] = 1;
58 case 'D' : /* -Dname : predefine name */
60 register char *cp = text, *name, *mactext;
63 if (class(*cp) != STIDF && class(*cp) != STELL) {
64 error("identifier missing in -D%s", text);
68 while (*cp && in_idf(*cp))
70 if (!*cp) { /* -Dname */
72 mactext = Salloc("1", 2);
74 if (*cp == '=') { /* -Dname=text */
75 *cp++ = '\0'; /* end of name */
77 mactext = Salloc(cp, maclen + 1);
80 error("malformed option -D%s", text);
83 macro_def(str2idf(name, 0), mactext, -1, (int)maclen, NOFLAG);
86 case 'I' : /* -Ipath : insert "path" into include list */
89 register char *new = text;
91 if (++inc_total > inc_max) {
93 Realloc((char *)inctable,
94 (unsigned)((inc_max+=10)*sizeof(char *)));
97 for(i = inc_pos++; i < inc_total; i++) {
98 char *tmp = inctable[i];
104 else inctable[inc_pos] = 0;
106 case 'M': /* maximum identifier length */
107 idfsize = txt2int(&text);
109 error("malformed -M option");
110 if (idfsize > IDFSIZE) {
111 warning("maximum identifier length is %d", IDFSIZE);
115 warning("minimum identifier length is 8");
119 case 'P' : /* run preprocessor stand-alone, without #'s */
122 case 'U' : /* -Uname : undefine predefined */
123 if (*text) do_undef(text);
132 /* the integer pointed to by *tp is read, while increasing
133 *tp; the resulting value is yielded.
135 register int val = 0;
138 while (ch = **tp, ch >= '0' && ch <= '9') {
139 val = val * 10 + ch - '0';