From 028796dce74ef75a062873219e448a6aa76e0f97 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Thu, 15 Mar 2012 13:17:13 -0700 Subject: [PATCH] Disassembler: Emit .DSL file size in summary. Emit summary in the same format as the iASL compiler, including the disassembled file size. --- source/common/adisasm.c | 48 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 3b0719515..6cd67c70d 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -147,6 +147,10 @@ LsSetupNsList ( /* Local prototypes */ +static UINT32 +AdGetFileSize ( + FILE *File); + static void AdCreateTableHeader ( char *Filename, @@ -230,6 +234,38 @@ static ACPI_TABLE_DESC LocalTables[1]; static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; +/******************************************************************************* + * + * FUNCTION: AdGetFileSize + * + * PARAMETERS: File - Open file handle + * + * RETURN: File Size + * + * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. + * + ******************************************************************************/ + +static UINT32 +AdGetFileSize ( + FILE *File) +{ + UINT32 FileSize; + long Offset; + + + Offset = ftell (File); + + fseek (File, 0, SEEK_END); + FileSize = (UINT32) ftell (File); + + /* Restore file pointer */ + + fseek (File, Offset, SEEK_SET); + return (FileSize); +} + + /******************************************************************************* * * FUNCTION: AdInitialize @@ -452,8 +488,10 @@ AdAmlDisassemble ( "FieldName : FieldValue\n */\n\n"); AcpiDmDumpDataTable (Table); - fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n", - Table->Signature, DisasmFilename); + fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", + Table->Signature); + fprintf (stderr, "Formatted output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } else { @@ -562,9 +600,9 @@ AdAmlDisassemble ( if (AcpiGbl_DbOpt_disasm) { AdDisplayTables (Filename, Table); - fprintf (stderr, - "Disassembly completed, written to \"%s\"\n", - DisasmFilename); + fprintf (stderr, "Disassembly completed\n"); + fprintf (stderr, "ASL Output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } }