3 * Mach Operating System
4 * Copyright (c) 1990 Carnegie-Mellon University
5 * Copyright (c) 1989 Carnegie-Mellon University
6 * Copyright (c) 1988 Carnegie-Mellon University
7 * Copyright (c) 1987 Carnegie-Mellon University
8 * All rights reserved. The CMU software License Agreement specifies
9 * the terms and conditions for use and redistribution.
13 * Copyright (c) 1980 Regents of the University of California.
14 * All rights reserved.
16 * Redistribution and use in source and binary forms are permitted
17 * provided that the above copyright notice and this paragraph are
18 * duplicated in all such forms and that any documentation,
19 * advertising materials, and other materials related to such
20 * distribution and use acknowledge that the software was developed
21 * by the University of California, Berkeley. The name of the
22 * University may not be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
26 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
28 * @(#)config.l 5.5 (Berkeley) 6/18/88
35 int kw_lookup(char *word);
40 #define tprintf if (do_trace) printf
53 { "builddir", BUILDDIR },
55 { "configdir", CONFIGDIR },
56 { "controller", CONTROLLER },
67 { "machine", MACHINE },
69 { "makeoptions", MAKEOPTIONS },
70 { "makevariables", MAKEOPTIONS },
72 { "maxusers", MAXUSERS },
76 { "objectdir", OBJECTDIR },
78 { "options", OPTIONS },
79 { "priority", PRIORITY },
80 { "profile", PROFILE },
81 { "pseudo-device",PSEUDO_DEVICE },
85 { "sourcedir", SOURCEDIR },
91 { "lun", LUN }, /* MMAX only */
92 { "slot", SLOT }, /* MMAX only */
93 { "tape", TAPE }, /* MMAX only */
94 { "bin", BIN }, /* SQT ONLY */
95 { "am", ADDRMOD }, /* MIPS */
96 { "mbii", MBII }, /* MIPS */
97 { "vme", VME }, /* MIPS */
104 WORD ([A-Za-z_][-A-Za-z_]*|[A-Z][-A-Za-z_0-9]*)
105 WORD1 ([A-Za-z_][-A-Za-z_0-9]*)
111 if ((i = kw_lookup(yytext)) == -1)
114 tprintf("id(%s) ", yytext);
117 tprintf("(%s) ", yytext);
121 yytext[strlen(yytext)-1] = '\0';
122 yylval.str = yytext + 1;
126 yylval.val = octal(yytext);
127 tprintf("#O:%o ", yylval.val);
131 yylval.val = hex(yytext);
132 tprintf("#X:%x ", yylval.val);
136 yylval.val = atoi(yytext);
137 tprintf("#D:%d ", yylval.val);
141 yylval.val = (int) (60 * atof(yytext) + 0.5);
161 #.* { /* Ignored (comment) */; }
162 [ \t]* { /* Ignored (white space) */; }
163 ";" { return SEMICOLON; }
164 "," { return COMMA; }
165 "=" { return EQUALS; }
167 . { return yytext[0]; }
173 * Look up a string in the keyword table. Returns a -1 if the
174 * string is not a keyword otherwise it returns the keyword number
178 kw_lookup(char *word)
180 register struct kt *kp;
182 for (kp = key_words; kp->kt_name != 0; kp++)
183 if (eq(word, kp->kt_name))
189 * Number conversion routines
197 (void) sscanf(str, "%o", &num);
206 (void) sscanf(str+2, "%x", &num);