1 /* $Id: options.c,v 1.12 1994/06/24 10:18:47 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
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 'C' : /* comment output */
43 case 'P' : /* run preprocessor stand-alone, without #'s */
44 options[*(text-1)] = 1;
46 case 'A' : /* for Amake */
47 case 'd' : /* dependency generation */
58 options[*(text-1)] = 1;
61 case 'D' : /* -Dname : predefine name */
63 register char *cp = text, *name, *mactext;
65 if (class(*cp) != STIDF) {
66 error("identifier missing in -D%s", text);
70 while (*cp && in_idf(*cp))
72 if (!*cp) /* -Dname */
75 if (*cp == '=') { /* -Dname=text */
76 *cp++ = '\0'; /* end of name */
80 error("malformed option -D%s", text);
83 macro_def(str2idf(name, 0), mactext, -1, strlen(mactext), NOFLAG);
86 case 'I' : /* -Ipath : insert "path" into include list */
89 register char *new = text;
91 if (++inc_total > inc_max) {
93 Realloc(inctable,(inc_max+=10)*sizeof(char *));
96 for(i = inc_pos++; i < inc_total; i++) {
97 char *tmp = inctable[i];
103 else inctable[inc_pos] = 0;
105 case 'M': /* maximum identifier length */
106 idfsize = txt2int(&text);
108 error("malformed -M option");
109 if (idfsize > IDFSIZE) {
110 warning("maximum identifier length is %d", IDFSIZE);
114 warning("minimum identifier length is 8");
118 case 'U' : /* -Uname : undefine predefined */
120 register struct idf *idef = findidf(text);
122 if (idef && idef->id_macro) {
123 free_macro(idef->id_macro);
124 idef->id_macro = (struct macro *) 0;
135 /* the integer pointed to by *tp is read, while increasing
136 *tp; the resulting value is yielded.
138 register int val = 0;
141 while (ch = **tp, ch >= '0' && ch <= '9') {
142 val = val * 10 + ch - '0';