diff options
Diffstat (limited to 'source/compiler/dtio.c')
-rw-r--r-- | source/compiler/dtio.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index 7876552..c26b2b8 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -426,7 +426,7 @@ DtGetNextLine ( UINT32 State = DT_NORMAL_TEXT; UINT32 CurrentLineOffset; UINT32 i; - char c; + int c; for (i = 0; ;) @@ -440,7 +440,7 @@ DtGetNextLine ( UtExpandLineBuffers (); } - c = (char) getc (Handle); + c = getc (Handle); if (c == EOF) { switch (State) @@ -452,6 +452,7 @@ DtGetNextLine ( break; default: + break; } @@ -479,14 +480,16 @@ DtGetNextLine ( /* Normal text, insert char into line buffer */ - Gbl_CurrentLineBuffer[i] = c; + Gbl_CurrentLineBuffer[i] = (char) c; switch (c) { case '/': + State = DT_START_COMMENT; break; case '"': + State = DT_START_QUOTED_STRING; LineNotAllBlanks = TRUE; i++; @@ -501,6 +504,7 @@ DtGetNextLine ( break; case '\n': + CurrentLineOffset = Gbl_NextLineOffset; Gbl_NextLineOffset = (UINT32) ftell (Handle); Gbl_CurrentLineNumber++; @@ -527,6 +531,7 @@ DtGetNextLine ( break; default: + if (c != ' ') { LineNotAllBlanks = TRUE; @@ -541,26 +546,30 @@ DtGetNextLine ( /* Insert raw chars until end of quoted string */ - Gbl_CurrentLineBuffer[i] = c; + Gbl_CurrentLineBuffer[i] = (char) c; i++; 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; @@ -569,7 +578,7 @@ DtGetNextLine ( /* Just copy the escaped character. TBD: sufficient for table compiler? */ - Gbl_CurrentLineBuffer[i] = c; + Gbl_CurrentLineBuffer[i] = (char) c; i++; State = DT_START_QUOTED_STRING; break; @@ -581,21 +590,24 @@ DtGetNextLine ( switch (c) { case '*': + State = DT_SLASH_ASTERISK_COMMENT; break; case '/': + State = DT_SLASH_SLASH_COMMENT; break; default: /* Not a comment */ + i++; /* Save the preceding slash */ if (i >= Gbl_LineBufferSize) { UtExpandLineBuffers (); } - Gbl_CurrentLineBuffer[i] = c; + Gbl_CurrentLineBuffer[i] = (char) c; i++; State = DT_NORMAL_TEXT; break; @@ -609,15 +621,18 @@ DtGetNextLine ( switch (c) { case '\n': + Gbl_NextLineOffset = (UINT32) ftell (Handle); Gbl_CurrentLineNumber++; break; case '*': + State = DT_END_COMMENT; break; default: + break; } break; @@ -642,20 +657,24 @@ DtGetNextLine ( switch (c) { case '/': + State = DT_NORMAL_TEXT; break; case '\n': + CurrentLineOffset = Gbl_NextLineOffset; Gbl_NextLineOffset = (UINT32) ftell (Handle); Gbl_CurrentLineNumber++; break; case '*': + /* Consume all adjacent asterisks */ break; default: + State = DT_SLASH_ASTERISK_COMMENT; break; } @@ -694,6 +713,7 @@ DtGetNextLine ( break; default: + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, "Unknown input state"); return (ASL_EOF); } |