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 * Author: Ceriel J.H. Jacobs
8 /* U S E R O P T I O N - H A N D L I N G */
10 /* $Id: options.c,v 1.40 1995/12/04 15:29:39 ceriel Exp $ */
18 #include "strict3rd.h"
31 You fouled up! MINIDFSIZE has to be at least 14 or the compiler will not
32 recognize some keywords!
37 int warning_classes = W_INITIAL;
46 options[*text]++; /* debug options etc. */
49 case 'U': /* allow underscores in identifiers */
52 case 'L': /* no fil/lin */
53 case 'R': /* no range checks */
54 case 'A': /* extra array bound checks, for machines that do not
55 implement it in AAR/LAR/SAR
57 case 'n': /* no register messages */
58 case 'x': /* every name global */
59 case 's': /* symmetric: MIN(INTEGER) = -MAX(INTEGER) */
60 case '3': /* strict 3rd edition Modula-2 */
61 case 'l': /* local additions enabled */
66 case 'g': /* generate symbol table for debugger */
72 options['n']++; /* no register vars ??? */
82 warning_classes &= ~W_OLDFASHIONED;
87 warning_classes &= ~W_STRICT;
91 warning_classes &= ~W_ORDINARY;
96 else warning_classes = W_ALWAYS;
103 #ifndef STRICT_3RD_ED
105 warning_classes |= W_OLDFASHIONED;
110 warning_classes |= W_STRICT;
114 warning_classes |= W_ORDINARY;
119 else warning_classes = W_ALL;
122 case 'M': { /* maximum identifier length */
124 char *t = text; /* because &text is illegal */
126 idfsize = txt2int(&t);
127 if (*t || idfsize <= 0)
128 fatal("malformed -M option");
129 if (idfsize > IDFSIZE) {
131 warning(W_ORDINARY,"maximum identifier length is %d", IDFSIZE);
133 if (idfsize < MINIDFSIZE) {
134 warning(W_ORDINARY, "minimum identifier length is %d", MINIDFSIZE);
135 idfsize = MINIDFSIZE;
144 register char *new = text;
148 Realloc((char *)DEFPATH,(unsigned)(mDEF+=10)*sizeof(char *));
151 for (i = ndirs++; i < nDEF; i++) {
152 char *tmp = DEFPATH[i];
159 else DEFPATH[ndirs] = 0;
162 case 'V' : /* set object sizes and alignment requirements */
170 while (c = *text++) {
176 if (*(text = t) == '.') {
181 if (! strindex("wislfdpS", c)) {
182 error("-V: bad type indicator %c\n", c);
184 if (size != 0) switch (c) {
188 dword_size = 2 * size;
193 case 's': /* short (subranges) */
196 case 'l': /* longint */
202 case 'd': /* longreal */
205 case 'p': /* pointer */
209 if (algn != 0) switch (c) {
217 case 's': /* short (subranges) */
220 case 'l': /* longint */
226 case 'd': /* longreal */
229 case 'p': /* pointer */
230 pointer_align = algn;
232 case 'S': /* initial record alignment */
243 #if (!SQUEEZE) | (!NOCROSS)
248 /* the integer pointed to by *tp is read, while increasing
249 *tp; the resulting value is yielded.
251 register int val = 0;
254 while (ch = **tp, ch >= '0' && ch <= '9') {
255 val = val * 10 + ch - '0';