aboutsummaryrefslogtreecommitdiffstats
path: root/source/compiler
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
parent9fd6e3caab6c4754f50b66bcc8bdbf7ef8397f74 (diff)
downloadsrc-b43c4dd5abdb09fe2e7f73f186586b962c9dc9f5.tar.gz
src-b43c4dd5abdb09fe2e7f73f186586b962c9dc9f5.zip
Import ACPICA 20120420.vendor/acpica/20120420
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=234518 svn path=/vendor-sys/acpica/20120420/; revision=234519; tag=vendor/acpica/20120420
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/Makefile4
-rw-r--r--source/compiler/aslcompile.c55
-rw-r--r--source/compiler/aslcompiler.h15
-rw-r--r--source/compiler/aslcompiler.l711
-rw-r--r--source/compiler/aslcompiler.y224
-rw-r--r--source/compiler/aslerror.c21
-rw-r--r--source/compiler/aslfiles.c60
-rw-r--r--source/compiler/aslglobal.h5
-rw-r--r--source/compiler/aslmain.c27
-rw-r--r--source/compiler/aslmap.c2
-rw-r--r--source/compiler/aslrestype1.c8
-rw-r--r--source/compiler/aslstartup.c76
-rw-r--r--source/compiler/aslsupport.l782
-rw-r--r--source/compiler/dtio.c42
-rw-r--r--source/compiler/preprocess.h17
-rw-r--r--source/compiler/prscan.c71
-rw-r--r--source/compiler/prutils.c110
17 files changed, 1221 insertions, 1009 deletions
diff --git a/source/compiler/Makefile b/source/compiler/Makefile
index b4c6b45108b8..379f38889387 100644
--- a/source/compiler/Makefile
+++ b/source/compiler/Makefile
@@ -289,8 +289,8 @@ $(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS)
#
# Parser and Lexer - intermediate C files
#
-aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l
- ${LEX} ${LFLAGS} -PAslCompiler -o$@ $?
+aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l
+ ${LEX} ${LFLAGS} -PAslCompiler -o$@ $(ASL_COMPILER)/aslcompiler.l
aslcompilerparse.c aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y
${YACC} ${YFLAGS} -pAslCompiler -o$@ $?
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 6c368a098980..8fcca0a7cb66 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -242,10 +242,10 @@ CmFlushSourceCode (
while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR)
{
- InsertLineBuffer ((int) Buffer);
+ AslInsertLineBuffer ((int) Buffer);
}
- ResetCurrentLineBuffer ();
+ AslResetCurrentLineBuffer ();
}
@@ -457,16 +457,20 @@ CmDoCompile (
Event = UtBeginEvent ("Open input and output files");
UtEndEvent (Event);
- /* Preprocessor */
-
Event = UtBeginEvent ("Preprocess input file");
- PrDoPreprocess ();
- UtEndEvent (Event);
- if (Gbl_PreprocessOnly)
+ if (Gbl_PreprocessFlag)
{
- CmCleanupAndExit ();
- return 0;
+ /* Preprocessor */
+
+ PrDoPreprocess ();
+ if (Gbl_PreprocessOnly)
+ {
+ UtEndEvent (Event);
+ CmCleanupAndExit ();
+ return 0;
+ }
}
+ UtEndEvent (Event);
/* Build the parse tree */
@@ -483,8 +487,17 @@ CmDoCompile (
if (!RootNode)
{
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
- NULL, "- Could not resolve parse tree root node");
+ /*
+ * If there are no errors, then we have some sort of
+ * internal problem.
+ */
+ Status = AslCheckForErrorExit ();
+ if (Status == AE_OK)
+ {
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
+ NULL, "- Could not resolve parse tree root node");
+ }
+
goto ErrorExit;
}
@@ -553,14 +566,14 @@ CmDoCompile (
if (Gbl_ParseOnlyFlag)
{
- AePrintErrorLog (ASL_FILE_STDOUT);
- UtDisplaySummary (ASL_FILE_STDOUT);
+ AePrintErrorLog (ASL_FILE_STDERR);
+ UtDisplaySummary (ASL_FILE_STDERR);
if (Gbl_DebugFlag)
{
- /* Print error summary to the debug file */
+ /* Print error summary to the stdout also */
- AePrintErrorLog (ASL_FILE_STDERR);
- UtDisplaySummary (ASL_FILE_STDERR);
+ AePrintErrorLog (ASL_FILE_STDOUT);
+ UtDisplaySummary (ASL_FILE_STDOUT);
}
UtEndEvent (FullCompile);
return 0;
@@ -756,12 +769,12 @@ CmCleanupAndExit (
UINT32 i;
- AePrintErrorLog (ASL_FILE_STDOUT);
+ AePrintErrorLog (ASL_FILE_STDERR);
if (Gbl_DebugFlag)
{
- /* Print error summary to the debug file */
+ /* Print error summary to stdout also */
- AePrintErrorLog (ASL_FILE_STDERR);
+ AePrintErrorLog (ASL_FILE_STDOUT);
}
DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n");
@@ -837,7 +850,9 @@ CmCleanupAndExit (
/* Delete the preprocessor output file (.i) unless -li flag is set */
- if (!Gbl_PreprocessorOutputFlag && Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)
+ if (!Gbl_PreprocessorOutputFlag &&
+ Gbl_PreprocessFlag &&
+ Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)
{
if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename))
{
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 6cc435141986..7eef917cd11e 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -100,11 +100,11 @@ AslCompilerlex(
void);
void
-ResetCurrentLineBuffer (
+AslResetCurrentLineBuffer (
void);
void
-InsertLineBuffer (
+AslInsertLineBuffer (
int SourceChar);
int
@@ -136,6 +136,11 @@ ACPI_STATUS
AslDoOneFile (
char *Filename);
+ACPI_STATUS
+AslCheckForErrorExit (
+ void);
+
+
/*
* aslcompile - compile mainline
*/
@@ -645,7 +650,11 @@ FlPrintFile (
void
FlSetLineNumber (
- ACPI_PARSE_OBJECT *Op);
+ UINT32 LineNumber);
+
+void
+FlSetFilename (
+ char *Filename);
ACPI_STATUS
FlOpenInputFile (
diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index 39f94bfafb3a..b9c3020dd3a0 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/compiler/aslcompiler.l
@@ -58,20 +58,26 @@ YYSTYPE AslCompilerlval;
*/
#define _COMPONENT ACPI_COMPILER
- ACPI_MODULE_NAME ("aslscan")
+ ACPI_MODULE_NAME ("aslscanner")
+
/* Local prototypes */
-char
-comment (void);
-char
-comment2 (void);
-void
+static void
+AslDoLineDirective (void);
+
+static char
+AslDoComment (void);
+
+static char
+AslDoCommentType2 (void);
+
+static char
+AslDoStringLiteral (void);
+
+static void
count (int type);
-char
-literal (void);
-void
-copy (void);
+
/*! [Begin] no source code translation */
@@ -104,10 +110,10 @@ NamePathTail [.]{NameSeg}
[ \t] { count (0); }
-"/*" { if (!comment ()) yyterminate (); }
-"//" { if (!comment2 ()) yyterminate (); }
+"/*" { if (!AslDoComment ()) yyterminate (); }
+"//" { if (!AslDoCommentType2 ()) yyterminate (); }
-"\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); }
+"\"" { if (AslDoStringLiteral ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); }
";" { count (0); return(';'); }
@@ -116,10 +122,16 @@ NamePathTail [.]{NameSeg}
count (1); return (PARSEOP_INTEGER); }
"Include" { count (1); return (PARSEOP_INCLUDE); }
-"#include" { count (1); return (PARSEOP_INCLUDE_CSTYLE); }
-"#line" { count (1); return (PARSEOP_LINE_CSTYLE); }
"External" { count (1); return (PARSEOP_EXTERNAL); }
+ /*
+ * The #line directive is emitted by the preprocessor and handled
+ * here in the main iASL lexer - simply set the line number and
+ * optionally the current filename.
+ */
+"#line" { AslDoLineDirective ();}
+
+
/****************************************************************************
*
* Main ASL operators
@@ -634,668 +646,7 @@ NamePathTail [.]{NameSeg}
/*! [End] no source code translation !*/
-typedef struct asl_file_node
-{
- FILE *File;
- UINT32 CurrentLineNumber;
- YY_BUFFER_STATE State;
- char *Filename;
- struct asl_file_node *Next;
-
-} ASL_FILE_NODE;
-
-ASL_FILE_NODE *InputStack = NULL;
-
-
-/*******************************************************************************
- *
- * FUNCTION: AslPopInputFileStack
- *
- * PARAMETERS: None
- *
- * RETURN: 0 if a node was popped, -1 otherwise
- *
- * DESCRIPTION: Pop the top of the input file stack and point the parser to
- * the saved parse buffer contained in the fnode. Also, set the
- * global line counters to the saved values. This function is
- * called when an include file reaches EOF.
- *
- ******************************************************************************/
-
-int
-AslPopInputFileStack (
- void)
-{
- ASL_FILE_NODE *Fnode;
-
-
- Fnode = InputStack;
- DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode);
-
-
- if (!Fnode)
- {
- return -1;
- }
-
- /* Close the current include file */
-
- fclose (yyin);
-
- /* Update the top-of-stack */
-
- InputStack = Fnode->Next;
-
- /* Reset global line counter and filename */
-
- Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
- Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
-
- /* Point the parser to the popped file */
-
- yy_delete_buffer (YY_CURRENT_BUFFER);
- yy_switch_to_buffer (Fnode->State);
-
- /* All done with this node */
-
- ACPI_FREE (Fnode);
- return 0;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AslPushInputFileStack
- *
- * PARAMETERS: InputFile - Open file pointer
- * Filename - Name of the file
- *
- * RETURN: None
- *
- * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
- * to this file. Called when an include file is successfully
- * opened.
- *
- ******************************************************************************/
-
-void
-AslPushInputFileStack (
- FILE *InputFile,
- char *Filename)
-{
- ASL_FILE_NODE *Fnode;
- YY_BUFFER_STATE State;
-
-
- /* Save the current state in an Fnode */
-
- Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
-
- Fnode->File = yyin;
- Fnode->Next = InputStack;
- Fnode->State = YY_CURRENT_BUFFER;
- Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
- Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
-
- /* Push it on the stack */
-
- InputStack = Fnode;
-
- /* Point the parser to this file */
-
- State = yy_create_buffer (InputFile, YY_BUF_SIZE);
- yy_switch_to_buffer (State);
-
- DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile);
-
- /* Reset the global line count and filename */
-
- Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
- Gbl_CurrentLineNumber = 1;
- yyin = InputFile;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: ResetCurrentLineBuffer
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
- *
- ******************************************************************************/
-
-void
-ResetCurrentLineBuffer (
- void)
-{
-
- if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
- {
- FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer,
- Gbl_LineBufPtr - Gbl_CurrentLineBuffer);
- }
-
- Gbl_CurrentLineOffset += Gbl_CurrentColumn;
- Gbl_CurrentColumn = 0;
-
- Gbl_CurrentLineNumber++;
- Gbl_LogicalLineNumber++;
- Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: InsertLineBuffer
- *
- * PARAMETERS: SourceChar - One char from the input ASL source file
- *
- * RETURN: None
- *
- * DESCRIPTION: Put one character of the source file into the temp line buffer
- *
- ******************************************************************************/
-
-#define ASL_SPACES_PER_TAB 4
-
-void
-InsertLineBuffer (
- int SourceChar)
-{
- UINT32 i;
- UINT32 Count = 1;
-
-
- if (SourceChar == EOF)
- {
- return;
- }
-
- Gbl_InputByteCount++;
-
- /* Handle tabs. Convert to spaces */
-
- if (SourceChar == '\t')
- {
- SourceChar = ' ';
- Count = ASL_SPACES_PER_TAB -
- (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
- }
-
-
- for (i = 0; i < Count; i++)
- {
- Gbl_CurrentColumn++;
-
- /* Insert the character into the line buffer */
-
- *Gbl_LineBufPtr = (UINT8) SourceChar;
- Gbl_LineBufPtr++;
-
- if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1)))
- {
-#if 0
- /*
- * Warning if we have split a long source line.
- * <Probably overkill>
- */
- sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE);
- AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
-#endif
-
- ResetCurrentLineBuffer ();
- }
- else if (SourceChar == '\n')
- {
- /* End of line */
-
- ResetCurrentLineBuffer ();
- }
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: count
- *
- * PARAMETERS: yytext - Contains the matched keyword.
- * Type - Keyword/Character type:
- * 0 = anything except a keyword
- * 1 = pseudo-keywords
- * 2 = non-executable ASL keywords
- * 3 = executable ASL keywords
- *
- * RETURN: None
- *
- * DESCRIPTION: Count keywords and put them into the line buffer
- *
- ******************************************************************************/
-
-void
-count (
- int Type)
-{
- int i;
-
-
- switch (Type)
- {
- case 2:
- TotalKeywords++;
- TotalNamedObjects++;
- break;
-
- case 3:
- TotalKeywords++;
- TotalExecutableOpcodes++;
- break;
- }
-
- for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
- {
- InsertLineBuffer (yytext[i]);
- *Gbl_LineBufPtr = 0;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: comment
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Process a standard comment.
- *
- ******************************************************************************/
-
-char
-comment (void)
-{
- char c;
- char c1 = 0;
-
-
- InsertLineBuffer ('/');
- InsertLineBuffer ('*');
-
-loop:
-
- /* Eat chars until end-of-comment */
-
- while ((c = (char) input()) != '*' && c != EOF)
- {
- InsertLineBuffer (c);
- c1 = c;
- }
-
- if (c == EOF)
- {
- goto EarlyEOF;
- }
-
- /*
- * Check for nested comment -- can help catch cases where a previous
- * comment was accidently left unterminated
- */
- if ((c1 == '/') && (c == '*'))
- {
- AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_InputByteCount, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- }
-
- /* Comment is closed only if the NEXT character is a slash */
-
- InsertLineBuffer (c);
-
- if ((c1 = (char) input()) != '/' && c1 != EOF)
- {
- unput(c1);
- goto loop;
- }
-
- if (c1 == EOF)
- {
- goto EarlyEOF;
- }
-
- InsertLineBuffer (c1);
- return TRUE;
-
-
-EarlyEOF:
- /*
- * Premature End-Of-File
- */
- AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- return (FALSE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: comment
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Process a new "//" comment.
- *
- ******************************************************************************/
-
-char
-comment2 (void)
-{
- char c;
-
-
- InsertLineBuffer ('/');
- InsertLineBuffer ('/');
-
- while ((c = (char) input()) != '\n' && c != EOF)
- {
- InsertLineBuffer (c);
- }
-
- if (c == EOF)
- {
- /* End of file is OK, change to newline. Let parser detect EOF later */
-
- c = '\n';
- }
-
- InsertLineBuffer (c);
- return (TRUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: literal
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Process a string literal (surrounded by quotes)
- *
- ******************************************************************************/
-
-#define ASL_NORMAL_CHAR 0
-#define ASL_ESCAPE_SEQUENCE 1
-#define ASL_OCTAL_CONSTANT 2
-#define ASL_HEX_CONSTANT 3
-
-char
-literal (void)
-{
- char *StringBuffer = MsgBuffer;
- char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
- char *CleanString;
- char StringChar;
- UINT32 State = ASL_NORMAL_CHAR;
- UINT32 i = 0;
- UINT8 Digit;
- char ConvertBuffer[4];
-
-
- /*
- * Eat chars until end-of-literal.
- * NOTE: Put back the original surrounding quotes into the
- * source line buffer.
- */
- InsertLineBuffer ('\"');
- while ((StringChar = (char) input()) != EOF)
- {
- InsertLineBuffer (StringChar);
-
-DoCharacter:
-
- switch (State)
- {
- case ASL_NORMAL_CHAR:
-
- switch (StringChar)
- {
- case '\\':
- /*
- * Special handling for backslash-escape sequence. We will
- * toss the backslash and translate the escape char(s).
- */
- State = ASL_ESCAPE_SEQUENCE;
- continue;
-
- case '\"':
-
- /* String terminator */
-
- goto CompletedString;
- }
- break;
-
-
- case ASL_ESCAPE_SEQUENCE:
-
- State = ASL_NORMAL_CHAR;
- switch (StringChar)
- {
- case 'a':
- StringChar = 0x07; /* BELL */
- break;
-
- case 'b':
- StringChar = 0x08; /* BACKSPACE */
- break;
-
- case 'f':
- StringChar = 0x0C; /* FORMFEED */
- break;
-
- case 'n':
- StringChar = 0x0A; /* LINEFEED */
- break;
-
- case 'r':
- StringChar = 0x0D; /* CARRIAGE RETURN*/
- break;
-
- case 't':
- StringChar = 0x09; /* HORIZONTAL TAB */
- break;
-
- case 'v':
- StringChar = 0x0B; /* VERTICAL TAB */
- break;
-
- case 'x':
- State = ASL_HEX_CONSTANT;
- i = 0;
- continue;
-
- case '\'': /* Single Quote */
- case '\"': /* Double Quote */
- case '\\': /* Backslash */
- break;
-
- default:
-
- /* Check for an octal digit (0-7) */
-
- if (ACPI_IS_OCTAL_DIGIT (StringChar))
- {
- State = ASL_OCTAL_CONSTANT;
- ConvertBuffer[0] = StringChar;
- i = 1;
- continue;
- }
-
- /* Unknown escape sequence issue warning, but use the character */
-
- AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- break;
- }
- break;
-
-
- case ASL_OCTAL_CONSTANT:
-
- /* Up to three octal digits allowed */
-
- if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
- (i > 2))
- {
- /*
- * Reached end of the constant. Convert the assembled ASCII
- * string and resume processing of the next character
- */
- ConvertBuffer[i] = 0;
- Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
-
- /* Check for NULL or non-ascii character (ignore if so) */
-
- if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
- {
- AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- }
- else
- {
- *StringBuffer = (char) Digit;
- StringBuffer++;
- if (StringBuffer >= EndBuffer)
- {
- goto BufferOverflow;
- }
- }
-
- State = ASL_NORMAL_CHAR;
- goto DoCharacter;
- break;
- }
-
- /* Append another digit of the constant */
-
- ConvertBuffer[i] = StringChar;
- i++;
- continue;
-
-
- case ASL_HEX_CONSTANT:
-
- /* Up to two hex digits allowed */
-
- if (!ACPI_IS_XDIGIT (StringChar) ||
- (i > 1))
- {
- /*
- * Reached end of the constant. Convert the assembled ASCII
- * string and resume processing of the next character
- */
- ConvertBuffer[i] = 0;
- Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
-
- /* Check for NULL or non-ascii character (ignore if so) */
-
- if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
- {
- AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- }
- else
- {
- *StringBuffer = (char) Digit;
- StringBuffer++;
- if (StringBuffer >= EndBuffer)
- {
- goto BufferOverflow;
- }
- }
-
- State = ASL_NORMAL_CHAR;
- goto DoCharacter;
- break;
- }
-
- /* Append another digit of the constant */
-
- ConvertBuffer[i] = StringChar;
- i++;
- continue;
- }
-
- /* Save the finished character */
-
- *StringBuffer = StringChar;
- StringBuffer++;
- if (StringBuffer >= EndBuffer)
- {
- goto BufferOverflow;
- }
- }
-
- /*
- * Premature End-Of-File
- */
- AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- return (FALSE);
-
-
-CompletedString:
- /*
- * Null terminate the input string and copy string to a new buffer
- */
- *StringBuffer = 0;
-
- CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
- if (!CleanString)
- {
- AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- return (FALSE);
- }
-
- ACPI_STRCPY (CleanString, MsgBuffer);
- AslCompilerlval.s = CleanString;
- return (TRUE);
-
-
-BufferOverflow:
-
- /* Literal was too long */
-
- AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
- return (FALSE);
-}
-
-
+/*
+ * Bring in the scanner support routines
+ */
+#include "aslsupport.l"
diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y
index a9e58f5cd0d6..146747777e1f 100644
--- a/source/compiler/aslcompiler.y
+++ b/source/compiler/aslcompiler.y
@@ -236,7 +236,6 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_I2C_SERIALBUS
%token <i> PARSEOP_IF
%token <i> PARSEOP_INCLUDE
-%token <i> PARSEOP_INCLUDE_CSTYLE
%token <i> PARSEOP_INCLUDE_END
%token <i> PARSEOP_INCREMENT
%token <i> PARSEOP_INDEX
@@ -261,7 +260,6 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_LEQUAL
%token <i> PARSEOP_LGREATER
%token <i> PARSEOP_LGREATEREQUAL
-%token <i> PARSEOP_LINE_CSTYLE
%token <i> PARSEOP_LLESS
%token <i> PARSEOP_LLESSEQUAL
%token <i> PARSEOP_LNOT
@@ -504,9 +502,7 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> FieldUnit
%type <n> FieldUnitEntry
%type <n> FieldUnitList
-%type <n> IncludeCStyleTerm
%type <n> IncludeTerm
-%type <n> LineTerm
%type <n> OffsetTerm
%type <n> OptionalAccessAttribTerm
@@ -805,15 +801,19 @@ void * AslLocalAllocate (unsigned int Size);
/*
- * Blocks, Data, and Opcodes
+ * Root rule. Allow multiple #line directives before the definition block
+ * to handle output from preprocessors
*/
-
ASLCode
: DefinitionBlockTerm
| error {YYABORT; $$ = NULL;}
;
/*
+ * Blocks, Data, and Opcodes
+ */
+
+/*
* Note concerning support for "module-level code".
*
* ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
@@ -829,7 +829,7 @@ ASLCode
* of Type1 and Type2 opcodes at module level.
*/
DefinitionBlockTerm
- : PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
+ : PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
String ','
String ','
ByteConst ','
@@ -863,8 +863,6 @@ Term
CompilerDirective
: IncludeTerm {}
- | IncludeCStyleTerm {$$ = NULL;}
- | LineTerm {$$ = NULL;}
| ExternalTerm {}
;
@@ -1148,26 +1146,16 @@ Type6Opcode
;
IncludeTerm
- : PARSEOP_INCLUDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);}
+ : PARSEOP_INCLUDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);}
String ')' {TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);}
TermList
IncludeEndTerm {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);}
;
IncludeEndTerm
- : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);}
- ;
-
-IncludeCStyleTerm
- : PARSEOP_INCLUDE_CSTYLE
- String {FlOpenIncludeFile ($2);}
+ : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);}
;
-LineTerm
- : PARSEOP_LINE_CSTYLE
- Integer {FlSetLineNumber ($2);}
- ;
-
ExternalTerm
: PARSEOP_EXTERNAL '('
NameString
@@ -1184,7 +1172,7 @@ ExternalTerm
BankFieldTerm
- : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
+ : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
NameString
NameStringItem
TermArgItem
@@ -1251,7 +1239,7 @@ ConnectionTerm
;
CreateBitFieldTerm
- : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
+ : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1261,7 +1249,7 @@ CreateBitFieldTerm
;
CreateByteFieldTerm
- : PARSEOP_CREATEBYTEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
+ : PARSEOP_CREATEBYTEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1271,7 +1259,7 @@ CreateByteFieldTerm
;
CreateDWordFieldTerm
- : PARSEOP_CREATEDWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
+ : PARSEOP_CREATEDWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1281,7 +1269,7 @@ CreateDWordFieldTerm
;
CreateFieldTerm
- : PARSEOP_CREATEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
+ : PARSEOP_CREATEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
TermArg
TermArgItem
TermArgItem
@@ -1292,7 +1280,7 @@ CreateFieldTerm
;
CreateQWordFieldTerm
- : PARSEOP_CREATEQWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
+ : PARSEOP_CREATEQWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1302,7 +1290,7 @@ CreateQWordFieldTerm
;
CreateWordFieldTerm
- : PARSEOP_CREATEWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
+ : PARSEOP_CREATEWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1312,7 +1300,7 @@ CreateWordFieldTerm
;
DataRegionTerm
- : PARSEOP_DATATABLEREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
+ : PARSEOP_DATATABLEREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
NameString
TermArgItem
TermArgItem
@@ -1323,7 +1311,7 @@ DataRegionTerm
;
DeviceTerm
- : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
+ : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
NameString
')' '{'
ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
@@ -1332,7 +1320,7 @@ DeviceTerm
;
EventTerm
- : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);}
+ : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);}
NameString
')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));}
| PARSEOP_EVENT '('
@@ -1340,7 +1328,7 @@ EventTerm
;
FieldTerm
- : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);}
+ : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);}
NameString
',' AccessTypeKeyword
',' LockRuleKeyword
@@ -1352,7 +1340,7 @@ FieldTerm
;
FunctionTerm
- : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
+ : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
NameString
OptionalParameterTypePackage
OptionalParameterTypesPackage
@@ -1366,7 +1354,7 @@ FunctionTerm
;
IndexFieldTerm
- : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
+ : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
NameString
NameStringItem
',' AccessTypeKeyword
@@ -1379,7 +1367,7 @@ IndexFieldTerm
;
MethodTerm
- : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
+ : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
NameString
OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);}
OptionalSerializeRuleKeyword
@@ -1393,7 +1381,7 @@ MethodTerm
;
MutexTerm
- : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);}
+ : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);}
NameString
',' ByteConstExpr
')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
@@ -1402,7 +1390,7 @@ MutexTerm
;
OpRegionTerm
- : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
+ : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
NameString
',' OpRegionSpaceIdTerm
TermArgItem
@@ -1418,7 +1406,7 @@ OpRegionSpaceIdTerm
;
PowerResTerm
- : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
+ : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
NameString
',' ByteConstExpr
',' WordConstExpr
@@ -1429,7 +1417,7 @@ PowerResTerm
;
ProcessorTerm
- : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
+ : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
NameString
',' ByteConstExpr
OptionalDWordConstExpr
@@ -1441,7 +1429,7 @@ ProcessorTerm
;
ThermalZoneTerm
- : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
+ : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
NameString
')' '{'
ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
@@ -1454,7 +1442,7 @@ ThermalZoneTerm
AliasTerm
- : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);}
+ : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);}
NameString
NameStringItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));}
@@ -1463,7 +1451,7 @@ AliasTerm
;
NameTerm
- : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);}
+ : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);}
NameString
',' DataObject
')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
@@ -1472,7 +1460,7 @@ NameTerm
;
ScopeTerm
- : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);}
+ : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);}
NameString
')' '{'
ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
@@ -1485,19 +1473,19 @@ ScopeTerm
BreakTerm
- : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
+ : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
;
BreakPointTerm
- : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
+ : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
;
ContinueTerm
- : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
+ : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
;
FatalTerm
- : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);}
+ : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);}
ByteConstExpr
',' DWordConstExpr
TermArgItem
@@ -1511,7 +1499,7 @@ IfElseTerm
;
IfTerm
- : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
+ : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
TermArg
')' '{'
TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
@@ -1522,7 +1510,7 @@ IfTerm
ElseTerm
: {$$ = NULL;}
- | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
+ | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_ELSE '{'
@@ -1531,10 +1519,10 @@ ElseTerm
| PARSEOP_ELSE
error {$$ = AslDoError(); yyclearin;}
- | PARSEOP_ELSEIF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
- TermArg {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
+ | PARSEOP_ELSEIF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
+ TermArg {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
')' '{'
- TermList '}' {TrLinkChildren ($<n>5,2,$4,$8);}
+ TermList '}' {TrLinkChildren ($<n>5,2,$4,$8);}
ElseTerm {TrLinkPeerNode ($<n>5,$11);}
{$$ = TrLinkChildren ($<n>3,1,$<n>5);}
@@ -1546,7 +1534,7 @@ ElseTerm
;
LoadTerm
- : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);}
+ : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);}
NameString
RequiredTarget
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1555,11 +1543,11 @@ LoadTerm
;
NoOpTerm
- : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
+ : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
;
NotifyTerm
- : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
+ : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
SuperName
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1568,7 +1556,7 @@ NotifyTerm
;
ReleaseTerm
- : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);}
+ : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_RELEASE '('
@@ -1576,7 +1564,7 @@ ReleaseTerm
;
ResetTerm
- : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);}
+ : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_RESET '('
@@ -1584,16 +1572,16 @@ ResetTerm
;
ReturnTerm
- : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
+ : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
OptionalReturnArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
- | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
+ | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
| PARSEOP_RETURN '('
error ')' {$$ = AslDoError(); yyclearin;}
;
SignalTerm
- : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
+ : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_SIGNAL '('
@@ -1601,7 +1589,7 @@ SignalTerm
;
SleepTerm
- : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);}
+ : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_SLEEP '('
@@ -1609,7 +1597,7 @@ SleepTerm
;
StallTerm
- : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);}
+ : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_STALL '('
@@ -1617,7 +1605,7 @@ StallTerm
;
SwitchTerm
- : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);}
+ : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);}
TermArg
')' '{'
CaseDefaultTermList '}'
@@ -1660,7 +1648,7 @@ CaseTermList
*/
CaseTerm
- : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);}
+ : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);}
DataObject
')' '{'
TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
@@ -1669,14 +1657,14 @@ CaseTerm
;
DefaultTerm
- : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
+ : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_DEFAULT '{'
error '}' {$$ = AslDoError(); yyclearin;}
;
UnloadTerm
- : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
+ : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_UNLOAD '('
@@ -1684,7 +1672,7 @@ UnloadTerm
;
WhileTerm
- : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
+ : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
TermArg
')' '{' TermList '}'
{$$ = TrLinkChildren ($<n>3,2,$4,$7);}
@@ -1696,7 +1684,7 @@ WhileTerm
/******* Type 2 opcodes *******************************************************/
AcquireTerm
- : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
+ : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
SuperName
',' WordConstExpr
')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);}
@@ -1705,7 +1693,7 @@ AcquireTerm
;
AddTerm
- : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
+ : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
TermArg
TermArgItem
Target
@@ -1715,7 +1703,7 @@ AddTerm
;
AndTerm
- : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
+ : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
TermArg
TermArgItem
Target
@@ -1725,7 +1713,7 @@ AndTerm
;
ConcatTerm
- : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
+ : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
TermArg
TermArgItem
Target
@@ -1745,7 +1733,7 @@ ConcatResTerm
;
CondRefOfTerm
- : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
+ : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
SuperName
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1754,7 +1742,7 @@ CondRefOfTerm
;
CopyObjectTerm
- : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
+ : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
TermArg
',' SimpleTarget
')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
@@ -1763,7 +1751,7 @@ CopyObjectTerm
;
DecTerm
- : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
+ : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_DECREMENT '('
@@ -1771,7 +1759,7 @@ DecTerm
;
DerefOfTerm
- : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
+ : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_DEREFOF '('
@@ -1779,7 +1767,7 @@ DerefOfTerm
;
DivideTerm
- : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
+ : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
TermArg
TermArgItem
Target
@@ -1790,7 +1778,7 @@ DivideTerm
;
FindSetLeftBitTerm
- : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
+ : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1799,7 +1787,7 @@ FindSetLeftBitTerm
;
FindSetRightBitTerm
- : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
+ : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1808,7 +1796,7 @@ FindSetRightBitTerm
;
FromBCDTerm
- : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
+ : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1817,7 +1805,7 @@ FromBCDTerm
;
IncTerm
- : PARSEOP_INCREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
+ : PARSEOP_INCREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_INCREMENT '('
@@ -1825,7 +1813,7 @@ IncTerm
;
IndexTerm
- : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);}
+ : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);}
TermArg
TermArgItem
Target
@@ -1835,7 +1823,7 @@ IndexTerm
;
LAndTerm
- : PARSEOP_LAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
+ : PARSEOP_LAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1844,7 +1832,7 @@ LAndTerm
;
LEqualTerm
- : PARSEOP_LEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
+ : PARSEOP_LEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1853,7 +1841,7 @@ LEqualTerm
;
LGreaterTerm
- : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
+ : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1862,7 +1850,7 @@ LGreaterTerm
;
LGreaterEqualTerm
- : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
+ : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
TermArg
TermArgItem
')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
@@ -1871,7 +1859,7 @@ LGreaterEqualTerm
;
LLessTerm
- : PARSEOP_LLESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
+ : PARSEOP_LLESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1880,7 +1868,7 @@ LLessTerm
;
LLessEqualTerm
- : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
+ : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
TermArg
TermArgItem
')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
@@ -1889,7 +1877,7 @@ LLessEqualTerm
;
LNotTerm
- : PARSEOP_LNOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
+ : PARSEOP_LNOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_LNOT '('
@@ -1897,7 +1885,7 @@ LNotTerm
;
LNotEqualTerm
- : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
+ : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
TermArg
TermArgItem
')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
@@ -1906,7 +1894,7 @@ LNotEqualTerm
;
LoadTableTerm
- : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
+ : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
TermArg
TermArgItem
TermArgItem
@@ -1919,7 +1907,7 @@ LoadTableTerm
;
LOrTerm
- : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
+ : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1928,7 +1916,7 @@ LOrTerm
;
MatchTerm
- : PARSEOP_MATCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);}
+ : PARSEOP_MATCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);}
TermArg
',' MatchOpKeyword
TermArgItem
@@ -1941,7 +1929,7 @@ MatchTerm
;
MidTerm
- : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);}
+ : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);}
TermArg
TermArgItem
TermArgItem
@@ -1952,7 +1940,7 @@ MidTerm
;
ModTerm
- : PARSEOP_MOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
+ : PARSEOP_MOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
TermArg
TermArgItem
Target
@@ -1962,7 +1950,7 @@ ModTerm
;
MultiplyTerm
- : PARSEOP_MULTIPLY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
+ : PARSEOP_MULTIPLY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
TermArg
TermArgItem
Target
@@ -1972,7 +1960,7 @@ MultiplyTerm
;
NAndTerm
- : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);}
+ : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);}
TermArg
TermArgItem
Target
@@ -1982,7 +1970,7 @@ NAndTerm
;
NOrTerm
- : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);}
+ : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);}
TermArg
TermArgItem
Target
@@ -1992,7 +1980,7 @@ NOrTerm
;
NotTerm
- : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
+ : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2001,7 +1989,7 @@ NotTerm
;
ObjectTypeTerm
- : PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
+ : PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_OBJECTTYPE '('
@@ -2009,7 +1997,7 @@ ObjectTypeTerm
;
OrTerm
- : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
+ : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
TermArg
TermArgItem
Target
@@ -2023,7 +2011,7 @@ OrTerm
* we've taken a pointer to it. (hard to tell if a local becomes initialized this way.)
*/
RefOfTerm
- : PARSEOP_REFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);}
+ : PARSEOP_REFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));}
| PARSEOP_REFOF '('
@@ -2031,7 +2019,7 @@ RefOfTerm
;
ShiftLeftTerm
- : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
+ : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
TermArg
TermArgItem
Target
@@ -2041,7 +2029,7 @@ ShiftLeftTerm
;
ShiftRightTerm
- : PARSEOP_SHIFTRIGHT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
+ : PARSEOP_SHIFTRIGHT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
TermArg
TermArgItem
Target
@@ -2051,7 +2039,7 @@ ShiftRightTerm
;
SizeOfTerm
- : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
+ : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_SIZEOF '('
@@ -2059,7 +2047,7 @@ SizeOfTerm
;
StoreTerm
- : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);}
+ : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);}
TermArg
',' SuperName
')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
@@ -2068,7 +2056,7 @@ StoreTerm
;
SubtractTerm
- : PARSEOP_SUBTRACT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
+ : PARSEOP_SUBTRACT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
TermArg
TermArgItem
Target
@@ -2078,15 +2066,15 @@ SubtractTerm
;
TimerTerm
- : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);}
+ : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);}
')' {$$ = TrLinkChildren ($<n>3,0);}
- | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);}
+ | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);}
| PARSEOP_TIMER '('
error ')' {$$ = AslDoError(); yyclearin;}
;
ToBCDTerm
- : PARSEOP_TOBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);}
+ : PARSEOP_TOBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2095,7 +2083,7 @@ ToBCDTerm
;
ToBufferTerm
- : PARSEOP_TOBUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
+ : PARSEOP_TOBUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2104,7 +2092,7 @@ ToBufferTerm
;
ToDecimalStringTerm
- : PARSEOP_TODECIMALSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
+ : PARSEOP_TODECIMALSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2113,7 +2101,7 @@ ToDecimalStringTerm
;
ToHexStringTerm
- : PARSEOP_TOHEXSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
+ : PARSEOP_TOHEXSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2122,7 +2110,7 @@ ToHexStringTerm
;
ToIntegerTerm
- : PARSEOP_TOINTEGER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
+ : PARSEOP_TOINTEGER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2131,7 +2119,7 @@ ToIntegerTerm
;
ToStringTerm
- : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
+ : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
TermArg
OptionalCount
Target
@@ -2148,7 +2136,7 @@ ToUUIDTerm
;
WaitTerm
- : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);}
+ : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);}
SuperName
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2157,7 +2145,7 @@ WaitTerm
;
XOrTerm
- : PARSEOP_XOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
+ : PARSEOP_XOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
TermArg
TermArgItem
Target
@@ -2211,8 +2199,8 @@ AddressKeyword
;
AddressSpaceKeyword
- : ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
- | RegionSpaceKeyword {}
+ : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);}
+ | RegionSpaceKeyword {}
;
BitsPerByteKeyword
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 4bf47e423446..3b384f20674d 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -259,7 +259,7 @@ AePrintException (
{
if (Gbl_VerboseErrors)
{
- fprintf (OutputFile, "%6s", Enode->Filename);
+ fprintf (OutputFile, "%-8s", Enode->Filename);
if (Enode->LineNumber)
{
@@ -270,12 +270,7 @@ AePrintException (
}
else
{
- if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL)
- fprintf (OutputFile, " %6u: ",
- PrGetLineNumber (Enode->LineNumber));
- else
- fprintf (OutputFile, " %6u: ",
- Enode->LineNumber);
+ fprintf (OutputFile, " %6u: ", Enode->LineNumber);
/*
* If not at EOF, get the corresponding source code line and
@@ -324,16 +319,8 @@ AePrintException (
if (Enode->LineNumber)
{
- if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL)
- {
- fprintf (OutputFile, "(%u) i:%6u : ",
- PrGetLineNumber (Enode->LineNumber), Enode->LineNumber);
- }
- else
- {
- fprintf (OutputFile, "(%u) i:%6u : ",
- Enode->LineNumber, Enode->LineNumber);
- }
+ fprintf (OutputFile, "(%u) i:%6u : ",
+ Enode->LineNumber, Enode->LineNumber);
}
}
}
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index 1c2f73f95977..8f02be32cff8 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -81,12 +81,12 @@ AslAbort (
void)
{
- AePrintErrorLog (ASL_FILE_STDOUT);
+ AePrintErrorLog (ASL_FILE_STDERR);
if (Gbl_DebugFlag)
{
- /* Print error summary to the debug file */
+ /* Print error summary to stdout also */
- AePrintErrorLog (ASL_FILE_STDERR);
+ AePrintErrorLog (ASL_FILE_STDOUT);
}
exit (1);
@@ -388,11 +388,38 @@ FlCloseFile (
void
FlSetLineNumber (
- ACPI_PARSE_OBJECT *Op)
+ UINT32 LineNumber)
+{
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New line number %u (old %u)\n",
+ LineNumber, Gbl_LogicalLineNumber);
+
+ Gbl_CurrentLineNumber = LineNumber;
+ Gbl_LogicalLineNumber = LineNumber;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSetFilename
+ *
+ * PARAMETERS: Op - Parse node for the LINE asl statement
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Set the current filename
+ *
+ ******************************************************************************/
+
+void
+FlSetFilename (
+ char *Filename)
{
- Gbl_CurrentLineNumber = (UINT32) Op->Asl.Value.Integer;
- Gbl_LogicalLineNumber = (UINT32) Op->Asl.Value.Integer;
+ DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New filename %s (old %s)\n",
+ Filename, Gbl_Files[ASL_FILE_INPUT].Filename);
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
}
@@ -548,7 +575,7 @@ FlOpenIncludeFile (
* Flush out the "include ()" statement on this line, start
* the actual include file on the next line
*/
- ResetCurrentLineBuffer ();
+ AslResetCurrentLineBuffer ();
FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n");
Gbl_CurrentLineOffset++;
@@ -770,17 +797,20 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
}
- /* Create the preprocessor output file */
+ /* Create the preprocessor output file if preprocessor enabled */
- Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR);
- if (!Filename)
+ if (Gbl_PreprocessFlag)
{
- AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME,
- 0, 0, 0, 0, NULL, NULL);
- return (AE_ERROR);
- }
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
- FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b");
+ FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b");
+ }
/* All done for data table compiler */
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 26da48bf673c..64cb76bb2555 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -74,7 +74,7 @@ extern int PrParserdebug;
extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
extern char *AslCompilertext;
-#define ASL_LINE_BUFFER_SIZE 4096
+#define ASL_LINE_BUFFER_SIZE (4096 * 4) /* 16K */
#define ASL_MSG_BUFFER_SIZE 4096
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 8
@@ -84,6 +84,7 @@ extern char *AslCompilertext;
ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE];
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0);
@@ -99,6 +100,7 @@ ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
@@ -118,6 +120,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 14a02b4778c4..7fb2b3ad02d0 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -96,7 +96,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
-#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:Pr:s|t|T:G^v|w|x:z"
+#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:P^r:s|t|T:G^v|w|x:z"
/*******************************************************************************
@@ -124,6 +124,7 @@ Options (
ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use");
ACPI_OPTION ("-li", "Create preprocessed output file (*.i)");
ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)");
+ ACPI_OPTION ("-Pn", "Disable preprocessor");
printf ("\nGeneral Output:\n");
ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
@@ -133,6 +134,7 @@ Options (
ACPI_OPTION ("-vr", "Disable remarks");
ACPI_OPTION ("-vs", "Disable signon");
ACPI_OPTION ("-w1 -w2 -w3", "Set warning reporting level");
+ ACPI_OPTION ("-we", "Report warnings as errors");
printf ("\nAML Output Files:\n");
ACPI_OPTION ("-sa -sc", "Create AML in assembler or C source file (*.asm or *.c)");
@@ -671,9 +673,22 @@ AslDoOptions (
break;
- case 'P': /* Preprocess (plus .i file) only */
- Gbl_PreprocessOnly = TRUE;
- Gbl_PreprocessorOutputFlag = TRUE;
+ case 'P': /* Preprocessor options */
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '^': /* Proprocess only, emit (.i) file */
+ Gbl_PreprocessOnly = TRUE;
+ Gbl_PreprocessorOutputFlag = TRUE;
+ break;
+
+ case 'n': /* Disable preprocessor */
+ Gbl_PreprocessFlag = FALSE;
+ break;
+
+ default:
+ printf ("Unknown option: -P%s\n", AcpiGbl_Optarg);
+ return (-1);
+ }
break;
@@ -793,6 +808,10 @@ AslDoOptions (
Gbl_WarningLevel = ASL_WARNING3;
break;
+ case 'e':
+ Gbl_WarningsAsErrors = TRUE;
+ break;
+
default:
printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
return (-1);
diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c
index aa8894a02291..04fc53866bd4 100644
--- a/source/compiler/aslmap.c
+++ b/source/compiler/aslmap.c
@@ -240,7 +240,6 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* I2CSERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0),
/* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
-/* INCLUDE_CSTYLE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE),
@@ -265,7 +264,6 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* LEQUAL */ OP_TABLE_ENTRY (AML_LEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LGREATER */ OP_TABLE_ENTRY (AML_LGREATER_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LGREATEREQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LINE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* LLESS */ OP_TABLE_ENTRY (AML_LLESS_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LLESSEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LNOT */ OP_TABLE_ENTRY (AML_LNOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
diff --git a/source/compiler/aslrestype1.c b/source/compiler/aslrestype1.c
index d137fe3061ff..d7ec6c4becca 100644
--- a/source/compiler/aslrestype1.c
+++ b/source/compiler/aslrestype1.c
@@ -453,6 +453,10 @@ RsDoStartDependentDescriptor (
PreviousRnode = Rnode;
Descriptor = Rnode->Buffer;
+ /* Increment offset past StartDependent descriptor */
+
+ CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT);
+
/* Descriptor has priority byte */
Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
@@ -545,6 +549,10 @@ RsDoStartDependentNoPriDescriptor (
ASL_RDESC_ST_DEPEND_SIZE;
PreviousRnode = Rnode;
+ /* Increment offset past StartDependentNoPri descriptor */
+
+ CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO);
+
/* Process all child initialization nodes */
State = ACPI_RSTATE_START_DEPENDENT;
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 2bc1ba6c0e4c..13b7af4bfe37 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -404,18 +404,33 @@ AslDoOneFile (
case ASL_INPUT_TYPE_ASCII_DATA:
Status = DtDoCompile ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
if (Gbl_Signature)
{
ACPI_FREE (Gbl_Signature);
Gbl_Signature = NULL;
}
+
+ /* Check if any errors occurred during compile */
+
+ Status = AslCheckForErrorExit ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Cleanup (for next source file) and exit */
+
AeClearErrorLog ();
PrTerminatePreprocessor ();
return (Status);
/*
- * ASL Compilation (Optional)
+ * ASL Compilation
*/
case ASL_INPUT_TYPE_ASCII_ASL:
@@ -427,18 +442,19 @@ AslDoOneFile (
return (Status);
}
- Status = CmDoCompile ();
+ (void) CmDoCompile ();
(void) AcpiTerminate ();
- /*
- * Return non-zero exit code if there have been errors, unless the
- * global ignore error flag has been set
- */
- if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
+ /* Check if any errors occurred during compile */
+
+ Status = AslCheckForErrorExit ();
+ if (ACPI_FAILURE (Status))
{
- return (AE_ERROR);
+ return (Status);
}
+ /* Cleanup (for next source file) and exit */
+
AeClearErrorLog ();
PrTerminatePreprocessor ();
return (AE_OK);
@@ -525,3 +541,47 @@ AslDoOnePathname (
return (Status);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCheckForErrorExit
+ *
+ * PARAMETERS: None. Examines global exception count array
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Determine if compiler should abort with error status
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AslCheckForErrorExit (
+ void)
+{
+
+ /*
+ * Return non-zero exit code if there have been errors, unless the
+ * global ignore error flag has been set
+ */
+ if (!Gbl_IgnoreErrors)
+ {
+ if (Gbl_ExceptionCount[ASL_ERROR] > 0)
+ {
+ return (AE_ERROR);
+ }
+
+ /* Optionally treat warnings as errors */
+
+ if (Gbl_WarningsAsErrors)
+ {
+ if ((Gbl_ExceptionCount[ASL_WARNING] > 0) ||
+ (Gbl_ExceptionCount[ASL_WARNING2] > 0) ||
+ (Gbl_ExceptionCount[ASL_WARNING3] > 0))
+ {
+ return (AE_ERROR);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l
new file mode 100644
index 000000000000..65dd19bf6992
--- /dev/null
+++ b/source/compiler/aslsupport.l
@@ -0,0 +1,782 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslsupport.l - Flex/lex scanner C support routines.
+ * NOTE: Included into aslcompile.l, not compiled by itself.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+/* Configuration */
+
+#define ASL_SPACES_PER_TAB 4
+
+#define ASL_NORMAL_CHAR 0
+#define ASL_ESCAPE_SEQUENCE 1
+#define ASL_OCTAL_CONSTANT 2
+#define ASL_HEX_CONSTANT 3
+
+
+/* File node - used for "Include" operator file stack */
+
+typedef struct asl_file_node
+{
+ FILE *File;
+ UINT32 CurrentLineNumber;
+ YY_BUFFER_STATE State;
+ char *Filename;
+ struct asl_file_node *Next;
+
+} ASL_FILE_NODE;
+
+/* File stack for the "Include" operator (NOT #include operator) */
+
+ASL_FILE_NODE *Gbl_IncludeFileStack = NULL;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoLineDirective
+ *
+ * PARAMETERS: None. Uses input() to access current source code line
+ *
+ * RETURN: Updates global line number and filename
+ *
+ * DESCRIPTION: Handle #line directives emitted by the preprocessor.
+ *
+ * The #line directive is emitted by the preprocesser, and is used to
+ * pass through line numbers from the original source code file to the
+ * preprocessor output file (.i). This allows any compiler-generated
+ * error messages to be displayed with the correct line number.
+ *
+ ******************************************************************************/
+
+static void
+AslDoLineDirective (
+ void)
+{
+ char c;
+ char *Token;
+ UINT32 LineNumber;
+ char *Filename;
+
+
+ /* Eat the entire line that contains the #line directive */
+
+ while ((c = (char) input()) != '\n' && c != EOF)
+ {
+ AslInsertLineBuffer (c);
+ }
+ AslInsertLineBuffer (0);
+
+ /* First argument is the actual line number */
+
+ Token = strtok (Gbl_CurrentLineBuffer, " ");
+ if (!Token)
+ {
+ goto ResetAndExit;
+ }
+
+ /* Convert line number. Subtract one to handle _this_ line */
+
+ LineNumber = (UINT32) UtDoConstant (Token);
+ FlSetLineNumber (LineNumber - 1);
+
+ /* Second argument is the optional filename (in double quotes) */
+
+ Token = strtok (NULL, " \"");
+ if (Token)
+ {
+ Filename = ACPI_ALLOCATE_ZEROED (strlen (Token) + 1);
+ strcpy (Filename, Token);
+ FlSetFilename (Filename);
+ }
+
+ /* Third argument is not supported at this time */
+
+ResetAndExit:
+ AslResetCurrentLineBuffer ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslPopInputFileStack
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: 0 if a node was popped, -1 otherwise
+ *
+ * DESCRIPTION: Pop the top of the input file stack and point the parser to
+ * the saved parse buffer contained in the fnode. Also, set the
+ * global line counters to the saved values. This function is
+ * called when an include file reaches EOF.
+ *
+ ******************************************************************************/
+
+int
+AslPopInputFileStack (
+ void)
+{
+ ASL_FILE_NODE *Fnode;
+
+
+ Fnode = Gbl_IncludeFileStack;
+ DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode);
+
+ if (!Fnode)
+ {
+ return (-1);
+ }
+
+ /* Close the current include file */
+
+ fclose (yyin);
+
+ /* Update the top-of-stack */
+
+ Gbl_IncludeFileStack = Fnode->Next;
+
+ /* Reset global line counter and filename */
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
+ Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
+
+ /* Point the parser to the popped file */
+
+ yy_delete_buffer (YY_CURRENT_BUFFER);
+ yy_switch_to_buffer (Fnode->State);
+
+ /* All done with this node */
+
+ ACPI_FREE (Fnode);
+ return (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslPushInputFileStack
+ *
+ * PARAMETERS: InputFile - Open file pointer
+ * Filename - Name of the file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
+ * to this file. Called when an include file is successfully
+ * opened.
+ *
+ ******************************************************************************/
+
+void
+AslPushInputFileStack (
+ FILE *InputFile,
+ char *Filename)
+{
+ ASL_FILE_NODE *Fnode;
+ YY_BUFFER_STATE State;
+
+
+ /* Save the current state in an Fnode */
+
+ Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
+
+ Fnode->File = yyin;
+ Fnode->Next = Gbl_IncludeFileStack;
+ Fnode->State = YY_CURRENT_BUFFER;
+ Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
+ Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
+
+ /* Push it on the stack */
+
+ Gbl_IncludeFileStack = Fnode;
+
+ /* Point the parser to this file */
+
+ State = yy_create_buffer (InputFile, YY_BUF_SIZE);
+ yy_switch_to_buffer (State);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile);
+
+ /* Reset the global line count and filename */
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
+ Gbl_CurrentLineNumber = 1;
+ yyin = InputFile;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslResetCurrentLineBuffer
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
+ *
+ ******************************************************************************/
+
+void
+AslResetCurrentLineBuffer (
+ void)
+{
+
+ if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
+ {
+ FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer,
+ Gbl_LineBufPtr - Gbl_CurrentLineBuffer);
+ }
+
+ Gbl_CurrentLineOffset += Gbl_CurrentColumn;
+ Gbl_CurrentColumn = 0;
+
+ Gbl_CurrentLineNumber++;
+ Gbl_LogicalLineNumber++;
+ Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslInsertLineBuffer
+ *
+ * PARAMETERS: SourceChar - One char from the input ASL source file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Put one character of the source file into the temp line buffer
+ *
+ ******************************************************************************/
+
+void
+AslInsertLineBuffer (
+ int SourceChar)
+{
+ UINT32 i;
+ UINT32 Count = 1;
+
+
+ if (SourceChar == EOF)
+ {
+ return;
+ }
+
+ Gbl_InputByteCount++;
+
+ /* Handle tabs. Convert to spaces */
+
+ if (SourceChar == '\t')
+ {
+ SourceChar = ' ';
+ Count = ASL_SPACES_PER_TAB -
+ (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
+ }
+
+ for (i = 0; i < Count; i++)
+ {
+ Gbl_CurrentColumn++;
+
+ /* Insert the character into the line buffer */
+
+ *Gbl_LineBufPtr = (UINT8) SourceChar;
+ Gbl_LineBufPtr++;
+
+ if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1)))
+ {
+#if 0
+ /*
+ * Warning if we have split a long source line.
+ * <Probably overkill>
+ */
+ sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE);
+ AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
+#endif
+
+ AslResetCurrentLineBuffer ();
+ }
+ else if (SourceChar == '\n')
+ {
+ /* End of line */
+
+ AslResetCurrentLineBuffer ();
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: count
+ *
+ * PARAMETERS: yytext - Contains the matched keyword.
+ * Type - Keyword/Character type:
+ * 0 = anything except a keyword
+ * 1 = pseudo-keywords
+ * 2 = non-executable ASL keywords
+ * 3 = executable ASL keywords
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Count keywords and put them into the line buffer
+ *
+ ******************************************************************************/
+
+static void
+count (
+ int Type)
+{
+ int i;
+
+
+ switch (Type)
+ {
+ case 2:
+ TotalKeywords++;
+ TotalNamedObjects++;
+ break;
+
+ case 3:
+ TotalKeywords++;
+ TotalExecutableOpcodes++;
+ break;
+ }
+
+ for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
+ {
+ AslInsertLineBuffer (yytext[i]);
+ *Gbl_LineBufPtr = 0;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoComment
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a standard comment.
+ *
+ ******************************************************************************/
+
+static char
+AslDoComment (
+ void)
+{
+ char c;
+ char c1 = 0;
+
+
+ AslInsertLineBuffer ('/');
+ AslInsertLineBuffer ('*');
+
+loop:
+
+ /* Eat chars until end-of-comment */
+
+ while ((c = (char) input()) != '*' && c != EOF)
+ {
+ AslInsertLineBuffer (c);
+ c1 = c;
+ }
+
+ if (c == EOF)
+ {
+ goto EarlyEOF;
+ }
+
+ /*
+ * Check for nested comment -- can help catch cases where a previous
+ * comment was accidently left unterminated
+ */
+ if ((c1 == '/') && (c == '*'))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_InputByteCount, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+
+ /* Comment is closed only if the NEXT character is a slash */
+
+ AslInsertLineBuffer (c);
+
+ if ((c1 = (char) input()) != '/' && c1 != EOF)
+ {
+ unput(c1);
+ goto loop;
+ }
+
+ if (c1 == EOF)
+ {
+ goto EarlyEOF;
+ }
+
+ AslInsertLineBuffer (c1);
+ return (TRUE);
+
+
+EarlyEOF:
+ /*
+ * Premature End-Of-File
+ */
+ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoCommentType2
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a new "//" comment.
+ *
+ ******************************************************************************/
+
+static char
+AslDoCommentType2 (
+ void)
+{
+ char c;
+
+
+ AslInsertLineBuffer ('/');
+ AslInsertLineBuffer ('/');
+
+ while ((c = (char) input()) != '\n' && c != EOF)
+ {
+ AslInsertLineBuffer (c);
+ }
+
+ if (c == EOF)
+ {
+ /* End of file is OK, change to newline. Let parser detect EOF later */
+
+ c = '\n';
+ }
+
+ AslInsertLineBuffer (c);
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoStringLiteral
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a string literal (surrounded by quotes)
+ *
+ ******************************************************************************/
+
+static char
+AslDoStringLiteral (
+ void)
+{
+ char *StringBuffer = MsgBuffer;
+ char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
+ char *CleanString;
+ char StringChar;
+ UINT32 State = ASL_NORMAL_CHAR;
+ UINT32 i = 0;
+ UINT8 Digit;
+ char ConvertBuffer[4];
+
+
+ /*
+ * Eat chars until end-of-literal.
+ * NOTE: Put back the original surrounding quotes into the
+ * source line buffer.
+ */
+ AslInsertLineBuffer ('\"');
+ while ((StringChar = (char) input()) != EOF)
+ {
+ AslInsertLineBuffer (StringChar);
+
+DoCharacter:
+
+ switch (State)
+ {
+ case ASL_NORMAL_CHAR:
+
+ switch (StringChar)
+ {
+ case '\\':
+ /*
+ * Special handling for backslash-escape sequence. We will
+ * toss the backslash and translate the escape char(s).
+ */
+ State = ASL_ESCAPE_SEQUENCE;
+ continue;
+
+ case '\"':
+
+ /* String terminator */
+
+ goto CompletedString;
+ }
+ break;
+
+
+ case ASL_ESCAPE_SEQUENCE:
+
+ State = ASL_NORMAL_CHAR;
+ switch (StringChar)
+ {
+ case 'a':
+ StringChar = 0x07; /* BELL */
+ break;
+
+ case 'b':
+ StringChar = 0x08; /* BACKSPACE */
+ break;
+
+ case 'f':
+ StringChar = 0x0C; /* FORMFEED */
+ break;
+
+ case 'n':
+ StringChar = 0x0A; /* LINEFEED */
+ break;
+
+ case 'r':
+ StringChar = 0x0D; /* CARRIAGE RETURN*/
+ break;
+
+ case 't':
+ StringChar = 0x09; /* HORIZONTAL TAB */
+ break;
+
+ case 'v':
+ StringChar = 0x0B; /* VERTICAL TAB */
+ break;
+
+ case 'x':
+ State = ASL_HEX_CONSTANT;
+ i = 0;
+ continue;
+
+ case '\'': /* Single Quote */
+ case '\"': /* Double Quote */
+ case '\\': /* Backslash */
+ break;
+
+ default:
+
+ /* Check for an octal digit (0-7) */
+
+ if (ACPI_IS_OCTAL_DIGIT (StringChar))
+ {
+ State = ASL_OCTAL_CONSTANT;
+ ConvertBuffer[0] = StringChar;
+ i = 1;
+ continue;
+ }
+
+ /* Unknown escape sequence issue warning, but use the character */
+
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ break;
+ }
+ break;
+
+
+ case ASL_OCTAL_CONSTANT:
+
+ /* Up to three octal digits allowed */
+
+ if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
+ (i > 2))
+ {
+ /*
+ * Reached end of the constant. Convert the assembled ASCII
+ * string and resume processing of the next character
+ */
+ ConvertBuffer[i] = 0;
+ Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
+
+ /* Check for NULL or non-ascii character (ignore if so) */
+
+ if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+ else
+ {
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
+ }
+
+ State = ASL_NORMAL_CHAR;
+ goto DoCharacter;
+ break;
+ }
+
+ /* Append another digit of the constant */
+
+ ConvertBuffer[i] = StringChar;
+ i++;
+ continue;
+
+
+ case ASL_HEX_CONSTANT:
+
+ /* Up to two hex digits allowed */
+
+ if (!ACPI_IS_XDIGIT (StringChar) ||
+ (i > 1))
+ {
+ /*
+ * Reached end of the constant. Convert the assembled ASCII
+ * string and resume processing of the next character
+ */
+ ConvertBuffer[i] = 0;
+ Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
+
+ /* Check for NULL or non-ascii character (ignore if so) */
+
+ if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+ else
+ {
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
+ }
+
+ State = ASL_NORMAL_CHAR;
+ goto DoCharacter;
+ break;
+ }
+
+ /* Append another digit of the constant */
+
+ ConvertBuffer[i] = StringChar;
+ i++;
+ continue;
+ }
+
+ /* Save the finished character */
+
+ *StringBuffer = StringChar;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
+ }
+
+ /*
+ * Premature End-Of-File
+ */
+ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+
+
+CompletedString:
+ /*
+ * Null terminate the input string and copy string to a new buffer
+ */
+ *StringBuffer = 0;
+
+ CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
+ if (!CleanString)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+ }
+
+ ACPI_STRCPY (CleanString, MsgBuffer);
+ AslCompilerlval.s = CleanString;
+ return (TRUE);
+
+
+BufferOverflow:
+
+ /* Literal was too long */
+
+ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
+ return (FALSE);
+}
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);
}
diff --git a/source/compiler/preprocess.h b/source/compiler/preprocess.h
index 09b7b7639376..920c0b9eac1a 100644
--- a/source/compiler/preprocess.h
+++ b/source/compiler/preprocess.h
@@ -124,13 +124,6 @@ typedef struct pr_file_node
} PR_FILE_NODE;
-typedef struct pr_line_mapping
-{
- UINT32 *Map;
- struct pr_line_mapping *Next;
-
-} PR_LINE_MAPPING;
-
/*
* Globals
@@ -140,7 +133,6 @@ PR_EXTERN char Gbl_MainTokenBuffer[ASL_LINE_BUFFER_SIZE];
PR_EXTERN char Gbl_MacroTokenBuffer[ASL_LINE_BUFFER_SIZE];
PR_EXTERN char Gbl_ExpressionTokenBuffer[ASL_LINE_BUFFER_SIZE];
-PR_EXTERN PR_LINE_MAPPING *Gbl_MapBlockHead;
PR_EXTERN PR_FILE_NODE *Gbl_InputFileList;
PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
PR_EXTERN UINT32 Gbl_PreprocessorLineNumber;
@@ -167,10 +159,6 @@ BOOLEAN
PrDoPreprocess (
void);
-UINT32
-PrGetLineNumber (
- UINT32 PreprocessorLineNumber);
-
UINT64
PrIsDefined (
char *Identifier);
@@ -252,11 +240,6 @@ PrGetNextToken (
char **Next);
void
-PrSetLineNumber (
- UINT32 OriginalLineNumber,
- UINT32 NewLineNumber);
-
-void
PrError (
UINT8 Level,
UINT8 MessageId,
diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c
index 3719ca6ec18f..3013951b06dd 100644
--- a/source/compiler/prscan.c
+++ b/source/compiler/prscan.c
@@ -161,9 +161,6 @@ PrInitializeGlobals (
Gbl_CurrentLineNumber = 0;
Gbl_PreprocessorLineNumber = 1;
Gbl_PreprocessorError = FALSE;
-
- Gbl_MapBlockHead = UtLocalCalloc (sizeof (PR_LINE_MAPPING));
- Gbl_MapBlockHead->Map = UtLocalCalloc (PR_LINES_PER_BLOCK * sizeof (UINT32));
}
@@ -186,7 +183,6 @@ PrTerminatePreprocessor (
void)
{
PR_DEFINE_INFO *DefineInfo;
- PR_LINE_MAPPING *MapInfo;
/*
@@ -202,17 +198,6 @@ PrTerminatePreprocessor (
ACPI_FREE (DefineInfo->Identifier);
ACPI_FREE (DefineInfo);
}
-
- /* Clear the line number mappings */
-
- while (Gbl_MapBlockHead)
- {
- MapInfo = Gbl_MapBlockHead;
- Gbl_MapBlockHead = MapInfo->Next;
-
- ACPI_FREE (MapInfo->Map);
- ACPI_FREE (MapInfo);
- }
}
@@ -393,8 +378,6 @@ PrPreprocessInputFile (
Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next);
}
- /* Write the possibly modified line to the .i file*/
-
#if 0
/* Line prefix */
FlPrintFile (ASL_FILE_PREPROCESSOR, "/* %14s %.5u i:%.5u */ ",
@@ -402,11 +385,27 @@ PrPreprocessInputFile (
Gbl_CurrentLineNumber, Gbl_PreprocessorLineNumber);
#endif
- FlWriteFile (ASL_FILE_PREPROCESSOR, Gbl_CurrentLineBuffer,
- strlen (Gbl_CurrentLineBuffer));
+ /*
+ * Emit a #line directive if necessary, to keep the line numbers in
+ * the (.i) file synchronized with the original source code file, so
+ * that the correct line number appears in any error messages
+ * generated by the actual compiler.
+ */
+ if (Gbl_CurrentLineNumber > (Gbl_PreviousLineNumber + 1))
+ {
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u\n",
+ Gbl_CurrentLineNumber);
+ }
- PrSetLineNumber (Gbl_CurrentLineNumber, Gbl_PreprocessorLineNumber);
+ Gbl_PreviousLineNumber = Gbl_CurrentLineNumber;
Gbl_PreprocessorLineNumber++;
+
+ /*
+ * Now we can write the possibly modified source line to the
+ * preprocessor (.i) file
+ */
+ FlWriteFile (ASL_FILE_PREPROCESSOR, Gbl_CurrentLineBuffer,
+ strlen (Gbl_CurrentLineBuffer));
}
}
@@ -546,8 +545,9 @@ PrDoDirective (
if (*(&Gbl_CurrentLineBuffer[TokenOffset]) == '(')
{
#ifndef MACROS_SUPPORTED
- AcpiOsPrintf ("#define macros not supported\n");
- goto SyntaxError;
+ AcpiOsPrintf ("%s ERROR - line %u: #define macros are not supported yet\n",
+ Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber);
+ exit(1);
#else
PrAddMacro (Token, Next);
#endif
@@ -660,6 +660,31 @@ PrDoDirective (
PrOpenIncludeFile (Token);
break;
+ case PR_DIRECTIVE_LINE:
+ TokenOffset = Token - Gbl_MainTokenBuffer;
+
+ Status = PrResolveIntegerExpression (
+ &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
+ "User #line invocation %s\n", Gbl_CurrentLineNumber,
+ Token);
+
+ /* Update local line numbers */
+
+ Gbl_CurrentLineNumber = (UINT32) Value;
+ Gbl_PreviousLineNumber = 0;
+
+ /* Emit #line into the preprocessor file */
+
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
+ Gbl_CurrentLineNumber, Gbl_Files[ASL_FILE_INPUT].Filename);
+ break;
+
case PR_DIRECTIVE_PRAGMA:
/* Only "#pragma message" supported at this time */
@@ -692,8 +717,6 @@ PrDoDirective (
THIS_TOKEN_OFFSET (Token));
break;
- case PR_DIRECTIVE_LINE:
- /* TBD: set line number -- or, do this in main compiler */
default:
/* Should never get here */
DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c
index 70a2edc605cc..a7c65bf54e38 100644
--- a/source/compiler/prutils.c
+++ b/source/compiler/prutils.c
@@ -49,100 +49,6 @@
ACPI_MODULE_NAME ("prutils")
-/*******************************************************************************
- *
- * FUNCTION: PrSetLineNumber
- *
- * PARAMETERS: OriginalLineNumber - Line number in original source file,
- * or include file
- * PreprocessorLineNumber - Line number in the preprocessed file
- *
- * RETURN: None
- *
- * DESCRIPTION: Insert this mapping into the mapping data structure, for use
- * in possible error/warning messages.
- *
- * Line number mapping functions.
- * For error messages, we need to keep track of the line number in the
- * original file, versus the preprocessed (.i) file.
- *
- ******************************************************************************/
-
-void
-PrSetLineNumber (
- UINT32 OriginalLineNumber,
- UINT32 PreprocessorLineNumber)
-{
- UINT32 Entry;
- PR_LINE_MAPPING *Block;
- UINT32 Index;
- UINT32 i;
-
-
- Entry = PreprocessorLineNumber / PR_LINES_PER_BLOCK;
- Index = PreprocessorLineNumber % PR_LINES_PER_BLOCK;
- Block = Gbl_MapBlockHead;
-
- for (i = 0; i < Entry; i++)
- {
- /* Allocate new mapping blocks as necessary */
-
- if (!Block->Next)
- {
- Block->Next = UtLocalCalloc (sizeof (PR_LINE_MAPPING));
- Block->Next->Map = UtLocalCalloc (PR_LINES_PER_BLOCK * sizeof (UINT32));
- }
-
- Block = Block->Next;
- }
-
- Block->Map[Index] = OriginalLineNumber;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: PrGetLineNumber
- *
- * PARAMETERS: PreprocessorLineNumber - Line number in the preprocessed file
- * (or, the "logical line number)
- *
- * RETURN: The line number in the original source file or include file.
- *
- * DESCRIPTION: Return the mapped value of a line number in the preprocessed
- * source file to the actual line number in the original source
- * file.
- *
- ******************************************************************************/
-
-UINT32
-PrGetLineNumber (
- UINT32 PreprocessorLineNumber)
-{
- UINT32 Entry;
- PR_LINE_MAPPING *Block;
- UINT32 Index;
- UINT32 i;
-
-
- Entry = PreprocessorLineNumber / PR_LINES_PER_BLOCK;
- Index = PreprocessorLineNumber % PR_LINES_PER_BLOCK;
- Block = Gbl_MapBlockHead;
-
- for (i = 0; i < Entry; i++)
- {
- Block = Block->Next;
- if (!Block)
- {
- /* Bad error, should not happen */
- return (0);
- }
- }
-
- return (Block->Map[Index]);
-}
-
-
/******************************************************************************
*
* FUNCTION: PrGetNextToken
@@ -486,14 +392,20 @@ PrPushInputFileStack (
Gbl_InputFileList = Fnode;
DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
- "Push InputFile Stack, returning %p\n\n",
+ "Push InputFile Stack: handle %p\n\n",
Gbl_CurrentLineNumber, InputFile);
/* Reset the global line count and filename */
Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
- Gbl_CurrentLineNumber = 1;
+ Gbl_PreviousLineNumber = 0;
+ Gbl_CurrentLineNumber = 0;
+
+ /* Emit a new #line directive for the include file */
+
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
+ 1, Filename);
}
@@ -542,6 +454,12 @@ PrPopInputFileStack (
Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
Gbl_Files[ASL_FILE_INPUT].Handle = Fnode->File;
Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
+ Gbl_PreviousLineNumber = 0;
+
+ /* Emit a new #line directive after the include file */
+
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
+ Gbl_CurrentLineNumber + 1, Fnode->Filename);
/* All done with this node */