Sun Mar 11 19:27:27 2012 UTC ()
More naming improvements.


(dholland)
diff -r1.34 -r1.35 src/usr.bin/config/gram.y

cvs diff -r1.34 -r1.35 src/usr.bin/config/gram.y (expand / switch to unified diff)

--- src/usr.bin/config/gram.y 2012/03/11 08:21:53 1.34
+++ src/usr.bin/config/gram.y 2012/03/11 19:27:26 1.35
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1%{ 1%{
2/* $NetBSD: gram.y,v 1.34 2012/03/11 08:21:53 dholland Exp $ */ 2/* $NetBSD: gram.y,v 1.35 2012/03/11 19:27:26 dholland Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1992, 1993 5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * This software was developed by the Computer Systems Engineering group 8 * This software was developed by the Computer Systems Engineering group
9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10 * contributed to Berkeley. 10 * contributed to Berkeley.
11 * 11 *
12 * All advertising materials mentioning features or use of this software 12 * All advertising materials mentioning features or use of this software
13 * must display the following acknowledgement: 13 * must display the following acknowledgement:
14 * This product includes software developed by the University of 14 * This product includes software developed by the University of
15 * California, Lawrence Berkeley Laboratories. 15 * California, Lawrence Berkeley Laboratories.
@@ -165,52 +165,52 @@ static struct nvlist *mk_ns(const char * @@ -165,52 +165,52 @@ static struct nvlist *mk_ns(const char *
165%token ROOT 165%token ROOT
166%token SINGLE SOURCE 166%token SINGLE SOURCE
167%token TYPE 167%token TYPE
168%token VECTOR VERSION 168%token VECTOR VERSION
169%token WITH 169%token WITH
170%token <num> NUMBER 170%token <num> NUMBER
171%token <str> PATHNAME QSTRING WORD EMPTYSTRING 171%token <str> PATHNAME QSTRING WORD EMPTYSTRING
172%token ENDDEFS 172%token ENDDEFS
173 173
174%type <condexpr> fopts condexpr condatom 174%type <condexpr> fopts condexpr condatom
175%type <condexpr> cond_or_expr cond_and_expr cond_prefix_expr 175%type <condexpr> cond_or_expr cond_and_expr cond_prefix_expr
176%type <condexpr> cond_base_expr 176%type <condexpr> cond_base_expr
177%type <str> fs_spec 177%type <str> fs_spec
178%type <val> fflgs fflag oflgs oflag 178%type <val> fflags fflag oflags oflag
179%type <str> rule 179%type <str> rule
180%type <attr> depend 180%type <attr> depend
181%type <devb> devbase 181%type <devb> devbase
182%type <deva> devattach_opt 182%type <deva> devattach_opt
183%type <list> atlist interface_opt 183%type <list> atlist interface_opt
184%type <str> atname 184%type <str> atname
185%type <list> loclist locdef 185%type <list> loclist locdef
186%type <str> locdefault 186%type <str> locdefault
187%type <list> values locdefaults 187%type <list> values locdefaults
188%type <attrlist> depend_list depends 188%type <attrlist> depend_list depends
189%type <list> locators locator 189%type <list> locators locator
190%type <list> dev_spec 190%type <list> dev_spec
191%type <str> device_instance 191%type <str> device_instance
192%type <str> attachment 192%type <str> attachment
193%type <str> value 193%type <str> value
194%type <val> major_minor npseudo 194%type <val> major_minor npseudo
195%type <num> signed_number 195%type <num> signed_number
196%type <val> device_flags 196%type <val> device_flags
197%type <str> deffs 197%type <str> deffs
198%type <list> deffses 198%type <list> deffses
199%type <list> defopt 199%type <list> defopt
200%type <list> defopts 200%type <list> defopts
201%type <str> optdep 201%type <str> optdepend
202%type <list> optdeps 202%type <list> optdepends
203%type <list> defoptdeps 203%type <list> optdepend_list
204%type <str> optfile_opt 204%type <str> optfile_opt
205%type <list> subarches 205%type <list> subarches
206%type <str> filename stringvalue locname mkvarname 206%type <str> filename stringvalue locname mkvarname
207%type <val> device_major_block device_major_char 207%type <val> device_major_block device_major_char
208%type <list> devnodes devnodetype devnodeflags devnode_dims 208%type <list> devnodes devnodetype devnodeflags devnode_dims
209 209
210%% 210%%
211 211
212/* 212/*
213 * A complete configuration consists of both the configuration part (a 213 * A complete configuration consists of both the configuration part (a
214 * kernel config such as GENERIC or SKYNET, plus also the various 214 * kernel config such as GENERIC or SKYNET, plus also the various
215 * std.* files), which selects the material to be in the kernel, and 215 * std.* files), which selects the material to be in the kernel, and
216 * also the definition part (files, files.*, etc.) that declares what 216 * also the definition part (files, files.*, etc.) that declares what
@@ -289,94 +289,94 @@ definitions: @@ -289,94 +289,94 @@ definitions:
289 | definitions '\n' 289 | definitions '\n'
290 | definitions definition '\n' { wrap_continue(); } 290 | definitions definition '\n' { wrap_continue(); }
291 | definitions error '\n' { wrap_cleanup(); } 291 | definitions error '\n' { wrap_cleanup(); }
292 | definitions ENDFILE { enddefs(); checkfiles(); } 292 | definitions ENDFILE { enddefs(); checkfiles(); }
293; 293;
294 294
295/* A single definition. */ 295/* A single definition. */
296definition: 296definition:
297 file 297 file
298 | object 298 | object
299 | device_major { do_devsw = 1; } 299 | device_major { do_devsw = 1; }
300 | prefix 300 | prefix
301 | DEVCLASS WORD { (void)defattr($2, NULL, NULL, 1); } 301 | DEVCLASS WORD { (void)defattr($2, NULL, NULL, 1); }
302 | DEFFS deffses defoptdeps { deffilesystem($2, $3); } 302 | DEFFS deffses optdepend_list { deffilesystem($2, $3); }
303 | DEFINE WORD interface_opt depend_list 303 | DEFINE WORD interface_opt depend_list
304 { (void)defattr($2, $3, $4, 0); } 304 { (void)defattr($2, $3, $4, 0); }
305 | DEFOPT optfile_opt defopts defoptdeps 305 | DEFOPT optfile_opt defopts optdepend_list
306 { defoption($2, $3, $4); } 306 { defoption($2, $3, $4); }
307 | DEFFLAG optfile_opt defopts defoptdeps 307 | DEFFLAG optfile_opt defopts optdepend_list
308 { defflag($2, $3, $4, 0); } 308 { defflag($2, $3, $4, 0); }
309 | OBSOLETE DEFFLAG optfile_opt defopts 309 | OBSOLETE DEFFLAG optfile_opt defopts
310 { defflag($3, $4, NULL, 1); } 310 { defflag($3, $4, NULL, 1); }
311 | DEFPARAM optfile_opt defopts defoptdeps 311 | DEFPARAM optfile_opt defopts optdepend_list
312 { defparam($2, $3, $4, 0); } 312 { defparam($2, $3, $4, 0); }
313 | OBSOLETE DEFPARAM optfile_opt defopts 313 | OBSOLETE DEFPARAM optfile_opt defopts
314 { defparam($3, $4, NULL, 1); } 314 { defparam($3, $4, NULL, 1); }
315 | DEVICE devbase interface_opt depend_list 315 | DEVICE devbase interface_opt depend_list
316 { defdev($2, $3, $4, 0); } 316 { defdev($2, $3, $4, 0); }
317 | ATTACH devbase AT atlist devattach_opt depend_list 317 | ATTACH devbase AT atlist devattach_opt depend_list
318 { defdevattach($5, $2, $4, $6); } 318 { defdevattach($5, $2, $4, $6); }
319 | MAXPARTITIONS NUMBER { maxpartitions = $2.val; } 319 | MAXPARTITIONS NUMBER { maxpartitions = $2.val; }
320 | MAXUSERS NUMBER NUMBER NUMBER 320 | MAXUSERS NUMBER NUMBER NUMBER
321 { setdefmaxusers($2.val, $3.val, $4.val); } 321 { setdefmaxusers($2.val, $3.val, $4.val); }
322 | MAKEOPTIONS condmkopt_list 322 | MAKEOPTIONS condmkopt_list
323 /* interface_opt in DEFPSEUDO is for backwards compatibility */ 323 /* interface_opt in DEFPSEUDO is for backwards compatibility */
324 | DEFPSEUDO devbase interface_opt depend_list 324 | DEFPSEUDO devbase interface_opt depend_list
325 { defdev($2, $3, $4, 1); } 325 { defdev($2, $3, $4, 1); }
326 | DEFPSEUDODEV devbase interface_opt depend_list 326 | DEFPSEUDODEV devbase interface_opt depend_list
327 { defdev($2, $3, $4, 2); } 327 { defdev($2, $3, $4, 2); }
328 | MAJOR '{' majorlist '}' 328 | MAJOR '{' majorlist '}'
329 | VERSION NUMBER { setversion($2.val); } 329 | VERSION NUMBER { setversion($2.val); }
330; 330;
331 331
332/* source file: file foo/bar.c bar|baz needs-flag compile-with blah */ 332/* source file: file foo/bar.c bar|baz needs-flag compile-with blah */
333file: 333file:
334 XFILE filename fopts fflgs rule { addfile($2, $3, $4, $5); } 334 XFILE filename fopts fflags rule { addfile($2, $3, $4, $5); }
335; 335;
336 336
337/* file options: optional expression of conditions */ 337/* file options: optional expression of conditions */
338fopts: 338fopts:
339 /* empty */ { $$ = NULL; } 339 /* empty */ { $$ = NULL; }
340 | condexpr { $$ = $1; } 340 | condexpr { $$ = $1; }
341; 341;
342 342
343/* zero or more flags for a file */ 343/* zero or more flags for a file */
344fflgs: 344fflags:
345 /* empty */ { $$ = 0; } 345 /* empty */ { $$ = 0; }
346 | fflgs fflag { $$ = $1 | $2; } 346 | fflags fflag { $$ = $1 | $2; }
347; 347;
348 348
349/* one flag for a file */ 349/* one flag for a file */
350fflag: 350fflag:
351 NEEDS_COUNT { $$ = FI_NEEDSCOUNT; } 351 NEEDS_COUNT { $$ = FI_NEEDSCOUNT; }
352 | NEEDS_FLAG { $$ = FI_NEEDSFLAG; } 352 | NEEDS_FLAG { $$ = FI_NEEDSFLAG; }
353; 353;
354 354
355/* extra compile directive for a source file */ 355/* extra compile directive for a source file */
356rule: 356rule:
357 /* empty */ { $$ = NULL; } 357 /* empty */ { $$ = NULL; }
358 | COMPILE_WITH stringvalue { $$ = $2; } 358 | COMPILE_WITH stringvalue { $$ = $2; }
359; 359;
360 360
361/* object file: object zot.o foo|zot needs-flag */ 361/* object file: object zot.o foo|zot needs-flag */
362object: 362object:
363 XOBJECT filename fopts oflgs { addobject($2, $3, $4); } 363 XOBJECT filename fopts oflags { addobject($2, $3, $4); }
364; 364;
365 365
366/* zero or more flags for an object file */ 366/* zero or more flags for an object file */
367oflgs: 367oflags:
368 /* empty */ { $$ = 0; } 368 /* empty */ { $$ = 0; }
369 | oflgs oflag { $$ = $1 | $2; } 369 | oflags oflag { $$ = $1 | $2; }
370; 370;
371 371
372/* a single flag for an object file */ 372/* a single flag for an object file */
373oflag: 373oflag:
374 NEEDS_FLAG { $$ = OI_NEEDSFLAG; } 374 NEEDS_FLAG { $$ = OI_NEEDSFLAG; }
375; 375;
376 376
377/* device major declaration */ 377/* device major declaration */
378device_major: 378device_major:
379 DEVICE_MAJOR WORD device_major_char device_major_block fopts devnodes 379 DEVICE_MAJOR WORD device_major_char device_major_block fopts devnodes
380 { adddevm($2, $3, $4, $5, $6); } 380 { adddevm($2, $3, $4, $5, $6); }
381; 381;
382 382
@@ -496,26 +496,44 @@ depend_list: @@ -496,26 +496,44 @@ depend_list:
496; 496;
497 497
498/* one or more depend items */ 498/* one or more depend items */
499depends: 499depends:
500 depend { $$ = MK2(attrlist, NULL, $1); } 500 depend { $$ = MK2(attrlist, NULL, $1); }
501 | depends ',' depend { $$ = MK2(attrlist, $1, $3); } 501 | depends ',' depend { $$ = MK2(attrlist, $1, $3); }
502; 502;
503 503
504/* one depend item (which is an attribute) */ 504/* one depend item (which is an attribute) */
505depend: 505depend:
506 WORD { $$ = getattr($1); } 506 WORD { $$ = getattr($1); }
507; 507;
508 508
 509/* list of option depends, may be empty */
 510optdepend_list:
 511 /* empty */ { $$ = NULL; }
 512 | ':' optdepends { $$ = $2; }
 513;
 514
 515/* a list of option dependencies */
 516optdepends:
 517 optdepend { $$ = new_n($1); }
 518 | optdepends ',' optdepend { $$ = new_nx($3, $1); }
 519;
 520
 521/* one option depend, which is an option name */
 522optdepend:
 523 WORD { $$ = $1; }
 524;
 525
 526
509/* list of places to attach: attach blah at ... */ 527/* list of places to attach: attach blah at ... */
510atlist: 528atlist:
511 atname { $$ = new_n($1); } 529 atname { $$ = new_n($1); }
512 | atlist ',' atname { $$ = new_nx($3, $1); } 530 | atlist ',' atname { $$ = new_nx($3, $1); }
513; 531;
514 532
515/* a place to attach a device */ 533/* a place to attach a device */
516atname: 534atname:
517 WORD { $$ = $1; } 535 WORD { $$ = $1; }
518 | ROOT { $$ = NULL; } 536 | ROOT { $$ = NULL; }
519; 537;
520 538
521/* one or more defined options */ 539/* one or more defined options */
@@ -530,43 +548,26 @@ defopt: @@ -530,43 +548,26 @@ defopt:
530 | WORD '=' value { $$ = new_ns($1, $3); } 548 | WORD '=' value { $$ = new_ns($1, $3); }
531 | WORD COLONEQ value { 549 | WORD COLONEQ value {
532 struct nvlist *__nv = new_n($1); 550 struct nvlist *__nv = new_n($1);
533 551
534 $$ = new_nsx("", $3, __nv); 552 $$ = new_nsx("", $3, __nv);
535 } 553 }
536 | WORD '=' value COLONEQ value { 554 | WORD '=' value COLONEQ value {
537 struct nvlist *__nv = new_n($1); 555 struct nvlist *__nv = new_n($1);
538 556
539 $$ = new_nsx("", $5, __nv); 557 $$ = new_nsx("", $5, __nv);
540 } 558 }
541; 559;
542 560
543/* option dependencies (read as "defopt deps") which are optional */ 
544defoptdeps: 
545 /* empty */ { $$ = NULL; } 
546 | ':' optdeps { $$ = $2; } 
547; 
548 
549/* a list of option dependencies */ 
550optdeps: 
551 optdep { $$ = new_n($1); } 
552 | optdeps ',' optdep { $$ = new_nx($3, $1); } 
553; 
554 
555/* one option dependence */ 
556optdep: 
557 WORD { $$ = $1; } 
558; 
559 
560/* list of conditional makeoptions */ 561/* list of conditional makeoptions */
561condmkopt_list: 562condmkopt_list:
562 condmkoption 563 condmkoption
563 | condmkopt_list ',' condmkoption 564 | condmkopt_list ',' condmkoption
564; 565;
565 566
566/* one conditional make option */ 567/* one conditional make option */
567condmkoption: 568condmkoption:
568 condexpr mkvarname PLUSEQ value { appendcondmkoption($1, $2, $4); } 569 condexpr mkvarname PLUSEQ value { appendcondmkoption($1, $2, $4); }
569; 570;
570 571
571/* device name */ 572/* device name */
572devbase: 573devbase: