Home | History | Annotate | Line # | Download | only in compiler
asloptions.c revision 1.13
      1 /******************************************************************************
      2  *
      3  * Module Name: asloptions - compiler command line processing
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2020, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #include "aslcompiler.h"
     45 #include "acapps.h"
     46 #include "acdisasm.h"
     47 
     48 #define _COMPONENT          ACPI_COMPILER
     49         ACPI_MODULE_NAME    ("asloption")
     50 
     51 
     52 /* Local prototypes */
     53 
     54 static int
     55 AslDoOptions (
     56     int                     argc,
     57     char                    **argv,
     58     BOOLEAN                 IsResponseFile);
     59 
     60 static void
     61 AslMergeOptionTokens (
     62     char                    *InBuffer,
     63     char                    *OutBuffer);
     64 
     65 static int
     66 AslDoResponseFile (
     67     char                    *Filename);
     68 
     69 
     70 #define ASL_TOKEN_SEPARATORS    " \t\n"
     71 #define ASL_SUPPORTED_OPTIONS   "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^q^r:s|t|T+G^v^w|x:z"
     72 
     73 
     74 /*******************************************************************************
     75  *
     76  * FUNCTION:    AslCommandLine
     77  *
     78  * PARAMETERS:  argc/argv
     79  *
     80  * RETURN:      Last argv index
     81  *
     82  * DESCRIPTION: Command line processing
     83  *
     84  ******************************************************************************/
     85 
     86 int
     87 AslCommandLine (
     88     int                     argc,
     89     char                    **argv)
     90 {
     91     int                     BadCommandLine = 0;
     92     ACPI_STATUS             Status;
     93 
     94 
     95     /* Minimum command line contains at least the command and an input file */
     96 
     97     if (argc < 2)
     98     {
     99         Usage ();
    100         exit (1);
    101     }
    102 
    103     /* Process all command line options */
    104 
    105     BadCommandLine = AslDoOptions (argc, argv, FALSE);
    106 
    107     if (AslGbl_DoTemplates)
    108     {
    109         Status = DtCreateTemplates (argv);
    110         if (ACPI_FAILURE (Status))
    111         {
    112             exit (-1);
    113         }
    114         exit (0);
    115     }
    116 
    117     /* Next parameter must be the input filename */
    118 
    119     if (!argv[AcpiGbl_Optind] &&
    120         !AcpiGbl_DisasmFlag)
    121     {
    122         printf ("Missing input filename\n");
    123         BadCommandLine = TRUE;
    124     }
    125 
    126     if (AslGbl_DoSignon)
    127     {
    128         printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
    129         if (AslGbl_IgnoreErrors)
    130         {
    131             printf ("Ignoring all errors, forcing AML file generation\n\n");
    132         }
    133     }
    134 
    135     if (BadCommandLine)
    136     {
    137         printf ("Use -h option for help information\n");
    138         exit (1);
    139     }
    140 
    141     return (AcpiGbl_Optind);
    142 }
    143 
    144 
    145 /*******************************************************************************
    146  *
    147  * FUNCTION:    AslDoOptions
    148  *
    149  * PARAMETERS:  argc/argv           - Standard argc/argv
    150  *              IsResponseFile      - TRUE if executing a response file.
    151  *
    152  * RETURN:      Status
    153  *
    154  * DESCRIPTION: Command line option processing
    155  *
    156  ******************************************************************************/
    157 
    158 static int
    159 AslDoOptions (
    160     int                     argc,
    161     char                    **argv,
    162     BOOLEAN                 IsResponseFile)
    163 {
    164     ACPI_STATUS             Status;
    165     UINT32                  j;
    166 
    167 
    168     /* Get the command line options */
    169 
    170     while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch (j)
    171     {
    172     case '@':   /* Begin a response file */
    173 
    174         if (IsResponseFile)
    175         {
    176             printf ("Nested command files are not supported\n");
    177             return (-1);
    178         }
    179 
    180         if (AslDoResponseFile (AcpiGbl_Optarg))
    181         {
    182             return (-1);
    183         }
    184         break;
    185 
    186     case 'a':   /* Debug options */
    187 
    188         switch (AcpiGbl_Optarg[0])
    189         {
    190         case 'r':
    191 
    192             AslGbl_EnableReferenceTypechecking = TRUE;
    193             break;
    194 
    195         default:
    196 
    197             printf ("Unknown option: -a%s\n", AcpiGbl_Optarg);
    198             return (-1);
    199         }
    200 
    201         break;
    202 
    203 
    204     case 'b':   /* Debug options */
    205 
    206         switch (AcpiGbl_Optarg[0])
    207         {
    208 
    209         case 'c':
    210 
    211             printf ("Debug ASL to ASL+ conversion\n");
    212 
    213             AslGbl_DoAslConversion = TRUE;
    214             AslGbl_FoldConstants = FALSE;
    215             AslGbl_IntegerOptimizationFlag = FALSE;
    216             AslGbl_ReferenceOptimizationFlag = FALSE;
    217             AslGbl_OptimizeTrivialParseNodes = FALSE;
    218             AcpiGbl_CaptureComments = TRUE;
    219             AcpiGbl_DoDisassemblerOptimizations = FALSE;
    220             AcpiGbl_DebugAslConversion = TRUE;
    221             AcpiGbl_DmEmitExternalOpcodes = TRUE;
    222             AslGbl_DoExternalsInPlace = TRUE;
    223 
    224             return (0);
    225 
    226         case 'f':
    227 
    228             AslCompilerdebug = 1; /* same as yydebug */
    229             DtParserdebug = 1;
    230             PrParserdebug = 1;
    231             AslGbl_DebugFlag = TRUE;
    232             AslGbl_KeepPreprocessorTempFile = TRUE;
    233             break;
    234 
    235         case 'p':   /* Prune ASL parse tree */
    236 
    237             /* Get the required argument */
    238 
    239             if (AcpiGetoptArgument (argc, argv))
    240             {
    241                 return (-1);
    242             }
    243 
    244             AslGbl_PruneParseTree = TRUE;
    245             AslGbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
    246             break;
    247 
    248         case 's':
    249 
    250             AslGbl_DebugFlag = TRUE;
    251             break;
    252 
    253         case 't':
    254 
    255             /* Get the required argument */
    256 
    257             if (AcpiGetoptArgument (argc, argv))
    258             {
    259                 return (-1);
    260             }
    261 
    262             AslGbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
    263             break;
    264 
    265         default:
    266 
    267             printf ("Unknown option: -b%s\n", AcpiGbl_Optarg);
    268             return (-1);
    269         }
    270 
    271         break;
    272 
    273     case 'c':
    274 
    275         switch (AcpiGbl_Optarg[0])
    276         {
    277 
    278         case 'a':
    279 
    280             printf ("Convert ASL to ASL+ with comments\n");
    281             AslGbl_DoAslConversion = TRUE;
    282             AslGbl_FoldConstants = FALSE;
    283             AslGbl_IntegerOptimizationFlag = FALSE;
    284             AslGbl_ReferenceOptimizationFlag = FALSE;
    285             AslGbl_OptimizeTrivialParseNodes = FALSE;
    286             AcpiGbl_CaptureComments = TRUE;
    287             AcpiGbl_DoDisassemblerOptimizations = FALSE;
    288             AcpiGbl_DmEmitExternalOpcodes = TRUE;
    289             AslGbl_DoExternalsInPlace = TRUE;
    290 
    291             return (0);
    292 
    293         case 'r':
    294 
    295             AslGbl_NoResourceChecking = TRUE;
    296             break;
    297 
    298         default:
    299 
    300             printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
    301             return (-1);
    302         }
    303         break;
    304 
    305     case 'd':   /* Disassembler */
    306 
    307         switch (AcpiGbl_Optarg[0])
    308         {
    309         case '^':
    310 
    311             AslGbl_DoCompile = FALSE;
    312             break;
    313 
    314         case 'a':
    315 
    316             AslGbl_DoCompile = FALSE;
    317             AslGbl_DisassembleAll = TRUE;
    318             break;
    319 
    320         case 'b':   /* Do not convert buffers to resource descriptors */
    321 
    322             AcpiGbl_NoResourceDisassembly = TRUE;
    323             break;
    324 
    325         case 'c':
    326 
    327             break;
    328 
    329         case 'f':
    330 
    331             AcpiGbl_ForceAmlDisassembly = TRUE;
    332             break;
    333 
    334         case 'l':   /* Use legacy ASL code (not ASL+) for disassembly */
    335 
    336             AslGbl_DoCompile = FALSE;
    337             AcpiGbl_CstyleDisassembly = FALSE;
    338             break;
    339 
    340         default:
    341 
    342             printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
    343             return (-1);
    344         }
    345 
    346         AcpiGbl_DisasmFlag = TRUE;
    347         break;
    348 
    349     case 'D':   /* Define a symbol */
    350 
    351         PrAddDefine (AcpiGbl_Optarg, NULL, TRUE);
    352         break;
    353 
    354     case 'e':   /* External files for disassembler */
    355 
    356         /* Get entire list of external files */
    357 
    358         AcpiGbl_Optind--;
    359         argv[AcpiGbl_Optind] = AcpiGbl_Optarg;
    360 
    361         while (argv[AcpiGbl_Optind] &&
    362               (argv[AcpiGbl_Optind][0] != '-'))
    363         {
    364             Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]);
    365             if (ACPI_FAILURE (Status))
    366             {
    367                 printf ("Could not add %s to external list\n",
    368                     argv[AcpiGbl_Optind]);
    369                 return (-1);
    370             }
    371 
    372             AcpiGbl_Optind++;
    373         }
    374         break;
    375 
    376     case 'f':
    377 
    378         switch (AcpiGbl_Optarg[0])
    379         {
    380         case '^':   /* Ignore errors and force creation of aml file */
    381 
    382             AslGbl_IgnoreErrors = TRUE;
    383             break;
    384 
    385         case 'e':   /* Disassembler: Get external declaration file */
    386 
    387             if (AcpiGetoptArgument (argc, argv))
    388             {
    389                 return (-1);
    390             }
    391 
    392             AslGbl_ExternalRefFilename = AcpiGbl_Optarg;
    393             break;
    394 
    395         default:
    396 
    397             printf ("Unknown option: -f%s\n", AcpiGbl_Optarg);
    398             return (-1);
    399         }
    400         break;
    401 
    402     case 'G':
    403 
    404         AslGbl_CompileGeneric = TRUE;
    405         break;
    406 
    407     case 'g':   /* Get all ACPI tables */
    408 
    409         printf ("-g option is deprecated, use acpidump utility instead\n");
    410         exit (1);
    411 
    412     case 'h':
    413 
    414         switch (AcpiGbl_Optarg[0])
    415         {
    416         case '^':
    417 
    418             Usage ();
    419             exit (0);
    420 
    421         case 'c':
    422 
    423             UtDisplayConstantOpcodes ();
    424             exit (0);
    425 
    426         case 'd':
    427 
    428             AslDisassemblyHelp ();
    429             exit (0);
    430 
    431         case 'f':
    432 
    433             AslFilenameHelp ();
    434             exit (0);
    435 
    436         case 'r':
    437 
    438             /* reserved names */
    439 
    440             ApDisplayReservedNames ();
    441             exit (0);
    442 
    443         case 't':
    444 
    445             UtDisplaySupportedTables ();
    446             exit (0);
    447 
    448         default:
    449 
    450             printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
    451             return (-1);
    452         }
    453 
    454     case 'I':   /* Add an include file search directory */
    455 
    456         FlAddIncludeDirectory (AcpiGbl_Optarg);
    457         break;
    458 
    459     case 'i':   /* Output AML as an include file */
    460 
    461         switch (AcpiGbl_Optarg[0])
    462         {
    463         case 'a':
    464 
    465             /* Produce assembly code include file */
    466 
    467             AslGbl_AsmIncludeOutputFlag = TRUE;
    468             break;
    469 
    470         case 'c':
    471 
    472             /* Produce C include file */
    473 
    474             AslGbl_C_IncludeOutputFlag = TRUE;
    475             break;
    476 
    477         case 'n':
    478 
    479             /* Compiler/Disassembler: Ignore the NOOP operator */
    480 
    481             AcpiGbl_IgnoreNoopOperator = TRUE;
    482             break;
    483 
    484         default:
    485 
    486             printf ("Unknown option: -i%s\n", AcpiGbl_Optarg);
    487             return (-1);
    488         }
    489         break;
    490 
    491     case 'l':   /* Listing files */
    492 
    493         switch (AcpiGbl_Optarg[0])
    494         {
    495         case '^':
    496 
    497             /* Produce listing file (Mixed source/aml) */
    498 
    499             AslGbl_ListingFlag = TRUE;
    500             AcpiGbl_DmOpt_Listing = TRUE;
    501             break;
    502 
    503         case 'i':
    504 
    505             /* Produce preprocessor output file */
    506 
    507             AslGbl_PreprocessorOutputFlag = TRUE;
    508             break;
    509 
    510         case 'm':
    511 
    512             /* Produce hardware map summary file */
    513 
    514             AslGbl_MapfileFlag = TRUE;
    515             break;
    516 
    517         case 'n':
    518 
    519             /* Produce namespace file */
    520 
    521             AslGbl_NsOutputFlag = TRUE;
    522             break;
    523 
    524         case 's':
    525 
    526             /* Produce combined source file */
    527 
    528             AslGbl_SourceOutputFlag = TRUE;
    529             break;
    530 
    531         case 'x':
    532 
    533             /* Produce cross-reference file */
    534 
    535             AslGbl_CrossReferenceOutput = TRUE;
    536             break;
    537 
    538         default:
    539 
    540             printf ("Unknown option: -l%s\n", AcpiGbl_Optarg);
    541             return (-1);
    542         }
    543         break;
    544 
    545     case 'm':   /* Set line buffer size */
    546 
    547         AslGbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024;
    548         if (AslGbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE)
    549         {
    550             AslGbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE;
    551         }
    552         printf ("Line Buffer Size: %u\n", AslGbl_LineBufferSize);
    553         break;
    554 
    555     case 'n':   /* Parse only */
    556 
    557         AslGbl_ParseOnlyFlag = TRUE;
    558         break;
    559 
    560     case 'o':   /* Control compiler AML optimizations */
    561 
    562         switch (AcpiGbl_Optarg[0])
    563         {
    564         case 'a':
    565 
    566             /* Disable all optimizations */
    567 
    568             AslGbl_FoldConstants = FALSE;
    569             AslGbl_IntegerOptimizationFlag = FALSE;
    570             AslGbl_ReferenceOptimizationFlag = FALSE;
    571             AslGbl_OptimizeTrivialParseNodes = FALSE;
    572 
    573             break;
    574 
    575         case 'c':
    576 
    577             /* Display compile time(s) */
    578 
    579             AslGbl_CompileTimesFlag = TRUE;
    580             break;
    581 
    582         case 'd':
    583 
    584             /* Disable disassembler code optimizations */
    585 
    586             AcpiGbl_DoDisassemblerOptimizations = FALSE;
    587             break;
    588 
    589         case 'e':
    590 
    591             /* Disassembler: Emit embedded external operators */
    592 
    593             AcpiGbl_DmEmitExternalOpcodes = TRUE;
    594             break;
    595 
    596         case 'E':
    597 
    598             /*
    599              * iASL: keep External opcodes in place.
    600              * No affect if Gbl_DoExternals is false.
    601              */
    602 
    603             AslGbl_DoExternalsInPlace = TRUE;
    604             break;
    605 
    606         case 'f':
    607 
    608             /* Disable folding on "normal" expressions */
    609 
    610             AslGbl_FoldConstants = FALSE;
    611             break;
    612 
    613         case 'i':
    614 
    615             /* Disable integer optimization to constants */
    616 
    617             AslGbl_IntegerOptimizationFlag = FALSE;
    618             break;
    619 
    620         case 'n':
    621 
    622             /* Disable named reference optimization */
    623 
    624             AslGbl_ReferenceOptimizationFlag = FALSE;
    625             break;
    626 
    627         case 't':
    628 
    629             /* Disable heavy typechecking */
    630 
    631             AslGbl_DoTypechecking = FALSE;
    632             break;
    633 
    634         default:
    635 
    636             printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
    637             return (-1);
    638         }
    639         break;
    640 
    641     case 'P':   /* Preprocessor options */
    642 
    643         switch (AcpiGbl_Optarg[0])
    644         {
    645         case '^':   /* Proprocess only, emit (.i) file */
    646 
    647             AslGbl_PreprocessOnly = TRUE;
    648             AslGbl_PreprocessorOutputFlag = TRUE;
    649             break;
    650 
    651         case 'n':   /* Disable preprocessor */
    652 
    653             AslGbl_PreprocessFlag = FALSE;
    654             break;
    655 
    656         default:
    657 
    658             printf ("Unknown option: -P%s\n", AcpiGbl_Optarg);
    659             return (-1);
    660         }
    661         break;
    662 
    663     case 'p':   /* Override default AML output filename */
    664 
    665         AslGbl_OutputFilenamePrefix = AcpiGbl_Optarg;
    666         UtConvertBackslashes (AslGbl_OutputFilenamePrefix);
    667         AslGbl_UseDefaultAmlFilename = FALSE;
    668         break;
    669 
    670     case 'q':   /* ASL/ASl+ converter: compile only and leave badaml. */
    671 
    672         printf ("Convert ASL to ASL+ with comments\n");
    673         AslGbl_FoldConstants = FALSE;
    674         AslGbl_IntegerOptimizationFlag = FALSE;
    675         AslGbl_ReferenceOptimizationFlag = FALSE;
    676         AslGbl_OptimizeTrivialParseNodes = FALSE;
    677         AslGbl_DoExternalsInPlace = TRUE;
    678         AcpiGbl_CaptureComments = TRUE;
    679         return (0);
    680 
    681     case 'r':   /* Override revision found in table header */
    682 
    683         AslGbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
    684         break;
    685 
    686     case 's':   /* Create AML in a source code file */
    687 
    688         switch (AcpiGbl_Optarg[0])
    689         {
    690         case 'a':
    691 
    692             /* Produce assembly code output file */
    693 
    694             AslGbl_AsmOutputFlag = TRUE;
    695             break;
    696 
    697         case 'c':
    698 
    699             /* Produce C hex output file */
    700 
    701             AslGbl_C_OutputFlag = TRUE;
    702             break;
    703 
    704         case 'o':
    705 
    706             /* Produce AML offset table in C */
    707 
    708             AslGbl_C_OffsetTableFlag = TRUE;
    709             break;
    710 
    711         default:
    712 
    713             printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
    714             return (-1);
    715         }
    716         break;
    717 
    718     case 't':   /* Produce hex table output file */
    719 
    720         switch (AcpiGbl_Optarg[0])
    721         {
    722         case 'a':
    723 
    724             AslGbl_HexOutputFlag = HEX_OUTPUT_ASM;
    725             break;
    726 
    727         case 'c':
    728 
    729             AslGbl_HexOutputFlag = HEX_OUTPUT_C;
    730             break;
    731 
    732     case 'p': /* data table flex/bison prototype */
    733 
    734             AslGbl_DtLexBisonPrototype = TRUE;
    735             break;
    736 
    737         case 's':
    738 
    739             AslGbl_HexOutputFlag = HEX_OUTPUT_ASL;
    740             break;
    741 
    742         default:
    743 
    744             printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
    745             return (-1);
    746         }
    747         break;
    748 
    749     case 'T':   /* Create a ACPI table template file */
    750 
    751         AslGbl_DoTemplates = TRUE;
    752         break;
    753 
    754     case 'v':   /* Version and verbosity settings */
    755 
    756         switch (AcpiGbl_Optarg[0])
    757         {
    758         case '^':
    759 
    760             printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
    761             exit (0);
    762 
    763         case 'a':
    764 
    765             /* Disable all error/warning/remark messages */
    766 
    767             AslGbl_NoErrors = TRUE;
    768             break;
    769 
    770         case 'd':
    771 
    772             printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
    773             printf (ACPI_COMMON_BUILD_TIME);
    774             exit (0);
    775 
    776         case 'e':
    777 
    778             /* Disable all warning/remark messages (errors only) */
    779 
    780             AslGbl_DisplayRemarks = FALSE;
    781             AslGbl_DisplayWarnings = FALSE;
    782             break;
    783 
    784         case 'i':
    785             /*
    786              * Support for integrated development environment(s).
    787              *
    788              * 1) No compiler signon
    789              * 2) Send stderr messages to stdout
    790              * 3) Less verbose error messages (single line only for each)
    791              * 4) Error/warning messages are formatted appropriately to
    792              *    be recognized by MS Visual Studio
    793              */
    794             AslGbl_VerboseErrors = FALSE;
    795             AslGbl_DoSignon = FALSE;
    796             break;
    797 
    798         case 'o':
    799 
    800             AslGbl_DisplayOptimizations = TRUE;
    801             break;
    802 
    803         case 'r':
    804 
    805             AslGbl_DisplayRemarks = FALSE;
    806             break;
    807 
    808         case 's':
    809 
    810             AslGbl_DoSignon = FALSE;
    811             break;
    812 
    813         case 't':
    814 
    815             AslGbl_VerboseTemplates = TRUE;
    816             break;
    817 
    818         case 'w':
    819 
    820             /* Get the required argument */
    821 
    822             if (AcpiGetoptArgument (argc, argv))
    823             {
    824                 return (-1);
    825             }
    826 
    827             Status = AslDisableException (AcpiGbl_Optarg);
    828             if (ACPI_FAILURE (Status))
    829             {
    830                 return (-1);
    831             }
    832             break;
    833 
    834         case 'x':
    835 
    836             /* Get the required argument */
    837 
    838             if (AcpiGetoptArgument (argc, argv))
    839             {
    840                 return (-1);
    841             }
    842 
    843             Status = AslLogExpectedException (AcpiGbl_Optarg);
    844             if (ACPI_FAILURE (Status))
    845             {
    846                 return (-1);
    847             }
    848             break;
    849 
    850         default:
    851 
    852             printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
    853             return (-1);
    854         }
    855         break;
    856 
    857     case 'w': /* Set warning levels */
    858 
    859         switch (AcpiGbl_Optarg[0])
    860         {
    861         case '1':
    862 
    863             AslGbl_WarningLevel = ASL_WARNING;
    864             break;
    865 
    866         case '2':
    867 
    868             AslGbl_WarningLevel = ASL_WARNING2;
    869             break;
    870 
    871         case '3':
    872 
    873             AslGbl_WarningLevel = ASL_WARNING3;
    874             break;
    875 
    876         case 'e':
    877 
    878             AslGbl_WarningsAsErrors = TRUE;
    879             break;
    880 
    881         case 'w':
    882 
    883             /* Get the required argument */
    884 
    885             if (AcpiGetoptArgument (argc, argv))
    886             {
    887                 return (-1);
    888             }
    889 
    890             Status = AslElevateException (AcpiGbl_Optarg);
    891             if (ACPI_FAILURE (Status))
    892             {
    893                 return (-1);
    894             }
    895             break;
    896 
    897 
    898         default:
    899 
    900             printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
    901             return (-1);
    902         }
    903         break;
    904 
    905     case 'x':   /* Set debug print output level */
    906 
    907         AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16);
    908         break;
    909 
    910     case 'z':
    911 
    912         AslGbl_UseOriginalCompilerId = TRUE;
    913         break;
    914 
    915     default:
    916 
    917         return (-1);
    918     }
    919 
    920     return (0);
    921 }
    922 
    923 
    924 /*******************************************************************************
    925  *
    926  * FUNCTION:    AslMergeOptionTokens
    927  *
    928  * PARAMETERS:  InBuffer            - Input containing an option string
    929  *              OutBuffer           - Merged output buffer
    930  *
    931  * RETURN:      None
    932  *
    933  * DESCRIPTION: Remove all whitespace from an option string.
    934  *
    935  ******************************************************************************/
    936 
    937 static void
    938 AslMergeOptionTokens (
    939     char                    *InBuffer,
    940     char                    *OutBuffer)
    941 {
    942     char                    *Token;
    943 
    944 
    945     *OutBuffer = 0;
    946 
    947     Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS);
    948     while (Token)
    949     {
    950         strcat (OutBuffer, Token);
    951         Token = strtok (NULL, ASL_TOKEN_SEPARATORS);
    952     }
    953 }
    954 
    955 
    956 /*******************************************************************************
    957  *
    958  * FUNCTION:    AslDoResponseFile
    959  *
    960  * PARAMETERS:  Filename        - Name of the response file
    961  *
    962  * RETURN:      Status
    963  *
    964  * DESCRIPTION: Open a response file and process all options within.
    965  *
    966  ******************************************************************************/
    967 
    968 static int
    969 AslDoResponseFile (
    970     char                    *Filename)
    971 {
    972     char                    *argv = AslGbl_StringBuffer2;
    973     FILE                    *ResponseFile;
    974     int                     OptStatus = 0;
    975     int                     Opterr;
    976     int                     Optind;
    977 
    978 
    979     ResponseFile = fopen (Filename, "r");
    980     if (!ResponseFile)
    981     {
    982         printf ("Could not open command file %s, %s\n",
    983             Filename, strerror (errno));
    984         return (-1);
    985     }
    986 
    987     /* Must save the current GetOpt globals */
    988 
    989     Opterr = AcpiGbl_Opterr;
    990     Optind = AcpiGbl_Optind;
    991 
    992     /*
    993      * Process all lines in the response file. There must be one complete
    994      * option per line
    995      */
    996     while (fgets (AslGbl_StringBuffer, ASL_STRING_BUFFER_SIZE, ResponseFile))
    997     {
    998         /* Compress all tokens, allowing us to use a single argv entry */
    999 
   1000         AslMergeOptionTokens (AslGbl_StringBuffer, AslGbl_StringBuffer2);
   1001 
   1002         /* Process the option */
   1003 
   1004         AcpiGbl_Opterr = 0;
   1005         AcpiGbl_Optind = 0;
   1006 
   1007         OptStatus = AslDoOptions (1, &argv, TRUE);
   1008         if (OptStatus)
   1009         {
   1010             printf ("Invalid option in command file %s: %s\n",
   1011                 Filename, AslGbl_StringBuffer);
   1012             break;
   1013         }
   1014     }
   1015 
   1016     /* Restore the GetOpt globals */
   1017 
   1018     AcpiGbl_Opterr = Opterr;
   1019     AcpiGbl_Optind = Optind;
   1020 
   1021     fclose (ResponseFile);
   1022     return (OptStatus);
   1023 }
   1024