Deleted Added
full compact
dtio.c (217365) dtio.c (218590)
1/******************************************************************************
2 *
3 * Module Name: dtio.c - File I/O support for data table compiler
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2011, Intel Corp.

--- 52 unchanged lines hidden (view full) ---

61 DT_FIELD *Field);
62
63static ACPI_STATUS
64DtParseLine (
65 char *LineBuffer,
66 UINT32 Line,
67 UINT32 Offset);
68
1/******************************************************************************
2 *
3 * Module Name: dtio.c - File I/O support for data table compiler
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2011, Intel Corp.

--- 52 unchanged lines hidden (view full) ---

61 DT_FIELD *Field);
62
63static ACPI_STATUS
64DtParseLine (
65 char *LineBuffer,
66 UINT32 Line,
67 UINT32 Offset);
68
69static UINT32
69UINT32
70DtGetNextLine (
71 FILE *Handle);
72
73static void
74DtWriteBinary (
75 DT_SUBTABLE *Subtable,
76 void *Context,
77 void *ReturnValue);
78
79static void
80DtDumpBuffer (
81 UINT32 FileId,
82 UINT8 *Buffer,
70DtGetNextLine (
71 FILE *Handle);
72
73static void
74DtWriteBinary (
75 DT_SUBTABLE *Subtable,
76 void *Context,
77 void *ReturnValue);
78
79static void
80DtDumpBuffer (
81 UINT32 FileId,
82 UINT8 *Buffer,
83 UINT32 Offset,
83 UINT32 Length);
84
84 UINT32 Length);
85
86
85/* States for DtGetNextLine */
86
87#define DT_NORMAL_TEXT 0
88#define DT_START_QUOTED_STRING 1
89#define DT_START_COMMENT 2
90#define DT_SLASH_ASTERISK_COMMENT 3
91#define DT_SLASH_SLASH_COMMENT 4
92#define DT_END_COMMENT 5

--- 226 unchanged lines hidden (view full) ---

319
320 while (*End)
321 {
322 /* Found left quotation, go to the right quotation and break */
323
324 if (*End == '"')
325 {
326 End++;
87/* States for DtGetNextLine */
88
89#define DT_NORMAL_TEXT 0
90#define DT_START_QUOTED_STRING 1
91#define DT_START_COMMENT 2
92#define DT_SLASH_ASTERISK_COMMENT 3
93#define DT_SLASH_SLASH_COMMENT 4
94#define DT_END_COMMENT 5

--- 226 unchanged lines hidden (view full) ---

321
322 while (*End)
323 {
324 /* Found left quotation, go to the right quotation and break */
325
326 if (*End == '"')
327 {
328 End++;
327 while (*End && *End != '"')
329 while (*End && (*End != '"'))
328 {
329 End++;
330 }
331
332 End++;
333 break;
334 }
335
330 {
331 End++;
332 }
333
334 End++;
335 break;
336 }
337
338 /*
339 * Special "comment" fields at line end, ignore them.
340 * Note: normal slash-slash and slash-asterisk comments are
341 * stripped already by the DtGetNextLine parser.
342 *
343 * TBD: Perhaps DtGetNextLine should parse the following type
344 * of comments also.
345 */
336 if (*End == '(' ||
346 if (*End == '(' ||
337 *End == '<' ||
338 *End == '/')
347 *End == '<')
339 {
340 break;
341 }
342
343 End++;
344 }
345
346 Length = ACPI_PTR_DIFF (End, Start);

--- 33 unchanged lines hidden (view full) ---

380 * Handles both slash-asterisk and slash-slash comments.
381 * Also, quoted strings, but no escapes within.
382 *
383 * Line is returned in Gbl_CurrentLineBuffer.
384 * Line number in original file is returned in Gbl_CurrentLineNumber.
385 *
386 *****************************************************************************/
387
348 {
349 break;
350 }
351
352 End++;
353 }
354
355 Length = ACPI_PTR_DIFF (End, Start);

--- 33 unchanged lines hidden (view full) ---

