aboutsummaryrefslogtreecommitdiff
path: root/source/compiler/dtio.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-04-20 23:39:48 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-04-20 23:39:48 +0000
commitb43c4dd5abdb09fe2e7f73f186586b962c9dc9f5 (patch)
tree79677aa8d9d6e5b97246264fe36dcad25ae471a1 /source/compiler/dtio.c
parent9fd6e3caab6c4754f50b66bcc8bdbf7ef8397f74 (diff)
downloadsrc-b43c4dd5abdb09fe2e7f73f186586b962c9dc9f5.tar.gz
src-b43c4dd5abdb09fe2e7f73f186586b962c9dc9f5.zip
Notes
Diffstat (limited to 'source/compiler/dtio.c')
-rw-r--r--source/compiler/dtio.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c
index 14accfe103e7..6357bfbacdda 100644
--- a/source/compiler/dtio.c
+++ b/source/compiler/dtio.c
@@ -89,6 +89,7 @@ DtDumpBuffer (
#define DT_SLASH_SLASH_COMMENT 4
#define DT_END_COMMENT 5
#define DT_MERGE_LINES 6
+#define DT_ESCAPE_SEQUENCE 7
static UINT32 Gbl_NextLineOffset;
@@ -412,6 +413,7 @@ DtGetNextLine (
BOOLEAN LineNotAllBlanks = FALSE;
UINT32 State = DT_NORMAL_TEXT;
UINT32 CurrentLineOffset;
+ UINT32 BeyondBufferCount;
UINT32 i;
char c;
@@ -503,12 +505,36 @@ DtGetNextLine (
Gbl_CurrentLineBuffer[i] = c;
i++;
- if (c == '"')
+ switch (c)
{
+ case '"':
+ State = DT_NORMAL_TEXT;
+ break;
+
+ case '\\':
+ State = DT_ESCAPE_SEQUENCE;
+ break;
+
+ case '\n':
+ AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n",
+ Gbl_CurrentLineNumber++);
State = DT_NORMAL_TEXT;
+ break;
+
+ default: /* Get next character */
+ break;
}
break;
+ case DT_ESCAPE_SEQUENCE:
+
+ /* Just copy the escaped character. TBD: sufficient for table compiler? */
+
+ Gbl_CurrentLineBuffer[i] = c;
+ i++;
+ State = DT_START_QUOTED_STRING;
+ break;
+
case DT_START_COMMENT:
/* Open comment if this character is an asterisk or slash */
@@ -629,7 +655,19 @@ DtGetNextLine (
}
}
- printf ("ERROR - Input line is too long (max %u)\n", ASL_LINE_BUFFER_SIZE);
+ /* Line is too long for internal buffer. Determine actual length */
+
+ BeyondBufferCount = 1;
+ c = (char) getc (Handle);
+ while (c != '\n')
+ {
+ c = (char) getc (Handle);
+ BeyondBufferCount++;
+ }
+
+ printf ("ERROR - At %u: Input line (%u bytes) is too long (max %u)\n",
+ Gbl_CurrentLineNumber++, ASL_LINE_BUFFER_SIZE + BeyondBufferCount,
+ ASL_LINE_BUFFER_SIZE);
return (ASL_EOF);
}