aboutsummaryrefslogtreecommitdiff
path: root/source/compiler/dtcompile.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/dtcompile.c')
-rw-r--r--source/compiler/dtcompile.c84
1 files changed, 52 insertions, 32 deletions
diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c
index 09cb3e6c4a2e..b6a144feb2bf 100644
--- a/source/compiler/dtcompile.c
+++ b/source/compiler/dtcompile.c
@@ -161,7 +161,7 @@ static char VersionString[9];
/* Local prototypes */
-static ACPI_STATUS
+void
DtInitialize (
void);
@@ -196,16 +196,12 @@ DtDoCompile (
ACPI_STATUS Status;
UINT8 Event;
DT_FIELD *FieldList;
+ ASL_GLOBAL_FILE_NODE *FileNode;
/* Initialize globals */
- Status = DtInitialize ();
- if (ACPI_FAILURE (Status))
- {
- printf ("Error during compiler initialization, 0x%X\n", Status);
- return (Status);
- }
+ DtInitialize ();
/* Preprocessor */
@@ -223,13 +219,29 @@ DtDoCompile (
}
}
- /*
- * Scan the input file (file is already open) and
- * build the parse tree
- */
- Event = UtBeginEvent ("Scan and parse input file");
- FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle);
- UtEndEvent (Event);
+ /* Compile the parse tree */
+
+ if (AslGbl_DtLexBisonPrototype)
+ {
+ Event = UtBeginEvent ("Parse data table in prototype mode");
+
+ DtCompilerInitLexer (AslGbl_Files[ASL_FILE_INPUT].Handle);
+ DtCompilerParserparse ();
+ FieldList = AslGbl_FieldList;
+ DtCompilerTerminateLexer ();
+
+ UtEndEvent (Event);
+ }
+ else
+ {
+ /*
+ * Scan the input file (file is already open) and
+ * build the parse tree
+ */
+ Event = UtBeginEvent ("Scan and parse input file");
+ FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle);
+ UtEndEvent (Event);
+ }
/* Did the parse tree get successfully constructed? */
@@ -245,14 +257,27 @@ DtDoCompile (
Event = UtBeginEvent ("Compile parse tree");
- /*
- * Compile the parse tree
- */
Status = DtCompileDataTable (&FieldList);
UtEndEvent (Event);
+ FileNode = FlGetCurrentFileNode ();
+ if (!FileNode)
+ {
+ fprintf (stderr, "Summary for %s could not be generated",
+ AslGbl_Files[ASL_FILE_INPUT].Filename);
+ }
+ else
+ {
+ FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
+ FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
+ DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
+ FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
+ }
+
if (ACPI_FAILURE (Status))
{
+ FileNode->ParserErrorDetected = TRUE;
+
/* TBD: temporary error message. Msgs should come from function above */
DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
@@ -276,6 +301,14 @@ DtDoCompile (
HxDoHexOutput ();
DtWriteTableToListing ();
+ /* Save the compile time statistics to the current file node */
+
+ if (FileNode)
+ {
+ FileNode->TotalFields = AslGbl_InputFieldCount;
+ FileNode->OutputByteLength = AslGbl_TableLength;
+ }
+
return (Status);
}
@@ -293,25 +326,12 @@ DtDoCompile (
*
*****************************************************************************/
-static ACPI_STATUS
+void
DtInitialize (
void)
{
- ACPI_STATUS Status;
- Status = AcpiOsInitialize ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- Status = AcpiUtInitGlobals ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */
AslGbl_FieldList = NULL;
@@ -319,7 +339,7 @@ DtInitialize (
AslGbl_SubtableStack = NULL;
sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
- return (AE_OK);
+ return;
}