389 * Handles both slash-asterisk and slash-slash comments.
390 * Also, quoted strings, but no escapes within.
391 *
392 * Line is returned in Gbl_CurrentLineBuffer.
393 * Line number in original file is returned in Gbl_CurrentLineNumber.
394 *
395 *****************************************************************************/
396
388static UINT32
397UINT32
389DtGetNextLine (
390 FILE *Handle)
391{
392 UINT32 State = DT_NORMAL_TEXT;
393 UINT32 CurrentLineOffset;
394 UINT32 i;
395 char c;
396
397
398 for (i = 0; i < ASL_LINE_BUFFER_SIZE;)
399 {
400 c = (char) getc (Handle);
401 if (c == EOF)
402 {
398DtGetNextLine (
399 FILE *Handle)
400{
401 UINT32 State = DT_NORMAL_TEXT;
402 UINT32 CurrentLineOffset;
403 UINT32 i;
404 char c;
405
406
407 for (i = 0; i < ASL_LINE_BUFFER_SIZE;)
408 {
409 c = (char) getc (Handle);
410 if (c == EOF)
411 {
412 switch (State)
413 {
414 case DT_START_QUOTED_STRING:
415 case DT_SLASH_ASTERISK_COMMENT:
416 case DT_SLASH_SLASH_COMMENT:
417
418 AcpiOsPrintf ("**** EOF within comment/string %u\n", State);
419 break;
420
421 default:
422 break;
423 }
424
403 return (0);
404 }
405
406 switch (State)
407 {
408 case DT_NORMAL_TEXT:
409
410 /* Normal text, insert char into line buffer */

--- 104 unchanged lines hidden (view full) ---

515 /* End comment if this char is a slash */
516
517 switch (c)
518 {
519 case '/':
520 State = DT_NORMAL_TEXT;
521 break;
522
425 return (0);
426 }
427
428 switch (State)
429 {
430 case DT_NORMAL_TEXT:
431
432 /* Normal text, insert char into line buffer */

--- 104 unchanged lines hidden (view full) ---

537 /* End comment if this char is a slash */
538
539 switch (c)
540 {
541 case '/':
542 State = DT_NORMAL_TEXT;
543 break;
544
545 case '\n':
546 CurrentLineOffset = Gbl_NextLineOffset;
547 Gbl_NextLineOffset = (UINT32) ftell (Handle);
548 Gbl_CurrentLineNumber++;
549 break;
550
551 case '*':
552 /* Consume all adjacent asterisks */
553 break;
554
523 default:
524 State = DT_SLASH_ASTERISK_COMMENT;
525 break;
526 }
527 break;
528
529 default:
530 DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, "Unknown input state");

--- 117 unchanged lines hidden (view full) ---

648 */
649
650/******************************************************************************
651 *
652 * FUNCTION: DtDumpBuffer
653 *
654 * PARAMETERS: FileID - Where to write buffer data
655 * Buffer - Buffer to dump
555 default:
556 State = DT_SLASH_ASTERISK_COMMENT;
557 break;
558 }
559 break;
560
561 default:
562 DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, "Unknown input state");

--- 117 unchanged lines hidden (view full) ---

680 */
681
682/******************************************************************************
683 *
684 * FUNCTION: DtDumpBuffer
685 *
686 * PARAMETERS: FileID - Where to write buffer data
687 * Buffer - Buffer to dump
688 * Offset - Offset in current table
656 * Length - Buffer Length
657 *
658 * RETURN: None
659 *
660 * DESCRIPTION: Another copy of DumpBuffer routine (unfortunately).
661 *
662 * TBD: merge dump buffer routines
663 *
664 *****************************************************************************/
665
666static void
667DtDumpBuffer (
668 UINT32 FileId,
669 UINT8 *Buffer,
689 * Length - Buffer Length
690 *
691 * RETURN: None
692 *
693 * DESCRIPTION: Another copy of DumpBuffer routine (unfortunately).
694 *
695 * TBD: merge dump buffer routines
696 *
697 *****************************************************************************/
698
699static void
700DtDumpBuffer (
701 UINT32 FileId,
702 UINT8 *Buffer,
703 UINT32 Offset,
670 UINT32 Length)
671{
672 UINT32 i;
673 UINT32 j;
674 UINT8 BufChar;
675
676
704 UINT32 Length)
705{
706 UINT32 i;
707 UINT32 j;
708 UINT8 BufChar;
709
710
711 FlPrintFile (FileId, "Output: [%3.3Xh %4.4d% 3d] ",
712 Offset, Offset, Length);
713
677 i = 0;
678 while (i < Length)
679 {
714 i = 0;
715 while (i < Length)
716 {
717 if (i >= 16)
718 {
719 FlPrintFile (FileId, "%23s", "");
720 }
721
680 /* Print 16 hex chars */
681
722 /* Print 16 hex chars */
723
682 FlPrintFile (FileId, "Output: [%.3d] ", Length);
683
684 for (j = 0; j < 16;)
685 {
686 if (i + j >= Length)
687 {
688 /* Dump fill spaces */
689
690 FlPrintFile (FileId, " ");
691 j++;

--- 76 unchanged lines hidden (view full) ---

768 }
769 }
770
771 /* Dump the line as parsed and represented internally */
772
773 FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %s\n",
774 Field->Column-4, Field->Name, Field->Value);
775
724 for (j = 0; j < 16;)
725 {
726 if (i + j >= Length)
727 {
728 /* Dump fill spaces */
729
730 FlPrintFile (FileId, " ");
731 j++;

--- 76 unchanged lines hidden (view full) ---

808 }
809 }
810
811 /* Dump the line as parsed and represented internally */
812
813 FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %s\n",
814 Field->Column-4, Field->Name, Field->Value);
815
776#if 0
777 /* TBD Dump the length and AML offset */
778
779 FlPrintFile (ASL_FILE_LISTING_OUTPUT,
780 "Output: Length %d(0x%X) Offset %d(0x%X)\n",
781 Field->Column-4, Field->Name, Field->Value);
782#endif
783
784 /* Dump the hex data that will be output for this field */
785
816 /* Dump the hex data that will be output for this field */
817
786 DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Length);
818 DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Field->TableOffset, Length);
787}
788
789
790/******************************************************************************
791 *
792 * FUNCTION: DtWriteTableToListing
793 *
794 * PARAMETERS: None

--- 36 unchanged lines hidden ---
819}
820
821
822/******************************************************************************
823 *
824 * FUNCTION: DtWriteTableToListing
825 *
826 * PARAMETERS: None

--- 36 unchanged lines hidden ---