mirror of
https://github.com/acpica/acpica/
synced 2025-02-05 08:04:11 +03:00
New help messages, added support for hex output in C or ASM
date 2002.01.31.23.08.00; author rmoore1; state Exp;
This commit is contained in:
parent
9780199b88
commit
da393afa12
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslfiles - file I/O suppoert
|
||||
* $Revision: 1.28 $
|
||||
* $Revision: 1.29 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -737,7 +737,6 @@ FlOpenMiscOutputFiles (
|
||||
|
||||
FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+");
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
|
||||
AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
|
||||
AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslglobal.h - Global variable definitions
|
||||
* $Revision: 1.22 $
|
||||
* $Revision: 1.23 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -175,13 +175,17 @@ EXTERN BOOLEAN INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_DebugFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_C_OutputFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_HexOutputFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_ListingFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_IgnoreErrors, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
|
||||
|
||||
#define HEX_OUTPUT_NONE 0
|
||||
#define HEX_OUTPUT_C 1
|
||||
#define HEX_OUTPUT_ASM 2
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE);
|
||||
|
||||
|
||||
/* Files */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: asllisting - Listing file generation
|
||||
* $Revision: 1.30 $
|
||||
* $Revision: 1.31 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -982,7 +982,7 @@ LsDumpAscii (
|
||||
for (i = 0; i < Count; i++)
|
||||
{
|
||||
BufChar = Buffer[i];
|
||||
if (isascii (BufChar))
|
||||
if (isprint (BufChar))
|
||||
{
|
||||
FlPrintFile (FileId, "%c", BufChar);
|
||||
}
|
||||
@ -993,7 +993,6 @@ LsDumpAscii (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: LsDoHexOutput
|
||||
@ -1002,6 +1001,36 @@ LsDumpAscii (
|
||||
*
|
||||
* RETURN: None.
|
||||
*
|
||||
* DESCRIPTION: Create the hex output file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
void
|
||||
LsDoHexOutput (void)
|
||||
{
|
||||
|
||||
switch (Gbl_HexOutputFlag)
|
||||
{
|
||||
case HEX_OUTPUT_C:
|
||||
LsDoHexOutputC ();
|
||||
break;
|
||||
|
||||
case HEX_OUTPUT_ASM:
|
||||
LsDoHexOutputAsm ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: LsDoHexOutputC
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None.
|
||||
*
|
||||
* DESCRIPTION: Create the hex output file. This is the same data as the AML
|
||||
* output file, but formatted into hex/ascii bytes suitable for
|
||||
* inclusion into a C source file.
|
||||
@ -1011,7 +1040,7 @@ LsDumpAscii (
|
||||
#define HEX_CHARS_PER_LINE 8
|
||||
|
||||
void
|
||||
LsDoHexOutput (void)
|
||||
LsDoHexOutputC (void)
|
||||
{
|
||||
UINT32 j;
|
||||
UINT8 FileByte[HEX_CHARS_PER_LINE];
|
||||
@ -1019,10 +1048,6 @@ LsDoHexOutput (void)
|
||||
UINT32 Offset = 0;
|
||||
|
||||
|
||||
if (!Gbl_HexOutputFlag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] = \n{\n");
|
||||
@ -1071,7 +1096,7 @@ LsDoHexOutput (void)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: LsDoAsmOutput
|
||||
* FUNCTION: LsDoHexOutputAsm
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
@ -1079,7 +1104,7 @@ LsDoHexOutput (void)
|
||||
*
|
||||
* DESCRIPTION: Create the hex output file. This is the same data as the AML
|
||||
* output file, but formatted into hex/ascii bytes suitable for
|
||||
* inclusion into a C source file.
|
||||
* inclusion into a ASM source file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -1087,7 +1112,7 @@ LsDoHexOutput (void)
|
||||
|
||||
|
||||
void
|
||||
LsDoAsmOutput (void)
|
||||
LsDoHexOutputAsm (void)
|
||||
{
|
||||
UINT32 j;
|
||||
UINT8 FileByte[HEX_CHARS_PER_LINE];
|
||||
@ -1096,12 +1121,8 @@ LsDoAsmOutput (void)
|
||||
BOOLEAN DoComma = FALSE;
|
||||
|
||||
|
||||
if (!Gbl_AsmOutputFlag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_ASM_SOURCE_OUTPUT, "; Assembly code source output\n;\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n;\n");
|
||||
|
||||
/* Start at the beginning of the AML file */
|
||||
|
||||
@ -1114,11 +1135,11 @@ LsDoAsmOutput (void)
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_ASM_SOURCE_OUTPUT, " db ");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
|
||||
}
|
||||
else if (DoComma)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_ASM_SOURCE_OUTPUT, ",");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
DoComma = FALSE;
|
||||
}
|
||||
|
||||
@ -1126,7 +1147,7 @@ LsDoAsmOutput (void)
|
||||
* Convert each AML byte to hex
|
||||
*/
|
||||
UtConvertByteToAsmHex (FileByte[j], Buffer);
|
||||
FlWriteFile (ASL_FILE_ASM_SOURCE_OUTPUT, Buffer, 4);
|
||||
FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
|
||||
|
||||
/* An occasional linefeed improves readability */
|
||||
|
||||
@ -1134,12 +1155,12 @@ LsDoAsmOutput (void)
|
||||
j++;
|
||||
if (j >= ASM_HEX_CHARS_PER_LINE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_ASM_SOURCE_OUTPUT, " ;%8.8X \"", Offset - ASM_HEX_CHARS_PER_LINE);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ;%8.8X \"", Offset - ASM_HEX_CHARS_PER_LINE);
|
||||
|
||||
/* Write the ASCII character associated with each of the bytes */
|
||||
|
||||
LsDumpAscii (ASL_FILE_ASM_SOURCE_OUTPUT, ASM_HEX_CHARS_PER_LINE, FileByte);
|
||||
FlPrintFile (ASL_FILE_ASM_SOURCE_OUTPUT, "\"\n");
|
||||
LsDumpAscii (ASL_FILE_HEX_OUTPUT, ASM_HEX_CHARS_PER_LINE, FileByte);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\"\n");
|
||||
j = 0;
|
||||
}
|
||||
else
|
||||
@ -1148,8 +1169,8 @@ LsDoAsmOutput (void)
|
||||
}
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_ASM_SOURCE_OUTPUT, "\n");
|
||||
FlCloseFile (ASL_FILE_ASM_SOURCE_OUTPUT);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
FlCloseFile (ASL_FILE_HEX_OUTPUT);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslmain - compiler main and utilities
|
||||
* $Revision: 1.40 $
|
||||
* $Revision: 1.41 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -129,6 +129,36 @@ char hex[] = {'0','1','2','3','4','5','6','7',
|
||||
'8','9','A','B','C','D','E','F'};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: Options
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Display option help message
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
Options (
|
||||
void)
|
||||
{
|
||||
printf ("Options:\n");
|
||||
printf (" -a Create AML in a assembler source code file (*.asm)\n");
|
||||
printf (" -c Create AML in a C source code file (*.c)\n");
|
||||
printf (" -h Additional help and compiler debug options\n");
|
||||
printf (" -i Ignore errors, always create AML output file(s)\n");
|
||||
printf (" -l Create listing file (mixed ASL source and AML) (*.lst)\n");
|
||||
printf (" -n Create namespace file (*.nsp)\n");
|
||||
printf (" -o <name> Specify filename prefix for all output files\n");
|
||||
printf (" (including the .aml file)\n");
|
||||
printf (" -s Create combined (w/includes) ASL file (*.src)\n");
|
||||
printf (" -t <a|c> Create AML hex table in assembler or C (*.hex)\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: Usage
|
||||
@ -141,26 +171,48 @@ char hex[] = {'0','1','2','3','4','5','6','7',
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
HelpMessage (
|
||||
void)
|
||||
{
|
||||
printf ("Output Filename generation:\n");
|
||||
printf (" Output filenames are generated by appending an extension to a common\n");
|
||||
printf (" filename prefix. The filename prefix is obtained via one of the\n");
|
||||
printf (" following methods (in priority order):\n");
|
||||
printf (" 1) The -o option specifies the prefix\n");
|
||||
printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n");
|
||||
printf (" 3) The prefix of the input filename\n");
|
||||
printf ("\n");
|
||||
|
||||
Options ();
|
||||
|
||||
printf ("\nCompiler Debug Options:\n");
|
||||
printf (" -d <p|t|b> Create compiler debug/trace file (*.txt)\n");
|
||||
printf (" Types: Parse/Tree/Both\n");
|
||||
printf (" -p Parse only, no output generation\n");
|
||||
printf (" -x Display compile times\n");
|
||||
printf (" -v <trace level> Set debug level for trace output\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: Usage
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Display usage and option message
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
Usage (
|
||||
void)
|
||||
{
|
||||
printf ("Usage: %s <Options> <InputFile>\n\n", CompilerName);
|
||||
printf ("Options: -a Create hex assembly source file (*.asm)\n");
|
||||
printf (" -c Create hex C source file (*.c)\n");
|
||||
printf (" -i Ignore errors, always create AML file\n");
|
||||
printf (" -l Create listing (mixed source/AML) file (*.lst)\n");
|
||||
printf (" -n Create namespace file (*.nsp)\n");
|
||||
printf (" -o <name> Specify filename prefix for all output files\n");
|
||||
printf (" (including the .aml file)\n");
|
||||
printf (" -s Create combined (w/includes) ASL file (*.src)\n");
|
||||
printf (" -t [a|c] Create hex table in ASM or C (*.hex)\n");
|
||||
printf ("\nCompiler Debug Options:\n");
|
||||
printf (" -d <p|t|b> Create compiler debug/trace file (*.txt)\n");
|
||||
printf (" Types: Parse/Tree/Both\n");
|
||||
printf (" -p Parse only, no output generation\n");
|
||||
printf (" -x Display compile times\n");
|
||||
printf (" -v <trace level> Set debug level for trace output\n");
|
||||
Options ();
|
||||
}
|
||||
|
||||
|
||||
@ -234,7 +286,7 @@ main (
|
||||
|
||||
/* Get the command line options */
|
||||
|
||||
while ((j = getopt (argc, argv, "acd:ilno:pstvx:")) != EOF) switch (j)
|
||||
while ((j = getopt (argc, argv, "acd:hilno:pst:vx")) != EOF) switch (j)
|
||||
{
|
||||
case 'a':
|
||||
/* Produce assembly code output file */
|
||||
@ -261,6 +313,10 @@ main (
|
||||
|
||||
case 't':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("Unknown option: -d%s\n", optarg);
|
||||
BadCommandLine = TRUE;
|
||||
}
|
||||
|
||||
/* Produce debug output file */
|
||||
@ -268,6 +324,11 @@ main (
|
||||
Gbl_DebugFlag = TRUE;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
|
||||
HelpMessage ();
|
||||
return 0;
|
||||
|
||||
case 'i':
|
||||
/* Ignore errors and always attempt to create aml file */
|
||||
|
||||
@ -308,7 +369,25 @@ main (
|
||||
case 't':
|
||||
/* Produce hex table output file */
|
||||
|
||||
Gbl_HexOutputFlag = TRUE;
|
||||
switch (optarg[0])
|
||||
{
|
||||
case 'a':
|
||||
Gbl_HexOutputFlag = HEX_OUTPUT_ASM;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
Gbl_HexOutputFlag = HEX_OUTPUT_C;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("Unknown option: -t%s\n", optarg);
|
||||
BadCommandLine = TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
AcpiDbgLevel = strtoul (optarg, NULL, 16);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
@ -317,10 +396,6 @@ main (
|
||||
Gbl_CompileTimesFlag = TRUE;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
AcpiDbgLevel = strtoul (optarg, NULL, 16);
|
||||
break;
|
||||
|
||||
default:
|
||||
BadCommandLine = TRUE;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user