1*a9d8d09cSJung-uk Kim /****************************************************************************** 2*a9d8d09cSJung-uk Kim * 3*a9d8d09cSJung-uk Kim * Module Name: asloptions - compiler command line processing 4*a9d8d09cSJung-uk Kim * 5*a9d8d09cSJung-uk Kim *****************************************************************************/ 6*a9d8d09cSJung-uk Kim 7*a9d8d09cSJung-uk Kim /* 8*a9d8d09cSJung-uk Kim * Copyright (C) 2000 - 2013, Intel Corp. 9*a9d8d09cSJung-uk Kim * All rights reserved. 10*a9d8d09cSJung-uk Kim * 11*a9d8d09cSJung-uk Kim * Redistribution and use in source and binary forms, with or without 12*a9d8d09cSJung-uk Kim * modification, are permitted provided that the following conditions 13*a9d8d09cSJung-uk Kim * are met: 14*a9d8d09cSJung-uk Kim * 1. Redistributions of source code must retain the above copyright 15*a9d8d09cSJung-uk Kim * notice, this list of conditions, and the following disclaimer, 16*a9d8d09cSJung-uk Kim * without modification. 17*a9d8d09cSJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18*a9d8d09cSJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below 19*a9d8d09cSJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon 20*a9d8d09cSJung-uk Kim * including a substantially similar Disclaimer requirement for further 21*a9d8d09cSJung-uk Kim * binary redistribution. 22*a9d8d09cSJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names 23*a9d8d09cSJung-uk Kim * of any contributors may be used to endorse or promote products derived 24*a9d8d09cSJung-uk Kim * from this software without specific prior written permission. 25*a9d8d09cSJung-uk Kim * 26*a9d8d09cSJung-uk Kim * Alternatively, this software may be distributed under the terms of the 27*a9d8d09cSJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free 28*a9d8d09cSJung-uk Kim * Software Foundation. 29*a9d8d09cSJung-uk Kim * 30*a9d8d09cSJung-uk Kim * NO WARRANTY 31*a9d8d09cSJung-uk Kim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32*a9d8d09cSJung-uk Kim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33*a9d8d09cSJung-uk Kim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34*a9d8d09cSJung-uk Kim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35*a9d8d09cSJung-uk Kim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36*a9d8d09cSJung-uk Kim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37*a9d8d09cSJung-uk Kim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38*a9d8d09cSJung-uk Kim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39*a9d8d09cSJung-uk Kim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40*a9d8d09cSJung-uk Kim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41*a9d8d09cSJung-uk Kim * POSSIBILITY OF SUCH DAMAGES. 42*a9d8d09cSJung-uk Kim */ 43*a9d8d09cSJung-uk Kim 44*a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h> 45*a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/include/acapps.h> 46*a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h> 47*a9d8d09cSJung-uk Kim 48*a9d8d09cSJung-uk Kim #define _COMPONENT ACPI_COMPILER 49*a9d8d09cSJung-uk Kim ACPI_MODULE_NAME ("asloption") 50*a9d8d09cSJung-uk Kim 51*a9d8d09cSJung-uk Kim 52*a9d8d09cSJung-uk Kim /* Local prototypes */ 53*a9d8d09cSJung-uk Kim 54*a9d8d09cSJung-uk Kim static int 55*a9d8d09cSJung-uk Kim AslDoOptions ( 56*a9d8d09cSJung-uk Kim int argc, 57*a9d8d09cSJung-uk Kim char **argv, 58*a9d8d09cSJung-uk Kim BOOLEAN IsResponseFile); 59*a9d8d09cSJung-uk Kim 60*a9d8d09cSJung-uk Kim static void 61*a9d8d09cSJung-uk Kim AslMergeOptionTokens ( 62*a9d8d09cSJung-uk Kim char *InBuffer, 63*a9d8d09cSJung-uk Kim char *OutBuffer); 64*a9d8d09cSJung-uk Kim 65*a9d8d09cSJung-uk Kim static int 66*a9d8d09cSJung-uk Kim AslDoResponseFile ( 67*a9d8d09cSJung-uk Kim char *Filename); 68*a9d8d09cSJung-uk Kim 69*a9d8d09cSJung-uk Kim 70*a9d8d09cSJung-uk Kim #define ASL_TOKEN_SEPARATORS " \t\n" 71*a9d8d09cSJung-uk Kim #define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z" 72*a9d8d09cSJung-uk Kim 73*a9d8d09cSJung-uk Kim 74*a9d8d09cSJung-uk Kim /******************************************************************************* 75*a9d8d09cSJung-uk Kim * 76*a9d8d09cSJung-uk Kim * FUNCTION: AslCommandLine 77*a9d8d09cSJung-uk Kim * 78*a9d8d09cSJung-uk Kim * PARAMETERS: argc/argv 79*a9d8d09cSJung-uk Kim * 80*a9d8d09cSJung-uk Kim * RETURN: Last argv index 81*a9d8d09cSJung-uk Kim * 82*a9d8d09cSJung-uk Kim * DESCRIPTION: Command line processing 83*a9d8d09cSJung-uk Kim * 84*a9d8d09cSJung-uk Kim ******************************************************************************/ 85*a9d8d09cSJung-uk Kim 86*a9d8d09cSJung-uk Kim int 87*a9d8d09cSJung-uk Kim AslCommandLine ( 88*a9d8d09cSJung-uk Kim int argc, 89*a9d8d09cSJung-uk Kim char **argv) 90*a9d8d09cSJung-uk Kim { 91*a9d8d09cSJung-uk Kim int BadCommandLine = 0; 92*a9d8d09cSJung-uk Kim ACPI_STATUS Status; 93*a9d8d09cSJung-uk Kim 94*a9d8d09cSJung-uk Kim 95*a9d8d09cSJung-uk Kim /* Minimum command line contains at least the command and an input file */ 96*a9d8d09cSJung-uk Kim 97*a9d8d09cSJung-uk Kim if (argc < 2) 98*a9d8d09cSJung-uk Kim { 99*a9d8d09cSJung-uk Kim printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); 100*a9d8d09cSJung-uk Kim Usage (); 101*a9d8d09cSJung-uk Kim exit (1); 102*a9d8d09cSJung-uk Kim } 103*a9d8d09cSJung-uk Kim 104*a9d8d09cSJung-uk Kim /* Process all command line options */ 105*a9d8d09cSJung-uk Kim 106*a9d8d09cSJung-uk Kim BadCommandLine = AslDoOptions (argc, argv, FALSE); 107*a9d8d09cSJung-uk Kim 108*a9d8d09cSJung-uk Kim if (Gbl_DoTemplates) 109*a9d8d09cSJung-uk Kim { 110*a9d8d09cSJung-uk Kim Status = DtCreateTemplates (Gbl_TemplateSignature); 111*a9d8d09cSJung-uk Kim if (ACPI_FAILURE (Status)) 112*a9d8d09cSJung-uk Kim { 113*a9d8d09cSJung-uk Kim exit (-1); 114*a9d8d09cSJung-uk Kim } 115*a9d8d09cSJung-uk Kim exit (1); 116*a9d8d09cSJung-uk Kim } 117*a9d8d09cSJung-uk Kim 118*a9d8d09cSJung-uk Kim /* Next parameter must be the input filename */ 119*a9d8d09cSJung-uk Kim 120*a9d8d09cSJung-uk Kim if (!argv[AcpiGbl_Optind] && 121*a9d8d09cSJung-uk Kim !Gbl_DisasmFlag && 122*a9d8d09cSJung-uk Kim !Gbl_GetAllTables) 123*a9d8d09cSJung-uk Kim { 124*a9d8d09cSJung-uk Kim printf ("Missing input filename\n"); 125*a9d8d09cSJung-uk Kim BadCommandLine = TRUE; 126*a9d8d09cSJung-uk Kim } 127*a9d8d09cSJung-uk Kim 128*a9d8d09cSJung-uk Kim if (Gbl_DoSignon) 129*a9d8d09cSJung-uk Kim { 130*a9d8d09cSJung-uk Kim printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); 131*a9d8d09cSJung-uk Kim if (Gbl_IgnoreErrors) 132*a9d8d09cSJung-uk Kim { 133*a9d8d09cSJung-uk Kim printf ("Ignoring all errors, forcing AML file generation\n\n"); 134*a9d8d09cSJung-uk Kim } 135*a9d8d09cSJung-uk Kim } 136*a9d8d09cSJung-uk Kim 137*a9d8d09cSJung-uk Kim if (BadCommandLine) 138*a9d8d09cSJung-uk Kim { 139*a9d8d09cSJung-uk Kim printf ("\n"); 140*a9d8d09cSJung-uk Kim Usage (); 141*a9d8d09cSJung-uk Kim exit (1); 142*a9d8d09cSJung-uk Kim } 143*a9d8d09cSJung-uk Kim 144*a9d8d09cSJung-uk Kim return (AcpiGbl_Optind); 145*a9d8d09cSJung-uk Kim } 146*a9d8d09cSJung-uk Kim 147*a9d8d09cSJung-uk Kim 148*a9d8d09cSJung-uk Kim /******************************************************************************* 149*a9d8d09cSJung-uk Kim * 150*a9d8d09cSJung-uk Kim * FUNCTION: AslDoOptions 151*a9d8d09cSJung-uk Kim * 152*a9d8d09cSJung-uk Kim * PARAMETERS: argc/argv - Standard argc/argv 153*a9d8d09cSJung-uk Kim * IsResponseFile - TRUE if executing a response file. 154*a9d8d09cSJung-uk Kim * 155*a9d8d09cSJung-uk Kim * RETURN: Status 156*a9d8d09cSJung-uk Kim * 157*a9d8d09cSJung-uk Kim * DESCRIPTION: Command line option processing 158*a9d8d09cSJung-uk Kim * 159*a9d8d09cSJung-uk Kim ******************************************************************************/ 160*a9d8d09cSJung-uk Kim 161*a9d8d09cSJung-uk Kim static int 162*a9d8d09cSJung-uk Kim AslDoOptions ( 163*a9d8d09cSJung-uk Kim int argc, 164*a9d8d09cSJung-uk Kim char **argv, 165*a9d8d09cSJung-uk Kim BOOLEAN IsResponseFile) 166*a9d8d09cSJung-uk Kim { 167*a9d8d09cSJung-uk Kim ACPI_STATUS Status; 168*a9d8d09cSJung-uk Kim UINT32 j; 169*a9d8d09cSJung-uk Kim 170*a9d8d09cSJung-uk Kim 171*a9d8d09cSJung-uk Kim /* Get the command line options */ 172*a9d8d09cSJung-uk Kim 173*a9d8d09cSJung-uk Kim while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != EOF) switch (j) 174*a9d8d09cSJung-uk Kim { 175*a9d8d09cSJung-uk Kim case '@': /* Begin a response file */ 176*a9d8d09cSJung-uk Kim 177*a9d8d09cSJung-uk Kim if (IsResponseFile) 178*a9d8d09cSJung-uk Kim { 179*a9d8d09cSJung-uk Kim printf ("Nested command files are not supported\n"); 180*a9d8d09cSJung-uk Kim return (-1); 181*a9d8d09cSJung-uk Kim } 182*a9d8d09cSJung-uk Kim 183*a9d8d09cSJung-uk Kim if (AslDoResponseFile (AcpiGbl_Optarg)) 184*a9d8d09cSJung-uk Kim { 185*a9d8d09cSJung-uk Kim return (-1); 186*a9d8d09cSJung-uk Kim } 187*a9d8d09cSJung-uk Kim break; 188*a9d8d09cSJung-uk Kim 189*a9d8d09cSJung-uk Kim case 'b': /* Debug output options */ 190*a9d8d09cSJung-uk Kim 191*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 192*a9d8d09cSJung-uk Kim { 193*a9d8d09cSJung-uk Kim case 'f': 194*a9d8d09cSJung-uk Kim 195*a9d8d09cSJung-uk Kim AslCompilerdebug = 1; /* same as yydebug */ 196*a9d8d09cSJung-uk Kim DtParserdebug = 1; 197*a9d8d09cSJung-uk Kim PrParserdebug = 1; 198*a9d8d09cSJung-uk Kim break; 199*a9d8d09cSJung-uk Kim 200*a9d8d09cSJung-uk Kim case 't': 201*a9d8d09cSJung-uk Kim 202*a9d8d09cSJung-uk Kim break; 203*a9d8d09cSJung-uk Kim 204*a9d8d09cSJung-uk Kim default: 205*a9d8d09cSJung-uk Kim 206*a9d8d09cSJung-uk Kim printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); 207*a9d8d09cSJung-uk Kim return (-1); 208*a9d8d09cSJung-uk Kim } 209*a9d8d09cSJung-uk Kim 210*a9d8d09cSJung-uk Kim /* Produce debug output file */ 211*a9d8d09cSJung-uk Kim 212*a9d8d09cSJung-uk Kim Gbl_DebugFlag = TRUE; 213*a9d8d09cSJung-uk Kim break; 214*a9d8d09cSJung-uk Kim 215*a9d8d09cSJung-uk Kim case 'c': 216*a9d8d09cSJung-uk Kim 217*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 218*a9d8d09cSJung-uk Kim { 219*a9d8d09cSJung-uk Kim case 'r': 220*a9d8d09cSJung-uk Kim 221*a9d8d09cSJung-uk Kim Gbl_NoResourceChecking = TRUE; 222*a9d8d09cSJung-uk Kim break; 223*a9d8d09cSJung-uk Kim 224*a9d8d09cSJung-uk Kim default: 225*a9d8d09cSJung-uk Kim 226*a9d8d09cSJung-uk Kim printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); 227*a9d8d09cSJung-uk Kim return (-1); 228*a9d8d09cSJung-uk Kim } 229*a9d8d09cSJung-uk Kim break; 230*a9d8d09cSJung-uk Kim 231*a9d8d09cSJung-uk Kim case 'd': /* Disassembler */ 232*a9d8d09cSJung-uk Kim 233*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 234*a9d8d09cSJung-uk Kim { 235*a9d8d09cSJung-uk Kim case '^': 236*a9d8d09cSJung-uk Kim 237*a9d8d09cSJung-uk Kim Gbl_DoCompile = FALSE; 238*a9d8d09cSJung-uk Kim break; 239*a9d8d09cSJung-uk Kim 240*a9d8d09cSJung-uk Kim case 'a': 241*a9d8d09cSJung-uk Kim 242*a9d8d09cSJung-uk Kim Gbl_DoCompile = FALSE; 243*a9d8d09cSJung-uk Kim Gbl_DisassembleAll = TRUE; 244*a9d8d09cSJung-uk Kim break; 245*a9d8d09cSJung-uk Kim 246*a9d8d09cSJung-uk Kim case 'b': /* Do not convert buffers to resource descriptors */ 247*a9d8d09cSJung-uk Kim 248*a9d8d09cSJung-uk Kim AcpiGbl_NoResourceDisassembly = TRUE; 249*a9d8d09cSJung-uk Kim break; 250*a9d8d09cSJung-uk Kim 251*a9d8d09cSJung-uk Kim case 'c': 252*a9d8d09cSJung-uk Kim 253*a9d8d09cSJung-uk Kim break; 254*a9d8d09cSJung-uk Kim 255*a9d8d09cSJung-uk Kim default: 256*a9d8d09cSJung-uk Kim 257*a9d8d09cSJung-uk Kim printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); 258*a9d8d09cSJung-uk Kim return (-1); 259*a9d8d09cSJung-uk Kim } 260*a9d8d09cSJung-uk Kim 261*a9d8d09cSJung-uk Kim Gbl_DisasmFlag = TRUE; 262*a9d8d09cSJung-uk Kim break; 263*a9d8d09cSJung-uk Kim 264*a9d8d09cSJung-uk Kim case 'D': /* Define a symbol */ 265*a9d8d09cSJung-uk Kim 266*a9d8d09cSJung-uk Kim PrAddDefine (AcpiGbl_Optarg, NULL, TRUE); 267*a9d8d09cSJung-uk Kim break; 268*a9d8d09cSJung-uk Kim 269*a9d8d09cSJung-uk Kim case 'e': /* External files for disassembler */ 270*a9d8d09cSJung-uk Kim 271*a9d8d09cSJung-uk Kim Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg); 272*a9d8d09cSJung-uk Kim if (ACPI_FAILURE (Status)) 273*a9d8d09cSJung-uk Kim { 274*a9d8d09cSJung-uk Kim printf ("Could not add %s to external list\n", AcpiGbl_Optarg); 275*a9d8d09cSJung-uk Kim return (-1); 276*a9d8d09cSJung-uk Kim } 277*a9d8d09cSJung-uk Kim break; 278*a9d8d09cSJung-uk Kim 279*a9d8d09cSJung-uk Kim case 'f': /* Ignore errors and force creation of aml file */ 280*a9d8d09cSJung-uk Kim 281*a9d8d09cSJung-uk Kim Gbl_IgnoreErrors = TRUE; 282*a9d8d09cSJung-uk Kim break; 283*a9d8d09cSJung-uk Kim 284*a9d8d09cSJung-uk Kim case 'G': 285*a9d8d09cSJung-uk Kim 286*a9d8d09cSJung-uk Kim Gbl_CompileGeneric = TRUE; 287*a9d8d09cSJung-uk Kim break; 288*a9d8d09cSJung-uk Kim 289*a9d8d09cSJung-uk Kim case 'g': /* Get all ACPI tables */ 290*a9d8d09cSJung-uk Kim 291*a9d8d09cSJung-uk Kim Gbl_GetAllTables = TRUE; 292*a9d8d09cSJung-uk Kim Gbl_DoCompile = FALSE; 293*a9d8d09cSJung-uk Kim break; 294*a9d8d09cSJung-uk Kim 295*a9d8d09cSJung-uk Kim case 'h': 296*a9d8d09cSJung-uk Kim 297*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 298*a9d8d09cSJung-uk Kim { 299*a9d8d09cSJung-uk Kim case '^': 300*a9d8d09cSJung-uk Kim 301*a9d8d09cSJung-uk Kim Usage (); 302*a9d8d09cSJung-uk Kim exit (0); 303*a9d8d09cSJung-uk Kim 304*a9d8d09cSJung-uk Kim case 'c': 305*a9d8d09cSJung-uk Kim 306*a9d8d09cSJung-uk Kim UtDisplayConstantOpcodes (); 307*a9d8d09cSJung-uk Kim exit (0); 308*a9d8d09cSJung-uk Kim 309*a9d8d09cSJung-uk Kim case 'f': 310*a9d8d09cSJung-uk Kim 311*a9d8d09cSJung-uk Kim AslFilenameHelp (); 312*a9d8d09cSJung-uk Kim exit (0); 313*a9d8d09cSJung-uk Kim 314*a9d8d09cSJung-uk Kim case 'r': 315*a9d8d09cSJung-uk Kim 316*a9d8d09cSJung-uk Kim /* reserved names */ 317*a9d8d09cSJung-uk Kim 318*a9d8d09cSJung-uk Kim ApDisplayReservedNames (); 319*a9d8d09cSJung-uk Kim exit (0); 320*a9d8d09cSJung-uk Kim 321*a9d8d09cSJung-uk Kim case 't': 322*a9d8d09cSJung-uk Kim 323*a9d8d09cSJung-uk Kim UtDisplaySupportedTables (); 324*a9d8d09cSJung-uk Kim exit (0); 325*a9d8d09cSJung-uk Kim 326*a9d8d09cSJung-uk Kim default: 327*a9d8d09cSJung-uk Kim 328*a9d8d09cSJung-uk Kim printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); 329*a9d8d09cSJung-uk Kim return (-1); 330*a9d8d09cSJung-uk Kim } 331*a9d8d09cSJung-uk Kim 332*a9d8d09cSJung-uk Kim case 'I': /* Add an include file search directory */ 333*a9d8d09cSJung-uk Kim 334*a9d8d09cSJung-uk Kim FlAddIncludeDirectory (AcpiGbl_Optarg); 335*a9d8d09cSJung-uk Kim break; 336*a9d8d09cSJung-uk Kim 337*a9d8d09cSJung-uk Kim case 'i': /* Output AML as an include file */ 338*a9d8d09cSJung-uk Kim 339*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 340*a9d8d09cSJung-uk Kim { 341*a9d8d09cSJung-uk Kim case 'a': 342*a9d8d09cSJung-uk Kim 343*a9d8d09cSJung-uk Kim /* Produce assembly code include file */ 344*a9d8d09cSJung-uk Kim 345*a9d8d09cSJung-uk Kim Gbl_AsmIncludeOutputFlag = TRUE; 346*a9d8d09cSJung-uk Kim break; 347*a9d8d09cSJung-uk Kim 348*a9d8d09cSJung-uk Kim case 'c': 349*a9d8d09cSJung-uk Kim 350*a9d8d09cSJung-uk Kim /* Produce C include file */ 351*a9d8d09cSJung-uk Kim 352*a9d8d09cSJung-uk Kim Gbl_C_IncludeOutputFlag = TRUE; 353*a9d8d09cSJung-uk Kim break; 354*a9d8d09cSJung-uk Kim 355*a9d8d09cSJung-uk Kim case 'n': 356*a9d8d09cSJung-uk Kim 357*a9d8d09cSJung-uk Kim /* Compiler/Disassembler: Ignore the NOOP operator */ 358*a9d8d09cSJung-uk Kim 359*a9d8d09cSJung-uk Kim AcpiGbl_IgnoreNoopOperator = TRUE; 360*a9d8d09cSJung-uk Kim break; 361*a9d8d09cSJung-uk Kim 362*a9d8d09cSJung-uk Kim default: 363*a9d8d09cSJung-uk Kim 364*a9d8d09cSJung-uk Kim printf ("Unknown option: -i%s\n", AcpiGbl_Optarg); 365*a9d8d09cSJung-uk Kim return (-1); 366*a9d8d09cSJung-uk Kim } 367*a9d8d09cSJung-uk Kim break; 368*a9d8d09cSJung-uk Kim 369*a9d8d09cSJung-uk Kim case 'l': /* Listing files */ 370*a9d8d09cSJung-uk Kim 371*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 372*a9d8d09cSJung-uk Kim { 373*a9d8d09cSJung-uk Kim case '^': 374*a9d8d09cSJung-uk Kim 375*a9d8d09cSJung-uk Kim /* Produce listing file (Mixed source/aml) */ 376*a9d8d09cSJung-uk Kim 377*a9d8d09cSJung-uk Kim Gbl_ListingFlag = TRUE; 378*a9d8d09cSJung-uk Kim break; 379*a9d8d09cSJung-uk Kim 380*a9d8d09cSJung-uk Kim case 'i': 381*a9d8d09cSJung-uk Kim 382*a9d8d09cSJung-uk Kim /* Produce preprocessor output file */ 383*a9d8d09cSJung-uk Kim 384*a9d8d09cSJung-uk Kim Gbl_PreprocessorOutputFlag = TRUE; 385*a9d8d09cSJung-uk Kim break; 386*a9d8d09cSJung-uk Kim 387*a9d8d09cSJung-uk Kim case 'n': 388*a9d8d09cSJung-uk Kim 389*a9d8d09cSJung-uk Kim /* Produce namespace file */ 390*a9d8d09cSJung-uk Kim 391*a9d8d09cSJung-uk Kim Gbl_NsOutputFlag = TRUE; 392*a9d8d09cSJung-uk Kim break; 393*a9d8d09cSJung-uk Kim 394*a9d8d09cSJung-uk Kim case 's': 395*a9d8d09cSJung-uk Kim 396*a9d8d09cSJung-uk Kim /* Produce combined source file */ 397*a9d8d09cSJung-uk Kim 398*a9d8d09cSJung-uk Kim Gbl_SourceOutputFlag = TRUE; 399*a9d8d09cSJung-uk Kim break; 400*a9d8d09cSJung-uk Kim 401*a9d8d09cSJung-uk Kim default: 402*a9d8d09cSJung-uk Kim 403*a9d8d09cSJung-uk Kim printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); 404*a9d8d09cSJung-uk Kim return (-1); 405*a9d8d09cSJung-uk Kim } 406*a9d8d09cSJung-uk Kim break; 407*a9d8d09cSJung-uk Kim 408*a9d8d09cSJung-uk Kim case 'm': /* Set line buffer size */ 409*a9d8d09cSJung-uk Kim 410*a9d8d09cSJung-uk Kim Gbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024; 411*a9d8d09cSJung-uk Kim if (Gbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE) 412*a9d8d09cSJung-uk Kim { 413*a9d8d09cSJung-uk Kim Gbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE; 414*a9d8d09cSJung-uk Kim } 415*a9d8d09cSJung-uk Kim printf ("Line Buffer Size: %u\n", Gbl_LineBufferSize); 416*a9d8d09cSJung-uk Kim break; 417*a9d8d09cSJung-uk Kim 418*a9d8d09cSJung-uk Kim case 'n': /* Parse only */ 419*a9d8d09cSJung-uk Kim 420*a9d8d09cSJung-uk Kim Gbl_ParseOnlyFlag = TRUE; 421*a9d8d09cSJung-uk Kim break; 422*a9d8d09cSJung-uk Kim 423*a9d8d09cSJung-uk Kim case 'o': /* Control compiler AML optimizations */ 424*a9d8d09cSJung-uk Kim 425*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 426*a9d8d09cSJung-uk Kim { 427*a9d8d09cSJung-uk Kim case 'a': 428*a9d8d09cSJung-uk Kim 429*a9d8d09cSJung-uk Kim /* Disable all optimizations */ 430*a9d8d09cSJung-uk Kim 431*a9d8d09cSJung-uk Kim Gbl_FoldConstants = FALSE; 432*a9d8d09cSJung-uk Kim Gbl_IntegerOptimizationFlag = FALSE; 433*a9d8d09cSJung-uk Kim Gbl_ReferenceOptimizationFlag = FALSE; 434*a9d8d09cSJung-uk Kim break; 435*a9d8d09cSJung-uk Kim 436*a9d8d09cSJung-uk Kim case 'f': 437*a9d8d09cSJung-uk Kim 438*a9d8d09cSJung-uk Kim /* Disable folding on "normal" expressions */ 439*a9d8d09cSJung-uk Kim 440*a9d8d09cSJung-uk Kim Gbl_FoldConstants = FALSE; 441*a9d8d09cSJung-uk Kim break; 442*a9d8d09cSJung-uk Kim 443*a9d8d09cSJung-uk Kim case 'i': 444*a9d8d09cSJung-uk Kim 445*a9d8d09cSJung-uk Kim /* Disable integer optimization to constants */ 446*a9d8d09cSJung-uk Kim 447*a9d8d09cSJung-uk Kim Gbl_IntegerOptimizationFlag = FALSE; 448*a9d8d09cSJung-uk Kim break; 449*a9d8d09cSJung-uk Kim 450*a9d8d09cSJung-uk Kim case 'n': 451*a9d8d09cSJung-uk Kim 452*a9d8d09cSJung-uk Kim /* Disable named reference optimization */ 453*a9d8d09cSJung-uk Kim 454*a9d8d09cSJung-uk Kim Gbl_ReferenceOptimizationFlag = FALSE; 455*a9d8d09cSJung-uk Kim break; 456*a9d8d09cSJung-uk Kim 457*a9d8d09cSJung-uk Kim case 't': 458*a9d8d09cSJung-uk Kim 459*a9d8d09cSJung-uk Kim /* Display compile time(s) */ 460*a9d8d09cSJung-uk Kim 461*a9d8d09cSJung-uk Kim Gbl_CompileTimesFlag = TRUE; 462*a9d8d09cSJung-uk Kim break; 463*a9d8d09cSJung-uk Kim 464*a9d8d09cSJung-uk Kim default: 465*a9d8d09cSJung-uk Kim 466*a9d8d09cSJung-uk Kim printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); 467*a9d8d09cSJung-uk Kim return (-1); 468*a9d8d09cSJung-uk Kim } 469*a9d8d09cSJung-uk Kim break; 470*a9d8d09cSJung-uk Kim 471*a9d8d09cSJung-uk Kim case 'P': /* Preprocessor options */ 472*a9d8d09cSJung-uk Kim 473*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 474*a9d8d09cSJung-uk Kim { 475*a9d8d09cSJung-uk Kim case '^': /* Proprocess only, emit (.i) file */ 476*a9d8d09cSJung-uk Kim 477*a9d8d09cSJung-uk Kim Gbl_PreprocessOnly = TRUE; 478*a9d8d09cSJung-uk Kim Gbl_PreprocessorOutputFlag = TRUE; 479*a9d8d09cSJung-uk Kim break; 480*a9d8d09cSJung-uk Kim 481*a9d8d09cSJung-uk Kim case 'n': /* Disable preprocessor */ 482*a9d8d09cSJung-uk Kim 483*a9d8d09cSJung-uk Kim Gbl_PreprocessFlag = FALSE; 484*a9d8d09cSJung-uk Kim break; 485*a9d8d09cSJung-uk Kim 486*a9d8d09cSJung-uk Kim default: 487*a9d8d09cSJung-uk Kim 488*a9d8d09cSJung-uk Kim printf ("Unknown option: -P%s\n", AcpiGbl_Optarg); 489*a9d8d09cSJung-uk Kim return (-1); 490*a9d8d09cSJung-uk Kim } 491*a9d8d09cSJung-uk Kim break; 492*a9d8d09cSJung-uk Kim 493*a9d8d09cSJung-uk Kim case 'p': /* Override default AML output filename */ 494*a9d8d09cSJung-uk Kim 495*a9d8d09cSJung-uk Kim Gbl_OutputFilenamePrefix = AcpiGbl_Optarg; 496*a9d8d09cSJung-uk Kim Gbl_UseDefaultAmlFilename = FALSE; 497*a9d8d09cSJung-uk Kim break; 498*a9d8d09cSJung-uk Kim 499*a9d8d09cSJung-uk Kim case 'r': /* Override revision found in table header */ 500*a9d8d09cSJung-uk Kim 501*a9d8d09cSJung-uk Kim Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); 502*a9d8d09cSJung-uk Kim break; 503*a9d8d09cSJung-uk Kim 504*a9d8d09cSJung-uk Kim case 's': /* Create AML in a source code file */ 505*a9d8d09cSJung-uk Kim 506*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 507*a9d8d09cSJung-uk Kim { 508*a9d8d09cSJung-uk Kim case 'a': 509*a9d8d09cSJung-uk Kim 510*a9d8d09cSJung-uk Kim /* Produce assembly code output file */ 511*a9d8d09cSJung-uk Kim 512*a9d8d09cSJung-uk Kim Gbl_AsmOutputFlag = TRUE; 513*a9d8d09cSJung-uk Kim break; 514*a9d8d09cSJung-uk Kim 515*a9d8d09cSJung-uk Kim case 'c': 516*a9d8d09cSJung-uk Kim 517*a9d8d09cSJung-uk Kim /* Produce C hex output file */ 518*a9d8d09cSJung-uk Kim 519*a9d8d09cSJung-uk Kim Gbl_C_OutputFlag = TRUE; 520*a9d8d09cSJung-uk Kim break; 521*a9d8d09cSJung-uk Kim 522*a9d8d09cSJung-uk Kim case 'o': 523*a9d8d09cSJung-uk Kim 524*a9d8d09cSJung-uk Kim /* Produce AML offset table in C */ 525*a9d8d09cSJung-uk Kim 526*a9d8d09cSJung-uk Kim Gbl_C_OffsetTableFlag = TRUE; 527*a9d8d09cSJung-uk Kim break; 528*a9d8d09cSJung-uk Kim 529*a9d8d09cSJung-uk Kim default: 530*a9d8d09cSJung-uk Kim 531*a9d8d09cSJung-uk Kim printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); 532*a9d8d09cSJung-uk Kim return (-1); 533*a9d8d09cSJung-uk Kim } 534*a9d8d09cSJung-uk Kim break; 535*a9d8d09cSJung-uk Kim 536*a9d8d09cSJung-uk Kim case 't': /* Produce hex table output file */ 537*a9d8d09cSJung-uk Kim 538*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 539*a9d8d09cSJung-uk Kim { 540*a9d8d09cSJung-uk Kim case 'a': 541*a9d8d09cSJung-uk Kim 542*a9d8d09cSJung-uk Kim Gbl_HexOutputFlag = HEX_OUTPUT_ASM; 543*a9d8d09cSJung-uk Kim break; 544*a9d8d09cSJung-uk Kim 545*a9d8d09cSJung-uk Kim case 'c': 546*a9d8d09cSJung-uk Kim 547*a9d8d09cSJung-uk Kim Gbl_HexOutputFlag = HEX_OUTPUT_C; 548*a9d8d09cSJung-uk Kim break; 549*a9d8d09cSJung-uk Kim 550*a9d8d09cSJung-uk Kim case 's': 551*a9d8d09cSJung-uk Kim 552*a9d8d09cSJung-uk Kim Gbl_HexOutputFlag = HEX_OUTPUT_ASL; 553*a9d8d09cSJung-uk Kim break; 554*a9d8d09cSJung-uk Kim 555*a9d8d09cSJung-uk Kim default: 556*a9d8d09cSJung-uk Kim 557*a9d8d09cSJung-uk Kim printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); 558*a9d8d09cSJung-uk Kim return (-1); 559*a9d8d09cSJung-uk Kim } 560*a9d8d09cSJung-uk Kim break; 561*a9d8d09cSJung-uk Kim 562*a9d8d09cSJung-uk Kim case 'T': /* Create a ACPI table template file */ 563*a9d8d09cSJung-uk Kim 564*a9d8d09cSJung-uk Kim Gbl_DoTemplates = TRUE; 565*a9d8d09cSJung-uk Kim Gbl_TemplateSignature = AcpiGbl_Optarg; 566*a9d8d09cSJung-uk Kim break; 567*a9d8d09cSJung-uk Kim 568*a9d8d09cSJung-uk Kim case 'v': /* Version and verbosity settings */ 569*a9d8d09cSJung-uk Kim 570*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 571*a9d8d09cSJung-uk Kim { 572*a9d8d09cSJung-uk Kim case '^': 573*a9d8d09cSJung-uk Kim 574*a9d8d09cSJung-uk Kim printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); 575*a9d8d09cSJung-uk Kim exit (0); 576*a9d8d09cSJung-uk Kim 577*a9d8d09cSJung-uk Kim case 'a': 578*a9d8d09cSJung-uk Kim 579*a9d8d09cSJung-uk Kim /* Disable All error/warning messages */ 580*a9d8d09cSJung-uk Kim 581*a9d8d09cSJung-uk Kim Gbl_NoErrors = TRUE; 582*a9d8d09cSJung-uk Kim break; 583*a9d8d09cSJung-uk Kim 584*a9d8d09cSJung-uk Kim case 'i': 585*a9d8d09cSJung-uk Kim /* 586*a9d8d09cSJung-uk Kim * Support for integrated development environment(s). 587*a9d8d09cSJung-uk Kim * 588*a9d8d09cSJung-uk Kim * 1) No compiler signon 589*a9d8d09cSJung-uk Kim * 2) Send stderr messages to stdout 590*a9d8d09cSJung-uk Kim * 3) Less verbose error messages (single line only for each) 591*a9d8d09cSJung-uk Kim * 4) Error/warning messages are formatted appropriately to 592*a9d8d09cSJung-uk Kim * be recognized by MS Visual Studio 593*a9d8d09cSJung-uk Kim */ 594*a9d8d09cSJung-uk Kim Gbl_VerboseErrors = FALSE; 595*a9d8d09cSJung-uk Kim Gbl_DoSignon = FALSE; 596*a9d8d09cSJung-uk Kim Gbl_Files[ASL_FILE_STDERR].Handle = stdout; 597*a9d8d09cSJung-uk Kim break; 598*a9d8d09cSJung-uk Kim 599*a9d8d09cSJung-uk Kim case 'o': 600*a9d8d09cSJung-uk Kim 601*a9d8d09cSJung-uk Kim Gbl_DisplayOptimizations = TRUE; 602*a9d8d09cSJung-uk Kim break; 603*a9d8d09cSJung-uk Kim 604*a9d8d09cSJung-uk Kim case 'r': 605*a9d8d09cSJung-uk Kim 606*a9d8d09cSJung-uk Kim Gbl_DisplayRemarks = FALSE; 607*a9d8d09cSJung-uk Kim break; 608*a9d8d09cSJung-uk Kim 609*a9d8d09cSJung-uk Kim case 's': 610*a9d8d09cSJung-uk Kim 611*a9d8d09cSJung-uk Kim Gbl_DoSignon = FALSE; 612*a9d8d09cSJung-uk Kim break; 613*a9d8d09cSJung-uk Kim 614*a9d8d09cSJung-uk Kim case 't': 615*a9d8d09cSJung-uk Kim 616*a9d8d09cSJung-uk Kim Gbl_VerboseTemplates = TRUE; 617*a9d8d09cSJung-uk Kim break; 618*a9d8d09cSJung-uk Kim 619*a9d8d09cSJung-uk Kim case 'w': 620*a9d8d09cSJung-uk Kim 621*a9d8d09cSJung-uk Kim /* Get the required argument */ 622*a9d8d09cSJung-uk Kim 623*a9d8d09cSJung-uk Kim if (AcpiGetoptArgument (argc, argv)) 624*a9d8d09cSJung-uk Kim { 625*a9d8d09cSJung-uk Kim return (-1); 626*a9d8d09cSJung-uk Kim } 627*a9d8d09cSJung-uk Kim 628*a9d8d09cSJung-uk Kim Status = AslDisableException (AcpiGbl_Optarg); 629*a9d8d09cSJung-uk Kim if (ACPI_FAILURE (Status)) 630*a9d8d09cSJung-uk Kim { 631*a9d8d09cSJung-uk Kim return (-1); 632*a9d8d09cSJung-uk Kim } 633*a9d8d09cSJung-uk Kim break; 634*a9d8d09cSJung-uk Kim 635*a9d8d09cSJung-uk Kim default: 636*a9d8d09cSJung-uk Kim 637*a9d8d09cSJung-uk Kim printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); 638*a9d8d09cSJung-uk Kim return (-1); 639*a9d8d09cSJung-uk Kim } 640*a9d8d09cSJung-uk Kim break; 641*a9d8d09cSJung-uk Kim 642*a9d8d09cSJung-uk Kim case 'w': /* Set warning levels */ 643*a9d8d09cSJung-uk Kim 644*a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 645*a9d8d09cSJung-uk Kim { 646*a9d8d09cSJung-uk Kim case '1': 647*a9d8d09cSJung-uk Kim 648*a9d8d09cSJung-uk Kim Gbl_WarningLevel = ASL_WARNING; 649*a9d8d09cSJung-uk Kim break; 650*a9d8d09cSJung-uk Kim 651*a9d8d09cSJung-uk Kim case '2': 652*a9d8d09cSJung-uk Kim 653*a9d8d09cSJung-uk Kim Gbl_WarningLevel = ASL_WARNING2; 654*a9d8d09cSJung-uk Kim break; 655*a9d8d09cSJung-uk Kim 656*a9d8d09cSJung-uk Kim case '3': 657*a9d8d09cSJung-uk Kim 658*a9d8d09cSJung-uk Kim Gbl_WarningLevel = ASL_WARNING3; 659*a9d8d09cSJung-uk Kim break; 660*a9d8d09cSJung-uk Kim 661*a9d8d09cSJung-uk Kim case 'e': 662*a9d8d09cSJung-uk Kim 663*a9d8d09cSJung-uk Kim Gbl_WarningsAsErrors = TRUE; 664*a9d8d09cSJung-uk Kim break; 665*a9d8d09cSJung-uk Kim 666*a9d8d09cSJung-uk Kim default: 667*a9d8d09cSJung-uk Kim 668*a9d8d09cSJung-uk Kim printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); 669*a9d8d09cSJung-uk Kim return (-1); 670*a9d8d09cSJung-uk Kim } 671*a9d8d09cSJung-uk Kim break; 672*a9d8d09cSJung-uk Kim 673*a9d8d09cSJung-uk Kim case 'x': /* Set debug print output level */ 674*a9d8d09cSJung-uk Kim 675*a9d8d09cSJung-uk Kim AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16); 676*a9d8d09cSJung-uk Kim break; 677*a9d8d09cSJung-uk Kim 678*a9d8d09cSJung-uk Kim case 'z': 679*a9d8d09cSJung-uk Kim 680*a9d8d09cSJung-uk Kim Gbl_UseOriginalCompilerId = TRUE; 681*a9d8d09cSJung-uk Kim break; 682*a9d8d09cSJung-uk Kim 683*a9d8d09cSJung-uk Kim default: 684*a9d8d09cSJung-uk Kim 685*a9d8d09cSJung-uk Kim return (-1); 686*a9d8d09cSJung-uk Kim } 687*a9d8d09cSJung-uk Kim 688*a9d8d09cSJung-uk Kim return (0); 689*a9d8d09cSJung-uk Kim } 690*a9d8d09cSJung-uk Kim 691*a9d8d09cSJung-uk Kim 692*a9d8d09cSJung-uk Kim /******************************************************************************* 693*a9d8d09cSJung-uk Kim * 694*a9d8d09cSJung-uk Kim * FUNCTION: AslMergeOptionTokens 695*a9d8d09cSJung-uk Kim * 696*a9d8d09cSJung-uk Kim * PARAMETERS: InBuffer - Input containing an option string 697*a9d8d09cSJung-uk Kim * OutBuffer - Merged output buffer 698*a9d8d09cSJung-uk Kim * 699*a9d8d09cSJung-uk Kim * RETURN: None 700*a9d8d09cSJung-uk Kim * 701*a9d8d09cSJung-uk Kim * DESCRIPTION: Remove all whitespace from an option string. 702*a9d8d09cSJung-uk Kim * 703*a9d8d09cSJung-uk Kim ******************************************************************************/ 704*a9d8d09cSJung-uk Kim 705*a9d8d09cSJung-uk Kim static void 706*a9d8d09cSJung-uk Kim AslMergeOptionTokens ( 707*a9d8d09cSJung-uk Kim char *InBuffer, 708*a9d8d09cSJung-uk Kim char *OutBuffer) 709*a9d8d09cSJung-uk Kim { 710*a9d8d09cSJung-uk Kim char *Token; 711*a9d8d09cSJung-uk Kim 712*a9d8d09cSJung-uk Kim 713*a9d8d09cSJung-uk Kim *OutBuffer = 0; 714*a9d8d09cSJung-uk Kim 715*a9d8d09cSJung-uk Kim Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS); 716*a9d8d09cSJung-uk Kim while (Token) 717*a9d8d09cSJung-uk Kim { 718*a9d8d09cSJung-uk Kim strcat (OutBuffer, Token); 719*a9d8d09cSJung-uk Kim Token = strtok (NULL, ASL_TOKEN_SEPARATORS); 720*a9d8d09cSJung-uk Kim } 721*a9d8d09cSJung-uk Kim } 722*a9d8d09cSJung-uk Kim 723*a9d8d09cSJung-uk Kim 724*a9d8d09cSJung-uk Kim /******************************************************************************* 725*a9d8d09cSJung-uk Kim * 726*a9d8d09cSJung-uk Kim * FUNCTION: AslDoResponseFile 727*a9d8d09cSJung-uk Kim * 728*a9d8d09cSJung-uk Kim * PARAMETERS: Filename - Name of the response file 729*a9d8d09cSJung-uk Kim * 730*a9d8d09cSJung-uk Kim * RETURN: Status 731*a9d8d09cSJung-uk Kim * 732*a9d8d09cSJung-uk Kim * DESCRIPTION: Open a response file and process all options within. 733*a9d8d09cSJung-uk Kim * 734*a9d8d09cSJung-uk Kim ******************************************************************************/ 735*a9d8d09cSJung-uk Kim 736*a9d8d09cSJung-uk Kim static int 737*a9d8d09cSJung-uk Kim AslDoResponseFile ( 738*a9d8d09cSJung-uk Kim char *Filename) 739*a9d8d09cSJung-uk Kim { 740*a9d8d09cSJung-uk Kim char *argv = StringBuffer2; 741*a9d8d09cSJung-uk Kim FILE *ResponseFile; 742*a9d8d09cSJung-uk Kim int OptStatus = 0; 743*a9d8d09cSJung-uk Kim int Opterr; 744*a9d8d09cSJung-uk Kim int Optind; 745*a9d8d09cSJung-uk Kim 746*a9d8d09cSJung-uk Kim 747*a9d8d09cSJung-uk Kim ResponseFile = fopen (Filename, "r"); 748*a9d8d09cSJung-uk Kim if (!ResponseFile) 749*a9d8d09cSJung-uk Kim { 750*a9d8d09cSJung-uk Kim printf ("Could not open command file %s, %s\n", 751*a9d8d09cSJung-uk Kim Filename, strerror (errno)); 752*a9d8d09cSJung-uk Kim return (-1); 753*a9d8d09cSJung-uk Kim } 754*a9d8d09cSJung-uk Kim 755*a9d8d09cSJung-uk Kim /* Must save the current GetOpt globals */ 756*a9d8d09cSJung-uk Kim 757*a9d8d09cSJung-uk Kim Opterr = AcpiGbl_Opterr; 758*a9d8d09cSJung-uk Kim Optind = AcpiGbl_Optind; 759*a9d8d09cSJung-uk Kim 760*a9d8d09cSJung-uk Kim /* 761*a9d8d09cSJung-uk Kim * Process all lines in the response file. There must be one complete 762*a9d8d09cSJung-uk Kim * option per line 763*a9d8d09cSJung-uk Kim */ 764*a9d8d09cSJung-uk Kim while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) 765*a9d8d09cSJung-uk Kim { 766*a9d8d09cSJung-uk Kim /* Compress all tokens, allowing us to use a single argv entry */ 767*a9d8d09cSJung-uk Kim 768*a9d8d09cSJung-uk Kim AslMergeOptionTokens (StringBuffer, StringBuffer2); 769*a9d8d09cSJung-uk Kim 770*a9d8d09cSJung-uk Kim /* Process the option */ 771*a9d8d09cSJung-uk Kim 772*a9d8d09cSJung-uk Kim AcpiGbl_Opterr = 0; 773*a9d8d09cSJung-uk Kim AcpiGbl_Optind = 0; 774*a9d8d09cSJung-uk Kim 775*a9d8d09cSJung-uk Kim OptStatus = AslDoOptions (1, &argv, TRUE); 776*a9d8d09cSJung-uk Kim if (OptStatus) 777*a9d8d09cSJung-uk Kim { 778*a9d8d09cSJung-uk Kim printf ("Invalid option in command file %s: %s\n", 779*a9d8d09cSJung-uk Kim Filename, StringBuffer); 780*a9d8d09cSJung-uk Kim break; 781*a9d8d09cSJung-uk Kim } 782*a9d8d09cSJung-uk Kim } 783*a9d8d09cSJung-uk Kim 784*a9d8d09cSJung-uk Kim /* Restore the GetOpt globals */ 785*a9d8d09cSJung-uk Kim 786*a9d8d09cSJung-uk Kim AcpiGbl_Opterr = Opterr; 787*a9d8d09cSJung-uk Kim AcpiGbl_Optind = Optind; 788*a9d8d09cSJung-uk Kim 789*a9d8d09cSJung-uk Kim fclose (ResponseFile); 790*a9d8d09cSJung-uk Kim return (OptStatus); 791*a9d8d09cSJung-uk Kim } 792