diff options
Diffstat (limited to 'source/tools/acpixtract/acpixtract.c')
-rw-r--r-- | source/tools/acpixtract/acpixtract.c | 60 |
1 files changed, 49 insertions, 11 deletions
diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c index efed936..c06e375 100644 --- a/source/tools/acpixtract/acpixtract.c +++ b/source/tools/acpixtract/acpixtract.c @@ -95,6 +95,9 @@ AxConvertLine ( char *InputLine, unsigned char *OutputData); +static int +AxIsEmptyLine ( + char *Buffer); typedef struct AxTableInfo { @@ -181,6 +184,41 @@ AxCheckAscii ( } +/****************************************************************************** + * + * FUNCTION: AxIsEmptyLine + * + * PARAMETERS: Buffer - Line from input file + * + * RETURN: TRUE if line is empty (zero or more blanks only) + * + * DESCRIPTION: Determine if an input line is empty. + * + ******************************************************************************/ + +static int +AxIsEmptyLine ( + char *Buffer) +{ + + /* Skip all spaces */ + + while (*Buffer == ' ') + { + Buffer++; + } + + /* If end-of-line, this line is empty */ + + if (*Buffer == '\n') + { + return (1); + } + + return (0); +} + + /******************************************************************************* * * FUNCTION: AxNormalizeSignature @@ -345,8 +383,8 @@ AxCountTableInstances ( { /* Ignore empty lines and lines that start with a space */ - if ((InstanceBuffer[0] == ' ') || - (InstanceBuffer[0] == '\n')) + if (AxIsEmptyLine (InstanceBuffer) || + (InstanceBuffer[0] == ' ')) { continue; } @@ -506,8 +544,8 @@ AxExtractTables ( /* Ignore empty lines and lines that start with a space */ - if ((LineBuffer[0] == ' ') || - (LineBuffer[0] == '\n')) + if (AxIsEmptyLine (LineBuffer) || + (LineBuffer[0] == ' ')) { continue; } @@ -574,7 +612,7 @@ AxExtractTables ( /* Empty line or non-data line terminates the data */ - if ((LineBuffer[0] == '\n') || + if (AxIsEmptyLine (LineBuffer) || (LineBuffer[0] != ' ')) { fclose (OutputFile); @@ -672,15 +710,15 @@ AxListTables ( /* Dump the headers for all tables found in the input file */ - printf ("\nSignature Length Revision OemId OemTableId" + printf ("\nSignature Length Revision OemId OemTableId" " OemRevision CompilerId CompilerRevision\n\n"); while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { /* Ignore empty lines and lines that start with a space */ - if ((LineBuffer[0] == ' ') || - (LineBuffer[0] == '\n')) + if (AxIsEmptyLine (LineBuffer) || + (LineBuffer[0] == ' ')) { continue; } @@ -698,7 +736,7 @@ AxListTables ( if (!strncmp (TableHeader->Signature, "RSD PTR ", 8)) { AxCheckAscii ((char *) &Header[9], 6); - printf ("%8.4s \"%6.6s\"\n", "RSDP", &Header[9]); + printf ("%7.4s \"%6.6s\"\n", "RSDP", &Header[9]); TableCount++; continue; } @@ -713,7 +751,7 @@ AxListTables ( /* Signature and Table length */ TableCount++; - printf ("%8.4s % 7d", TableHeader->Signature, TableHeader->Length); + printf ("%7.4s 0x%8.8X", TableHeader->Signature, TableHeader->Length); /* FACS has only signature and length */ @@ -729,7 +767,7 @@ AxListTables ( AxCheckAscii (TableHeader->OemTableId, 8); AxCheckAscii (TableHeader->AslCompilerId, 4); - printf (" %2.2X \"%6.6s\" \"%8.8s\" %8.8X \"%4.4s\" %8.8X\n", + printf (" 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X \"%4.4s\" 0x%8.8X\n", TableHeader->Revision, TableHeader->OemId, TableHeader->OemTableId, TableHeader->OemRevision, TableHeader->AslCompilerId, TableHeader->AslCompilerRevision); |