mirror of
https://github.com/acpica/acpica/
synced 2024-12-27 04:39:46 +03:00
iASL: Fix NULLs emitted in listing files.
Also, explicitly open all output files as either binary or text, do not make any assumptions about the default type.
This commit is contained in:
parent
8274bb02a7
commit
6759985074
@ -413,7 +413,7 @@ AePrintException (
|
||||
|
||||
if (Gbl_VerboseErrors)
|
||||
{
|
||||
fprintf (OutputFile, "%s %4.4d - ",
|
||||
fprintf (OutputFile, "%s %4.4d -",
|
||||
AslErrorLevel[Enode->Level],
|
||||
Enode->MessageId + ((Enode->Level+1) * 1000));
|
||||
}
|
||||
|
@ -826,7 +826,7 @@ FlOpenInputFile (
|
||||
|
||||
/* Open the input ASL file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_INPUT, InputFilename, "r");
|
||||
FlOpenFile (ASL_FILE_INPUT, InputFilename, "rt");
|
||||
AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle;
|
||||
|
||||
return (AE_OK);
|
||||
@ -910,7 +910,7 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
/* Open the hex file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+");
|
||||
FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+t");
|
||||
|
||||
AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
|
||||
AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
|
||||
@ -961,7 +961,7 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
/* Open the listing file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+");
|
||||
FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+t");
|
||||
|
||||
AslCompilerSignon (ASL_FILE_LISTING_OUTPUT);
|
||||
AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
|
||||
@ -979,7 +979,7 @@ FlOpenMiscOutputFiles (
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b");
|
||||
FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t");
|
||||
}
|
||||
|
||||
/* All done for data table compiler */
|
||||
@ -1024,7 +1024,7 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
/* Open the assembly code source file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+");
|
||||
FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+t");
|
||||
|
||||
AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT);
|
||||
AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT);
|
||||
@ -1044,7 +1044,7 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
/* Open the C code source file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+");
|
||||
FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+t");
|
||||
|
||||
FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n");
|
||||
AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT);
|
||||
@ -1065,7 +1065,7 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
/* Open the assembly include file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+");
|
||||
FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+t");
|
||||
|
||||
AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT);
|
||||
AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT);
|
||||
@ -1085,7 +1085,7 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
/* Open the C include file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+");
|
||||
FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+t");
|
||||
|
||||
FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n");
|
||||
AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT);
|
||||
@ -1106,7 +1106,7 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
/* Open the namespace file, text mode */
|
||||
|
||||
FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+");
|
||||
FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+t");
|
||||
|
||||
AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT);
|
||||
AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT);
|
||||
|
@ -164,19 +164,23 @@ static void
|
||||
AslDoLineDirective (
|
||||
void)
|
||||
{
|
||||
char c;
|
||||
UINT8 c;
|
||||
char *Token;
|
||||
UINT32 LineNumber;
|
||||
char *Filename;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Eat the entire line that contains the #line directive */
|
||||
|
||||
while ((c = (char) input()) != '\n' && c != EOF)
|
||||
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
|
||||
|
||||
while ((c = (UINT8) input()) != '\n' && c != EOF)
|
||||
{
|
||||
AslInsertLineBuffer (c);
|
||||
*Gbl_LineBufPtr = c;
|
||||
Gbl_LineBufPtr++;
|
||||
}
|
||||
AslInsertLineBuffer (0);
|
||||
*Gbl_LineBufPtr = 0;
|
||||
|
||||
/* First argument is the actual line number */
|
||||
|
||||
@ -186,10 +190,23 @@ AslDoLineDirective (
|
||||
goto ResetAndExit;
|
||||
}
|
||||
|
||||
/* Convert line number. Subtract one to handle _this_ line */
|
||||
/* First argument is the line number */
|
||||
|
||||
LineNumber = (UINT32) UtDoConstant (Token);
|
||||
FlSetLineNumber (LineNumber - 1);
|
||||
|
||||
/* Emit the appropriate number of newlines */
|
||||
|
||||
Gbl_CurrentColumn = 0;
|
||||
if (LineNumber > Gbl_CurrentLineNumber)
|
||||
{
|
||||
for (i = 0; i < (LineNumber - Gbl_CurrentLineNumber); i++)
|
||||
{
|
||||
FlWriteFile (ASL_FILE_SOURCE_OUTPUT, "\n", 1);
|
||||
Gbl_CurrentColumn++;
|
||||
}
|
||||
}
|
||||
|
||||
FlSetLineNumber (LineNumber);
|
||||
|
||||
/* Second argument is the optional filename (in double quotes) */
|
||||
|
||||
@ -204,7 +221,12 @@ AslDoLineDirective (
|
||||
/* Third argument is not supported at this time */
|
||||
|
||||
ResetAndExit:
|
||||
AslResetCurrentLineBuffer ();
|
||||
|
||||
/* Reset globals for a new line */
|
||||
|
||||
Gbl_CurrentLineOffset += Gbl_CurrentColumn;
|
||||
Gbl_CurrentColumn = 0;
|
||||
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user