aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2008-08-06 22:24:17 -0400
committerPaul Mackerras <paulus@samba.org>2008-08-20 02:34:58 -0400
commited95d7450dcbfeb45ffc9d39b1747aee82b49a51 (patch)
treefaca7d89e2907e1407161f967477ed2ae21d46bb /arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
parent0ec27c049d80535f77901654a310b090106b046c (diff)
powerpc: Update in-kernel dtc and libfdt to version 1.2.0
Some time ago, a copies of the upstream dtc and libfdt sources were included in the kernel tree to avoid having these as external dependencies for building the kernel. Since then development on the upstream dtc and libfdt has continued. This updates the in-kernel versions to match the recently released upstream dtc version 1.2.0. This includes a number of bugfixes, many cleanups and a few new features. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped')
-rw-r--r--arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped445
1 files changed, 229 insertions, 216 deletions
diff --git a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped b/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
index d0f742460f92..ac392cb040f6 100644
--- a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
+++ b/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
@@ -9,7 +9,7 @@
9#define FLEX_SCANNER 9#define FLEX_SCANNER
10#define YY_FLEX_MAJOR_VERSION 2 10#define YY_FLEX_MAJOR_VERSION 2
11#define YY_FLEX_MINOR_VERSION 5 11#define YY_FLEX_MINOR_VERSION 5
12#define YY_FLEX_SUBMINOR_VERSION 33 12#define YY_FLEX_SUBMINOR_VERSION 34
13#if YY_FLEX_SUBMINOR_VERSION > 0 13#if YY_FLEX_SUBMINOR_VERSION > 0
14#define FLEX_BETA 14#define FLEX_BETA
15#endif 15#endif
@@ -31,7 +31,7 @@
31 31
32/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 32/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 33
34#if __STDC_VERSION__ >= 199901L 34#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 35
36/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 36/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types. 37 * if you want the limit (max/min) macros for int types.
@@ -94,11 +94,12 @@ typedef unsigned int flex_uint32_t;
94 94
95#else /* ! __cplusplus */ 95#else /* ! __cplusplus */
96 96
97#if __STDC__ 97/* C99 requires __STDC__ to be defined as 1. */
98#if defined (__STDC__)
98 99
99#define YY_USE_CONST 100#define YY_USE_CONST
100 101
101#endif /* __STDC__ */ 102#endif /* defined (__STDC__) */
102#endif /* ! __cplusplus */ 103#endif /* ! __cplusplus */
103 104
104#ifdef YY_USE_CONST 105#ifdef YY_USE_CONST
@@ -194,11 +195,13 @@ extern FILE *yyin, *yyout;
194/* The following is because we cannot portably get our hands on size_t 195/* The following is because we cannot portably get our hands on size_t
195 * (without autoconf's help, which isn't available because we want 196 * (without autoconf's help, which isn't available because we want
196 * flex-generated scanners to compile on their own). 197 * flex-generated scanners to compile on their own).
198 * Given that the standard has decreed that size_t exists since 1989,
199 * I guess we can afford to depend on it. Manoj.
197 */ 200 */
198 201
199#ifndef YY_TYPEDEF_YY_SIZE_T 202#ifndef YY_TYPEDEF_YY_SIZE_T
200#define YY_TYPEDEF_YY_SIZE_T 203#define YY_TYPEDEF_YY_SIZE_T
201typedef unsigned int yy_size_t; 204typedef size_t yy_size_t;
202#endif 205#endif
203 206
204#ifndef YY_STRUCT_YY_BUFFER_STATE 207#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -349,7 +352,7 @@ void yyfree (void * );
349 352
350/* Begin user sect3 */ 353/* Begin user sect3 */
351 354
352#define yywrap() 1 355#define yywrap(n) 1
353#define YY_SKIP_YYWRAP 356#define YY_SKIP_YYWRAP
354 357
355typedef unsigned char YY_CHAR; 358typedef unsigned char YY_CHAR;
@@ -389,19 +392,20 @@ struct yy_trans_info
389 flex_int32_t yy_verify; 392 flex_int32_t yy_verify;
390 flex_int32_t yy_nxt; 393 flex_int32_t yy_nxt;
391 }; 394 };
392static yyconst flex_int16_t yy_accept[94] = 395static yyconst flex_int16_t yy_accept[104] =
393 { 0, 396 { 0,
394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
395 21, 19, 16, 16, 19, 19, 19, 8, 8, 19, 398 21, 19, 16, 16, 19, 19, 19, 7, 7, 19,
396 8, 19, 19, 19, 19, 14, 15, 15, 19, 9, 399 7, 19, 19, 19, 19, 13, 14, 14, 19, 8,
397 9, 16, 0, 3, 0, 0, 10, 0, 0, 0, 400 8, 16, 0, 2, 0, 0, 9, 0, 0, 0,
398 0, 0, 0, 8, 8, 6, 0, 7, 0, 2, 401 0, 0, 0, 7, 7, 5, 0, 6, 0, 12,
399 0, 13, 13, 15, 15, 9, 0, 12, 10, 0, 402 12, 14, 14, 8, 0, 11, 9, 0, 0, 0,
400 0, 0, 0, 18, 0, 0, 0, 2, 9, 0, 403 0, 18, 0, 0, 0, 0, 8, 0, 17, 0,
401 17, 0, 0, 0, 11, 0, 0, 0, 0, 0, 404 0, 0, 0, 0, 10, 0, 0, 0, 0, 0,
402 0, 0, 0, 0, 4, 0, 0, 1, 0, 0, 405 0, 0, 0, 0, 0, 0, 0, 0, 3, 15,
403 0, 5, 0 406 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
404 407
408 0, 4, 0
405 } ; 409 } ;
406 410
407static yyconst flex_int32_t yy_ec[256] = 411static yyconst flex_int32_t yy_ec[256] =
@@ -444,122 +448,126 @@ static yyconst flex_int32_t yy_meta[36] =
444 7, 7, 7, 8, 1 448 7, 7, 7, 8, 1
445 } ; 449 } ;
446 450
447static yyconst flex_int16_t yy_base[107] = 451static yyconst flex_int16_t yy_base[117] =
448 { 0, 452 { 0,
449 0, 0, 32, 0, 53, 0, 76, 0, 108, 111, 453 0, 0, 30, 0, 44, 0, 67, 0, 97, 105,
450 280, 288, 37, 39, 33, 36, 106, 0, 123, 146, 454 302, 303, 35, 44, 40, 94, 112, 0, 129, 152,
451 255, 251, 45, 0, 159, 288, 0, 53, 108, 172, 455 296, 295, 159, 0, 176, 303, 0, 116, 95, 165,
452 114, 127, 158, 288, 245, 0, 0, 234, 235, 236, 456 49, 46, 102, 303, 296, 0, 0, 288, 290, 293,
453 197, 195, 199, 0, 0, 288, 0, 288, 160, 288, 457 264, 266, 270, 0, 0, 303, 0, 303, 264, 303,
454 183, 288, 0, 0, 183, 182, 0, 0, 0, 0, 458 0, 0, 195, 101, 0, 0, 0, 0, 284, 125,
455 204, 189, 207, 288, 179, 187, 180, 194, 0, 171, 459 277, 265, 225, 230, 216, 218, 0, 202, 224, 221,
456 288, 196, 178, 174, 288, 169, 169, 177, 165, 153, 460 217, 107, 196, 188, 303, 206, 179, 186, 178, 185,
457 143, 155, 137, 118, 288, 122, 42, 288, 36, 36, 461 183, 162, 161, 150, 169, 160, 145, 125, 303, 303,
458 40, 288, 288, 212, 218, 223, 229, 234, 239, 245, 462 137, 109, 190, 103, 203, 167, 108, 197, 303, 123,
459 463
460 251, 255, 262, 270, 275, 280 464 29, 303, 303, 215, 221, 226, 229, 234, 240, 246,
465 250, 257, 265, 270, 275, 282
461 } ; 466 } ;
462 467
463static yyconst flex_int16_t yy_def[107] = 468static yyconst flex_int16_t yy_def[117] =
464 { 0, 469 { 0,
465 93, 1, 1, 3, 3, 5, 93, 7, 3, 3, 470 103, 1, 1, 3, 3, 5, 103, 7, 3, 3,
466 93, 93, 93, 93, 94, 95, 93, 96, 93, 19, 471 103, 103, 103, 103, 104, 105, 103, 106, 103, 19,
467 19, 20, 97, 98, 20, 93, 99, 100, 95, 93, 472 19, 20, 103, 107, 20, 103, 108, 109, 105, 103,
468 93, 93, 94, 93, 94, 101, 102, 93, 103, 104, 473 103, 103, 104, 103, 104, 110, 111, 103, 112, 113,
469 93, 93, 93, 96, 19, 93, 20, 93, 97, 93, 474 103, 103, 103, 106, 19, 103, 20, 103, 103, 103,
470 97, 93, 20, 99, 100, 93, 105, 101, 102, 106, 475 20, 108, 109, 103, 114, 110, 111, 115, 112, 112,
471 103, 103, 104, 93, 93, 93, 93, 94, 105, 106, 476 113, 103, 103, 103, 103, 103, 114, 115, 103, 103,
472 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 477 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
473 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 478 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
474 93, 93, 0, 93, 93, 93, 93, 93, 93, 93, 479 103, 103, 103, 103, 103, 116, 103, 116, 103, 116,
475 480
476 93, 93, 93, 93, 93, 93 481 103, 103, 0, 103, 103, 103, 103, 103, 103, 103,
482 103, 103, 103, 103, 103, 103
477 } ; 483 } ;
478 484
479static yyconst flex_int16_t yy_nxt[324] = 485static yyconst flex_int16_t yy_nxt[339] =
480 { 0, 486 { 0,
481 12, 13, 14, 15, 12, 16, 12, 12, 12, 17, 487 12, 13, 14, 15, 12, 16, 12, 12, 12, 17,
482 18, 18, 18, 12, 19, 20, 20, 12, 12, 21, 488 18, 18, 18, 12, 19, 20, 20, 12, 12, 21,
483 19, 21, 19, 22, 20, 20, 20, 20, 20, 20, 489 19, 21, 19, 22, 20, 20, 20, 20, 20, 20,
484 20, 20, 20, 12, 12, 23, 34, 12, 32, 32, 490 20, 20, 20, 12, 12, 12, 32, 32, 102, 23,
485 32, 32, 12, 12, 12, 36, 20, 33, 50, 92, 491 12, 12, 12, 34, 20, 32, 32, 32, 32, 20,
486 35, 20, 20, 20, 20, 20, 15, 54, 91, 54, 492 20, 20, 20, 20, 24, 24, 24, 35, 25, 54,
487 54, 54, 51, 24, 24, 24, 46, 25, 90, 38, 493 54, 54, 26, 25, 25, 25, 25, 12, 13, 14,
488 89, 26, 25, 25, 25, 25, 12, 13, 14, 15, 494 15, 27, 12, 27, 27, 27, 23, 27, 27, 27,
489 27, 12, 27, 27, 27, 17, 27, 27, 27, 12, 495 12, 28, 28, 28, 12, 12, 28, 28, 28, 28,
490 28, 28, 28, 12, 12, 28, 28, 28, 28, 28, 496 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
491 497
492 28, 28, 28, 28, 28, 28, 28, 28, 28, 12, 498 12, 12, 29, 36, 103, 34, 17, 30, 31, 31,
493 12, 15, 39, 29, 15, 40, 29, 93, 30, 31, 499 29, 54, 54, 54, 17, 30, 31, 31, 39, 35,
494 31, 30, 31, 31, 56, 56, 56, 41, 32, 32, 500 52, 40, 52, 52, 52, 103, 78, 38, 38, 46,
495 42, 88, 43, 45, 45, 45, 46, 45, 47, 47, 501 101, 60, 79, 41, 69, 97, 42, 94, 43, 45,
496 87, 38, 45, 45, 45, 45, 47, 47, 47, 47, 502 45, 45, 46, 45, 47, 47, 93, 92, 45, 45,
497 47, 47, 47, 47, 47, 47, 47, 47, 47, 86, 503 45, 45, 47, 47, 47, 47, 47, 47, 47, 47,
498 47, 34, 33, 50, 85, 47, 47, 47, 47, 53, 504 47, 47, 47, 47, 47, 39, 47, 91, 40, 90,
499 53, 53, 84, 53, 83, 35, 82, 51, 53, 53, 505 99, 47, 47, 47, 47, 54, 54, 54, 89, 88,
500 53, 53, 56, 56, 56, 93, 68, 54, 57, 54, 506 41, 55, 87, 49, 100, 43, 51, 51, 51, 86,
501 54, 54, 56, 56, 56, 62, 46, 34, 71, 81, 507 51, 95, 95, 96, 85, 51, 51, 51, 51, 52,
502 508
503 80, 79, 78, 77, 76, 75, 74, 73, 72, 64, 509 99, 52, 52, 52, 95, 95, 96, 84, 46, 83,
504 62, 35, 33, 33, 33, 33, 33, 33, 33, 33, 510 82, 81, 39, 79, 100, 33, 33, 33, 33, 33,
505 37, 67, 66, 37, 37, 37, 44, 65, 44, 49, 511 33, 33, 33, 37, 80, 77, 37, 37, 37, 44,
506 49, 49, 49, 49, 49, 49, 49, 52, 64, 52, 512 40, 44, 50, 76, 50, 52, 75, 52, 74, 52,
507 54, 62, 54, 60, 54, 54, 55, 93, 55, 55, 513 52, 53, 73, 53, 53, 53, 53, 56, 56, 56,
508 55, 55, 58, 58, 58, 48, 58, 58, 59, 48, 514 72, 56, 56, 57, 71, 57, 57, 59, 59, 59,
509 59, 59, 61, 61, 61, 61, 61, 61, 61, 61, 515 59, 59, 59, 59, 59, 61, 61, 61, 61, 61,
510 63, 63, 63, 63, 63, 63, 63, 63, 69, 93, 516 61, 61, 61, 67, 70, 67, 68, 68, 68, 62,
511 69, 70, 70, 70, 93, 70, 70, 11, 93, 93, 517 68, 68, 98, 98, 98, 98, 98, 98, 98, 98,
512 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 518 60, 66, 65, 64, 63, 62, 60, 58, 103, 48,
513 519
514 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 520 48, 103, 11, 103, 103, 103, 103, 103, 103, 103,
515 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 521 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
516 93, 93, 93 522 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
523 103, 103, 103, 103, 103, 103, 103, 103
517 } ; 524 } ;
518 525
519static yyconst flex_int16_t yy_chk[324] = 526static yyconst flex_int16_t yy_chk[339] =
520 { 0, 527 { 0,
521 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 528 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
522 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 529 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
523 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 530 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
524 1, 1, 1, 1, 1, 3, 15, 3, 13, 13, 531 1, 1, 1, 1, 1, 3, 13, 13, 101, 3,
525 14, 14, 3, 3, 3, 16, 3, 23, 23, 91, 532 3, 3, 3, 15, 3, 14, 14, 32, 32, 3,
526 15, 3, 3, 3, 3, 3, 5, 28, 90, 28, 533 3, 3, 3, 3, 5, 5, 5, 15, 5, 31,
527 28, 28, 23, 5, 5, 5, 28, 5, 89, 16, 534 31, 31, 5, 5, 5, 5, 5, 7, 7, 7,
528 87, 5, 5, 5, 5, 5, 7, 7, 7, 7,
529 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 535 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
530 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 536 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
531
532 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 537 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
533 7, 9, 17, 9, 10, 17, 10, 29, 9, 9, 538
534 9, 10, 10, 10, 31, 31, 31, 17, 32, 32, 539 7, 7, 9, 16, 29, 33, 9, 9, 9, 9,
535 17, 86, 17, 19, 19, 19, 19, 19, 19, 19, 540 10, 54, 54, 54, 10, 10, 10, 10, 17, 33,
536 84, 29, 19, 19, 19, 19, 19, 19, 19, 19, 541 28, 17, 28, 28, 28, 100, 72, 16, 29, 28,
537 19, 19, 19, 19, 19, 19, 20, 20, 20, 83, 542 97, 60, 72, 17, 60, 94, 17, 92, 17, 19,
538 20, 33, 49, 49, 82, 20, 20, 20, 20, 25, 543 19, 19, 19, 19, 19, 19, 91, 88, 19, 19,
539 25, 25, 81, 25, 80, 33, 79, 49, 25, 25, 544 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
540 25, 25, 30, 30, 30, 51, 51, 55, 30, 55, 545 19, 19, 20, 20, 20, 23, 20, 87, 23, 86,
541 55, 55, 56, 56, 56, 62, 55, 68, 62, 78, 546 96, 20, 20, 20, 20, 30, 30, 30, 85, 84,
542 547 23, 30, 83, 23, 96, 23, 25, 25, 25, 82,
543 77, 76, 74, 73, 72, 70, 67, 66, 65, 63, 548 25, 93, 93, 93, 81, 25, 25, 25, 25, 53,
544 61, 68, 94, 94, 94, 94, 94, 94, 94, 94, 549
545 95, 43, 42, 95, 95, 95, 96, 41, 96, 97, 550 98, 53, 53, 53, 95, 95, 95, 80, 53, 79,
546 97, 97, 97, 97, 97, 97, 97, 98, 40, 98, 551 78, 77, 76, 74, 98, 104, 104, 104, 104, 104,
547 99, 39, 99, 38, 99, 99, 100, 35, 100, 100, 552 104, 104, 104, 105, 73, 71, 105, 105, 105, 106,
548 100, 100, 101, 101, 101, 22, 101, 101, 102, 21, 553 70, 106, 107, 69, 107, 108, 68, 108, 66, 108,
549 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 554 108, 109, 65, 109, 109, 109, 109, 110, 110, 110,
550 104, 104, 104, 104, 104, 104, 104, 104, 105, 11, 555 64, 110, 110, 111, 63, 111, 111, 112, 112, 112,
551 105, 106, 106, 106, 0, 106, 106, 93, 93, 93, 556 112, 112, 112, 112, 112, 113, 113, 113, 113, 113,
552 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 557 113, 113, 113, 114, 62, 114, 115, 115, 115, 61,
553 558 115, 115, 116, 116, 116, 116, 116, 116, 116, 116,
554 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 559 59, 49, 43, 42, 41, 40, 39, 38, 35, 22,
555 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 560
556 93, 93, 93 561 21, 11, 103, 103, 103, 103, 103, 103, 103, 103,
562 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
563 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
564 103, 103, 103, 103, 103, 103, 103, 103
557 } ; 565 } ;
558 566
559/* Table of booleans, true if rule could match eol. */ 567/* Table of booleans, true if rule could match eol. */
560static yyconst flex_int32_t yy_rule_can_match_eol[21] = 568static yyconst flex_int32_t yy_rule_can_match_eol[21] =
561 { 0, 569 { 0,
5620, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 5701, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
563 0, }; 571 0, };
564 572
565static yy_state_type yy_last_accepting_state; 573static yy_state_type yy_last_accepting_state;
@@ -600,7 +608,7 @@ char *yytext;
600 608
601 609
602 610
603#line 33 "dtc-lexer.l" 611#line 37 "dtc-lexer.l"
604#include "dtc.h" 612#include "dtc.h"
605#include "srcpos.h" 613#include "srcpos.h"
606#include "dtc-parser.tab.h" 614#include "dtc-parser.tab.h"
@@ -623,7 +631,10 @@ static int dts_version; /* = 0 */
623 DPRINT("<V1>\n"); \ 631 DPRINT("<V1>\n"); \
624 BEGIN(V1); \ 632 BEGIN(V1); \
625 } 633 }
626#line 627 "dtc-lexer.lex.c" 634
635static void push_input_file(const char *filename);
636static int pop_input_file(void);
637#line 638 "dtc-lexer.lex.c"
627 638
628#define INITIAL 0 639#define INITIAL 0
629#define INCLUDE 1 640#define INCLUDE 1
@@ -685,7 +696,7 @@ static int input (void );
685/* This used to be an fputs(), but since the string might contain NUL's, 696/* This used to be an fputs(), but since the string might contain NUL's,
686 * we now use fwrite(). 697 * we now use fwrite().
687 */ 698 */
688#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) 699#define ECHO fwrite( yytext, yyleng, 1, yyout )
689#endif 700#endif
690 701
691/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 702/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -696,7 +707,7 @@ static int input (void );
696 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 707 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
697 { \ 708 { \
698 int c = '*'; \ 709 int c = '*'; \
699 size_t n; \ 710 int n; \
700 for ( n = 0; n < max_size && \ 711 for ( n = 0; n < max_size && \
701 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 712 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
702 buf[n] = (char) c; \ 713 buf[n] = (char) c; \
@@ -778,9 +789,9 @@ YY_DECL
778 register char *yy_cp, *yy_bp; 789 register char *yy_cp, *yy_bp;
779 register int yy_act; 790 register int yy_act;
780 791
781#line 57 "dtc-lexer.l" 792#line 64 "dtc-lexer.l"
782 793
783#line 784 "dtc-lexer.lex.c" 794#line 795 "dtc-lexer.lex.c"
784 795
785 if ( !(yy_init) ) 796 if ( !(yy_init) )
786 { 797 {
@@ -833,13 +844,13 @@ yy_match:
833 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 844 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
834 { 845 {
835 yy_current_state = (int) yy_def[yy_current_state]; 846 yy_current_state = (int) yy_def[yy_current_state];
836 if ( yy_current_state >= 94 ) 847 if ( yy_current_state >= 104 )
837 yy_c = yy_meta[(unsigned int) yy_c]; 848 yy_c = yy_meta[(unsigned int) yy_c];
838 } 849 }
839 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 850 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
840 ++yy_cp; 851 ++yy_cp;
841 } 852 }
842 while ( yy_base[yy_current_state] != 288 ); 853 while ( yy_base[yy_current_state] != 303 );
843 854
844yy_find_action: 855yy_find_action:
845 yy_act = yy_accept[yy_current_state]; 856 yy_act = yy_accept[yy_current_state];
@@ -874,20 +885,13 @@ do_action: /* This label is used only to access EOF actions. */
874 goto yy_find_action; 885 goto yy_find_action;
875 886
876case 1: 887case 1:
888/* rule 1 can match eol */
877YY_RULE_SETUP 889YY_RULE_SETUP
878#line 58 "dtc-lexer.l" 890#line 65 "dtc-lexer.l"
879BEGIN(INCLUDE);
880 YY_BREAK
881case 2:
882YY_RULE_SETUP
883#line 60 "dtc-lexer.l"
884{ 891{
885 yytext[strlen(yytext) - 1] = 0; 892 char *name = strchr(yytext, '\"') + 1;
886 if (!push_input_file(yytext + 1)) { 893 yytext[yyleng-1] = '\0';
887 /* Some unrecoverable error.*/ 894 push_input_file(name);
888 exit(1);
889 }
890 BEGIN_DEFAULT();
891 } 895 }
892 YY_BREAK 896 YY_BREAK
893case YY_STATE_EOF(INITIAL): 897case YY_STATE_EOF(INITIAL):
@@ -895,19 +899,19 @@ case YY_STATE_EOF(INCLUDE):
895case YY_STATE_EOF(BYTESTRING): 899case YY_STATE_EOF(BYTESTRING):
896case YY_STATE_EOF(PROPNODENAME): 900case YY_STATE_EOF(PROPNODENAME):
897case YY_STATE_EOF(V1): 901case YY_STATE_EOF(V1):
898#line 70 "dtc-lexer.l" 902#line 71 "dtc-lexer.l"
899{ 903{
900 if (!pop_input_file()) { 904 if (!pop_input_file()) {
901 yyterminate(); 905 yyterminate();
902 } 906 }
903 } 907 }
904 YY_BREAK 908 YY_BREAK
905case 3: 909case 2:
906/* rule 3 can match eol */ 910/* rule 2 can match eol */
907YY_RULE_SETUP 911YY_RULE_SETUP
908#line 76 "dtc-lexer.l" 912#line 77 "dtc-lexer.l"
909{ 913{
910 yylloc.filenum = srcpos_filenum; 914 yylloc.file = srcpos_file;
911 yylloc.first_line = yylineno; 915 yylloc.first_line = yylineno;
912 DPRINT("String: %s\n", yytext); 916 DPRINT("String: %s\n", yytext);
913 yylval.data = data_copy_escape_string(yytext+1, 917 yylval.data = data_copy_escape_string(yytext+1,
@@ -916,11 +920,11 @@ YY_RULE_SETUP
916 return DT_STRING; 920 return DT_STRING;
917 } 921 }
918 YY_BREAK 922 YY_BREAK
919case 4: 923case 3:
920YY_RULE_SETUP 924YY_RULE_SETUP
921#line 86 "dtc-lexer.l" 925#line 87 "dtc-lexer.l"
922{ 926{
923 yylloc.filenum = srcpos_filenum; 927 yylloc.file = srcpos_file;
924 yylloc.first_line = yylineno; 928 yylloc.first_line = yylineno;
925 DPRINT("Keyword: /dts-v1/\n"); 929 DPRINT("Keyword: /dts-v1/\n");
926 dts_version = 1; 930 dts_version = 1;
@@ -928,22 +932,22 @@ YY_RULE_SETUP
928 return DT_V1; 932 return DT_V1;
929 } 933 }
930 YY_BREAK 934 YY_BREAK
931case 5: 935case 4:
932YY_RULE_SETUP 936YY_RULE_SETUP
933#line 95 "dtc-lexer.l" 937#line 96 "dtc-lexer.l"
934{ 938{
935 yylloc.filenum = srcpos_filenum; 939 yylloc.file = srcpos_file;
936 yylloc.first_line = yylineno; 940 yylloc.first_line = yylineno;
937 DPRINT("Keyword: /memreserve/\n"); 941 DPRINT("Keyword: /memreserve/\n");
938 BEGIN_DEFAULT(); 942 BEGIN_DEFAULT();
939 return DT_MEMRESERVE; 943 return DT_MEMRESERVE;
940 } 944 }
941 YY_BREAK 945 YY_BREAK
942case 6: 946case 5:
943YY_RULE_SETUP 947YY_RULE_SETUP
944#line 103 "dtc-lexer.l" 948#line 104 "dtc-lexer.l"
945{ 949{
946 yylloc.filenum = srcpos_filenum; 950 yylloc.file = srcpos_file;
947 yylloc.first_line = yylineno; 951 yylloc.first_line = yylineno;
948 DPRINT("Label: %s\n", yytext); 952 DPRINT("Label: %s\n", yytext);
949 yylval.labelref = strdup(yytext); 953 yylval.labelref = strdup(yytext);
@@ -951,11 +955,11 @@ YY_RULE_SETUP
951 return DT_LABEL; 955 return DT_LABEL;
952 } 956 }
953 YY_BREAK 957 YY_BREAK
954case 7: 958case 6:
955YY_RULE_SETUP 959YY_RULE_SETUP
956#line 112 "dtc-lexer.l" 960#line 113 "dtc-lexer.l"
957{ 961{
958 yylloc.filenum = srcpos_filenum; 962 yylloc.file = srcpos_file;
959 yylloc.first_line = yylineno; 963 yylloc.first_line = yylineno;
960 if (*yytext == 'b') 964 if (*yytext == 'b')
961 yylval.cbase = 2; 965 yylval.cbase = 2;
@@ -969,44 +973,44 @@ YY_RULE_SETUP
969 return DT_BASE; 973 return DT_BASE;
970 } 974 }
971 YY_BREAK 975 YY_BREAK
972case 8: 976case 7:
973YY_RULE_SETUP 977YY_RULE_SETUP
974#line 127 "dtc-lexer.l" 978#line 128 "dtc-lexer.l"
975{ 979{
976 yylloc.filenum = srcpos_filenum; 980 yylloc.file = srcpos_file;
977 yylloc.first_line = yylineno; 981 yylloc.first_line = yylineno;
978 yylval.literal = strdup(yytext); 982 yylval.literal = strdup(yytext);
979 DPRINT("Literal: '%s'\n", yylval.literal); 983 DPRINT("Literal: '%s'\n", yylval.literal);
980 return DT_LEGACYLITERAL; 984 return DT_LEGACYLITERAL;
981 } 985 }
982 YY_BREAK 986 YY_BREAK
983case 9: 987case 8:
984YY_RULE_SETUP 988YY_RULE_SETUP
985#line 135 "dtc-lexer.l" 989#line 136 "dtc-lexer.l"
986{ 990{
987 yylloc.filenum = srcpos_filenum; 991 yylloc.file = srcpos_file;
988 yylloc.first_line = yylineno; 992 yylloc.first_line = yylineno;
989 yylval.literal = strdup(yytext); 993 yylval.literal = strdup(yytext);
990 DPRINT("Literal: '%s'\n", yylval.literal); 994 DPRINT("Literal: '%s'\n", yylval.literal);
991 return DT_LITERAL; 995 return DT_LITERAL;
992 } 996 }
993 YY_BREAK 997 YY_BREAK
994case 10: 998case 9:
995YY_RULE_SETUP 999YY_RULE_SETUP
996#line 143 "dtc-lexer.l" 1000#line 144 "dtc-lexer.l"
997{ /* label reference */ 1001{ /* label reference */
998 yylloc.filenum = srcpos_filenum; 1002 yylloc.file = srcpos_file;
999 yylloc.first_line = yylineno; 1003 yylloc.first_line = yylineno;
1000 DPRINT("Ref: %s\n", yytext+1); 1004 DPRINT("Ref: %s\n", yytext+1);
1001 yylval.labelref = strdup(yytext+1); 1005 yylval.labelref = strdup(yytext+1);
1002 return DT_REF; 1006 return DT_REF;
1003 } 1007 }
1004 YY_BREAK 1008 YY_BREAK
1005case 11: 1009case 10:
1006YY_RULE_SETUP 1010YY_RULE_SETUP
1007#line 151 "dtc-lexer.l" 1011#line 152 "dtc-lexer.l"
1008{ /* new-style path reference */ 1012{ /* new-style path reference */
1009 yylloc.filenum = srcpos_filenum; 1013 yylloc.file = srcpos_file;
1010 yylloc.first_line = yylineno; 1014 yylloc.first_line = yylineno;
1011 yytext[yyleng-1] = '\0'; 1015 yytext[yyleng-1] = '\0';
1012 DPRINT("Ref: %s\n", yytext+2); 1016 DPRINT("Ref: %s\n", yytext+2);
@@ -1014,44 +1018,44 @@ YY_RULE_SETUP
1014 return DT_REF; 1018 return DT_REF;
1015 } 1019 }
1016 YY_BREAK 1020 YY_BREAK
1017case 12: 1021case 11:
1018YY_RULE_SETUP 1022YY_RULE_SETUP
1019#line 160 "dtc-lexer.l" 1023#line 161 "dtc-lexer.l"
1020{ /* old-style path reference */ 1024{ /* old-style path reference */
1021 yylloc.filenum = srcpos_filenum; 1025 yylloc.file = srcpos_file;
1022 yylloc.first_line = yylineno; 1026 yylloc.first_line = yylineno;
1023 DPRINT("Ref: %s\n", yytext+1); 1027 DPRINT("Ref: %s\n", yytext+1);
1024 yylval.labelref = strdup(yytext+1); 1028 yylval.labelref = strdup(yytext+1);
1025 return DT_REF; 1029 return DT_REF;
1026 } 1030 }
1027 YY_BREAK 1031 YY_BREAK
1028case 13: 1032case 12:
1029YY_RULE_SETUP 1033YY_RULE_SETUP
1030#line 168 "dtc-lexer.l" 1034#line 169 "dtc-lexer.l"
1031{ 1035{
1032 yylloc.filenum = srcpos_filenum; 1036 yylloc.file = srcpos_file;
1033 yylloc.first_line = yylineno; 1037 yylloc.first_line = yylineno;
1034 yylval.byte = strtol(yytext, NULL, 16); 1038 yylval.byte = strtol(yytext, NULL, 16);
1035 DPRINT("Byte: %02x\n", (int)yylval.byte); 1039 DPRINT("Byte: %02x\n", (int)yylval.byte);
1036 return DT_BYTE; 1040 return DT_BYTE;
1037 } 1041 }
1038 YY_BREAK 1042 YY_BREAK
1039case 14: 1043case 13:
1040YY_RULE_SETUP 1044YY_RULE_SETUP
1041#line 176 "dtc-lexer.l" 1045#line 177 "dtc-lexer.l"
1042{ 1046{
1043 yylloc.filenum = srcpos_filenum; 1047 yylloc.file = srcpos_file;
1044 yylloc.first_line = yylineno; 1048 yylloc.first_line = yylineno;
1045 DPRINT("/BYTESTRING\n"); 1049 DPRINT("/BYTESTRING\n");
1046 BEGIN_DEFAULT(); 1050 BEGIN_DEFAULT();
1047 return ']'; 1051 return ']';
1048 } 1052 }
1049 YY_BREAK 1053 YY_BREAK
1050case 15: 1054case 14:
1051YY_RULE_SETUP 1055YY_RULE_SETUP
1052#line 184 "dtc-lexer.l" 1056#line 185 "dtc-lexer.l"
1053{ 1057{
1054 yylloc.filenum = srcpos_filenum; 1058 yylloc.file = srcpos_file;
1055 yylloc.first_line = yylineno; 1059 yylloc.first_line = yylineno;
1056 DPRINT("PropNodeName: %s\n", yytext); 1060 DPRINT("PropNodeName: %s\n", yytext);
1057 yylval.propnodename = strdup(yytext); 1061 yylval.propnodename = strdup(yytext);
@@ -1059,34 +1063,39 @@ YY_RULE_SETUP
1059 return DT_PROPNODENAME; 1063 return DT_PROPNODENAME;
1060 } 1064 }
1061 YY_BREAK 1065 YY_BREAK
1066case 15:
1067YY_RULE_SETUP
1068#line 194 "dtc-lexer.l"
1069{
1070 yylloc.file = srcpos_file;
1071 yylloc.first_line = yylineno;
1072 DPRINT("Binary Include\n");
1073 return DT_INCBIN;
1074 }
1075 YY_BREAK
1062case 16: 1076case 16:
1063/* rule 16 can match eol */ 1077/* rule 16 can match eol */
1064YY_RULE_SETUP 1078YY_RULE_SETUP
1065#line 194 "dtc-lexer.l" 1079#line 201 "dtc-lexer.l"
1066/* eat whitespace */ 1080/* eat whitespace */
1067 YY_BREAK 1081 YY_BREAK
1068case 17: 1082case 17:
1069/* rule 17 can match eol */ 1083/* rule 17 can match eol */
1070YY_RULE_SETUP 1084YY_RULE_SETUP
1071#line 196 "dtc-lexer.l" 1085#line 202 "dtc-lexer.l"
1072{ 1086/* eat C-style comments */
1073 yylloc.filenum = srcpos_filenum;
1074 yylloc.first_line = yylineno;
1075 DPRINT("Comment: %s\n", yytext);
1076 /* eat comments */
1077 }
1078 YY_BREAK 1087 YY_BREAK
1079case 18: 1088case 18:
1080/* rule 18 can match eol */ 1089/* rule 18 can match eol */
1081YY_RULE_SETUP 1090YY_RULE_SETUP
1082#line 203 "dtc-lexer.l" 1091#line 203 "dtc-lexer.l"
1083/* eat line comments */ 1092/* eat C++-style comments */
1084 YY_BREAK 1093 YY_BREAK
1085case 19: 1094case 19:
1086YY_RULE_SETUP 1095YY_RULE_SETUP
1087#line 205 "dtc-lexer.l" 1096#line 205 "dtc-lexer.l"
1088{ 1097{
1089 yylloc.filenum = srcpos_filenum; 1098 yylloc.file = srcpos_file;
1090 yylloc.first_line = yylineno; 1099 yylloc.first_line = yylineno;
1091 DPRINT("Char: %c (\\x%02x)\n", yytext[0], 1100 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1092 (unsigned)yytext[0]); 1101 (unsigned)yytext[0]);
@@ -1107,7 +1116,7 @@ YY_RULE_SETUP
1107#line 222 "dtc-lexer.l" 1116#line 222 "dtc-lexer.l"
1108ECHO; 1117ECHO;
1109 YY_BREAK 1118 YY_BREAK
1110#line 1111 "dtc-lexer.lex.c" 1119#line 1120 "dtc-lexer.lex.c"
1111 1120
1112 case YY_END_OF_BUFFER: 1121 case YY_END_OF_BUFFER:
1113 { 1122 {
@@ -1360,6 +1369,14 @@ static int yy_get_next_buffer (void)
1360 else 1369 else
1361 ret_val = EOB_ACT_CONTINUE_SCAN; 1370 ret_val = EOB_ACT_CONTINUE_SCAN;
1362 1371
1372 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1373 /* Extend the array by 50%, plus the number we really need. */
1374 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1375 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1376 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1377 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1378 }
1379
1363 (yy_n_chars) += number_to_move; 1380 (yy_n_chars) += number_to_move;
1364 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1381 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1365 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1382 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1389,7 +1406,7 @@ static int yy_get_next_buffer (void)
1389 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1406 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1390 { 1407 {
1391 yy_current_state = (int) yy_def[yy_current_state]; 1408 yy_current_state = (int) yy_def[yy_current_state];
1392 if ( yy_current_state >= 94 ) 1409 if ( yy_current_state >= 104 )
1393 yy_c = yy_meta[(unsigned int) yy_c]; 1410 yy_c = yy_meta[(unsigned int) yy_c];
1394 } 1411 }
1395 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1412 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1417,11 +1434,11 @@ static int yy_get_next_buffer (void)
1417 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1434 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1418 { 1435 {
1419 yy_current_state = (int) yy_def[yy_current_state]; 1436 yy_current_state = (int) yy_def[yy_current_state];
1420 if ( yy_current_state >= 94 ) 1437 if ( yy_current_state >= 104 )
1421 yy_c = yy_meta[(unsigned int) yy_c]; 1438 yy_c = yy_meta[(unsigned int) yy_c];
1422 } 1439 }
1423 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1440 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1424 yy_is_jam = (yy_current_state == 93); 1441 yy_is_jam = (yy_current_state == 103);
1425 1442
1426 return yy_is_jam ? 0 : yy_current_state; 1443 return yy_is_jam ? 0 : yy_current_state;
1427} 1444}
@@ -1743,7 +1760,9 @@ static void yyensure_buffer_stack (void)
1743 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1760 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1744 (num_to_alloc * sizeof(struct yy_buffer_state*) 1761 (num_to_alloc * sizeof(struct yy_buffer_state*)
1745 ); 1762 );
1746 1763 if ( ! (yy_buffer_stack) )
1764 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1765
1747 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1766 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1748 1767
1749 (yy_buffer_stack_max) = num_to_alloc; 1768 (yy_buffer_stack_max) = num_to_alloc;
@@ -1761,6 +1780,8 @@ static void yyensure_buffer_stack (void)
1761 ((yy_buffer_stack), 1780 ((yy_buffer_stack),
1762 num_to_alloc * sizeof(struct yy_buffer_state*) 1781 num_to_alloc * sizeof(struct yy_buffer_state*)
1763 ); 1782 );
1783 if ( ! (yy_buffer_stack) )
1784 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1764 1785
1765 /* zero only the new slots.*/ 1786 /* zero only the new slots.*/
1766 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1787 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -2072,14 +2093,13 @@ void yyfree (void * ptr )
2072 */ 2093 */
2073 2094
2074struct incl_file { 2095struct incl_file {
2075 int filenum; 2096 struct dtc_file *file;
2076 FILE *file;
2077 YY_BUFFER_STATE yy_prev_buf; 2097 YY_BUFFER_STATE yy_prev_buf;
2078 int yy_prev_lineno; 2098 int yy_prev_lineno;
2079 struct incl_file *prev; 2099 struct incl_file *prev;
2080}; 2100};
2081 2101
2082struct incl_file *incl_file_stack; 2102static struct incl_file *incl_file_stack;
2083 2103
2084 2104
2085/* 2105/*
@@ -2090,36 +2110,34 @@ struct incl_file *incl_file_stack;
2090static int incl_depth = 0; 2110static int incl_depth = 0;
2091 2111
2092 2112
2093int push_input_file(const char *filename) 2113static void push_input_file(const char *filename)
2094{ 2114{
2095 FILE *f;
2096 struct incl_file *incl_file; 2115 struct incl_file *incl_file;
2116 struct dtc_file *newfile;
2117 struct search_path search, *searchptr = NULL;
2097 2118
2098 if (!filename) { 2119 assert(filename);
2099 yyerror("No include file name given.");
2100 return 0;
2101 }
2102 2120
2103 if (incl_depth++ >= MAX_INCLUDE_DEPTH) { 2121 if (incl_depth++ >= MAX_INCLUDE_DEPTH)
2104 yyerror("Includes nested too deeply"); 2122 die("Includes nested too deeply");
2105 return 0; 2123
2124 if (srcpos_file) {
2125 search.dir = srcpos_file->dir;
2126 search.next = NULL;
2127 search.prev = NULL;
2128 searchptr = &search;
2106 } 2129 }
2107 2130
2108 f = dtc_open_file(filename); 2131 newfile = dtc_open_file(filename, searchptr);
2109 2132
2110 incl_file = malloc(sizeof(struct incl_file)); 2133 incl_file = xmalloc(sizeof(struct incl_file));
2111 if (!incl_file) {
2112 yyerror("Can not allocate include file space.");
2113 return 0;
2114 }
2115 2134
2116 /* 2135 /*
2117 * Save current context. 2136 * Save current context.
2118 */ 2137 */
2119 incl_file->yy_prev_buf = YY_CURRENT_BUFFER; 2138 incl_file->yy_prev_buf = YY_CURRENT_BUFFER;
2120 incl_file->yy_prev_lineno = yylineno; 2139 incl_file->yy_prev_lineno = yylineno;
2121 incl_file->filenum = srcpos_filenum; 2140 incl_file->file = srcpos_file;
2122 incl_file->file = yyin;
2123 incl_file->prev = incl_file_stack; 2141 incl_file->prev = incl_file_stack;
2124 2142
2125 incl_file_stack = incl_file; 2143 incl_file_stack = incl_file;
@@ -2127,23 +2145,21 @@ int push_input_file(const char *filename)
2127 /* 2145 /*
2128 * Establish new context. 2146 * Establish new context.
2129 */ 2147 */
2130 srcpos_filenum = lookup_file_name(filename, 0); 2148 srcpos_file = newfile;
2131 yylineno = 1; 2149 yylineno = 1;
2132 yyin = f; 2150 yyin = newfile->file;
2133 yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); 2151 yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
2134
2135 return 1;
2136} 2152}
2137 2153
2138 2154
2139int pop_input_file(void) 2155static int pop_input_file(void)
2140{ 2156{
2141 struct incl_file *incl_file; 2157 struct incl_file *incl_file;
2142 2158
2143 if (incl_file_stack == 0) 2159 if (incl_file_stack == 0)
2144 return 0; 2160 return 0;
2145 2161
2146 fclose(yyin); 2162 dtc_close_file(srcpos_file);
2147 2163
2148 /* 2164 /*
2149 * Pop. 2165 * Pop.
@@ -2158,17 +2174,14 @@ int pop_input_file(void)
2158 yy_delete_buffer(YY_CURRENT_BUFFER); 2174 yy_delete_buffer(YY_CURRENT_BUFFER);
2159 yy_switch_to_buffer(incl_file->yy_prev_buf); 2175 yy_switch_to_buffer(incl_file->yy_prev_buf);
2160 yylineno = incl_file->yy_prev_lineno; 2176 yylineno = incl_file->yy_prev_lineno;
2161 srcpos_filenum = incl_file->filenum; 2177 srcpos_file = incl_file->file;
2162 yyin = incl_file->file; 2178 yyin = incl_file->file ? incl_file->file->file : NULL;
2163 2179
2164 /* 2180 /*
2165 * Free old state. 2181 * Free old state.
2166 */ 2182 */
2167 free(incl_file); 2183 free(incl_file);
2168 2184
2169 if (YY_CURRENT_BUFFER == 0)
2170 return 0;
2171
2172 return 1; 2185 return 1;
2173} 2186}
2174 2187