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
50 { "builddir", BUILDDIR },
52 { "machine", MACHINE },
53 { "makeoptions", MAKEOPTIONS },
54 { "makevariables", MAKEOPTIONS },
55 { "objectdir", OBJECTDIR },
56 { "options", OPTIONS },
57 { "pseudo-device",PSEUDO_DEVICE },
58 { "sourcedir", SOURCEDIR },
66 WORD ([A-Za-z_][-A-Za-z_]*|[A-Z][-A-Za-z_0-9]*)
67 WORD1 ([A-Za-z_][-A-Za-z_0-9]*)
73 if ((i = kw_lookup(yytext)) == -1)
76 tprintf("id(%s) ", yytext);
79 tprintf("(%s) ", yytext);
83 yytext[strlen(yytext)-1] = '\0';
84 yylval.str = yytext + 1;
88 yylval.val = octal(yytext);
89 tprintf("#O:%o ", yylval.val);
93 yylval.val = hex(yytext);
94 tprintf("#X:%x ", yylval.val);
98 yylval.val = atoi(yytext);
99 tprintf("#D:%d ", yylval.val);
116 #.* { /* Ignored (comment) */; }
117 [ \t]* { /* Ignored (white space) */; }
118 ";" { return SEMICOLON; }
119 "," { return COMMA; }
120 "=" { return EQUALS; }
121 . { return yytext[0]; }
127 * Look up a string in the keyword table. Returns a -1 if the
128 * string is not a keyword otherwise it returns the keyword number
132 kw_lookup(char *word)
134 register struct kt *kp;
136 for (kp = key_words; kp->kt_name != 0; kp++)
137 if (eq(word, kp->kt_name))
143 * Number conversion routines
151 (void) sscanf(str, "%o", &num);
160 (void) sscanf(str+2, "%x", &num);