xref: /freebsd/sys/contrib/dev/acpica/compiler/asloptions.c (revision af051161437e44a6ceabf9e196f0eb8f33d92b86)
1a9d8d09cSJung-uk Kim /******************************************************************************
2a9d8d09cSJung-uk Kim  *
3a9d8d09cSJung-uk Kim  * Module Name: asloptions - compiler command line processing
4a9d8d09cSJung-uk Kim  *
5a9d8d09cSJung-uk Kim  *****************************************************************************/
6a9d8d09cSJung-uk Kim 
70d84335fSJung-uk Kim /******************************************************************************
80d84335fSJung-uk Kim  *
90d84335fSJung-uk Kim  * 1. Copyright Notice
100d84335fSJung-uk Kim  *
110d84335fSJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12a9d8d09cSJung-uk Kim  * All rights reserved.
13a9d8d09cSJung-uk Kim  *
140d84335fSJung-uk Kim  * 2. License
150d84335fSJung-uk Kim  *
160d84335fSJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
170d84335fSJung-uk Kim  * rights. You may have additional license terms from the party that provided
180d84335fSJung-uk Kim  * you this software, covering your right to use that party's intellectual
190d84335fSJung-uk Kim  * property rights.
200d84335fSJung-uk Kim  *
210d84335fSJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220d84335fSJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
230d84335fSJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240d84335fSJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
250d84335fSJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
260d84335fSJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
270d84335fSJung-uk Kim  *
280d84335fSJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290d84335fSJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
300d84335fSJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
310d84335fSJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
320d84335fSJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
330d84335fSJung-uk Kim  * license, and in no event shall the patent license extend to any additions
340d84335fSJung-uk Kim  * to or modifications of the Original Intel Code. No other license or right
350d84335fSJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
360d84335fSJung-uk Kim  *
370d84335fSJung-uk Kim  * The above copyright and patent license is granted only if the following
380d84335fSJung-uk Kim  * conditions are met:
390d84335fSJung-uk Kim  *
400d84335fSJung-uk Kim  * 3. Conditions
410d84335fSJung-uk Kim  *
420d84335fSJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
440d84335fSJung-uk Kim  * Code or modification with rights to further distribute source must include
450d84335fSJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
460d84335fSJung-uk Kim  * and the following Disclaimer and Export Compliance provision. In addition,
470d84335fSJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
480d84335fSJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
490d84335fSJung-uk Kim  * Code and the date of any change. Licensee must include in that file the
500d84335fSJung-uk Kim  * documentation of any changes made by any predecessor Licensee. Licensee
510d84335fSJung-uk Kim  * must include a prominent statement that the modification is derived,
520d84335fSJung-uk Kim  * directly or indirectly, from Original Intel Code.
530d84335fSJung-uk Kim  *
540d84335fSJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
560d84335fSJung-uk Kim  * Code or modification without rights to further distribute source must
570d84335fSJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
580d84335fSJung-uk Kim  * documentation and/or other materials provided with distribution. In
590d84335fSJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
600d84335fSJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
610d84335fSJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
620d84335fSJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
630d84335fSJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
640d84335fSJung-uk Kim  * make.
650d84335fSJung-uk Kim  *
660d84335fSJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
670d84335fSJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
680d84335fSJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
690d84335fSJung-uk Kim  * provision in the documentation and/or other materials provided with the
700d84335fSJung-uk Kim  * distribution.
710d84335fSJung-uk Kim  *
720d84335fSJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
730d84335fSJung-uk Kim  * Intel Code.
740d84335fSJung-uk Kim  *
750d84335fSJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760d84335fSJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
770d84335fSJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
780d84335fSJung-uk Kim  * without prior written authorization from Intel.
790d84335fSJung-uk Kim  *
800d84335fSJung-uk Kim  * 4. Disclaimer and Export Compliance
810d84335fSJung-uk Kim  *
820d84335fSJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830d84335fSJung-uk Kim  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840d84335fSJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
850d84335fSJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
860d84335fSJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
870d84335fSJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880d84335fSJung-uk Kim  * PARTICULAR PURPOSE.
890d84335fSJung-uk Kim  *
900d84335fSJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910d84335fSJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920d84335fSJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930d84335fSJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940d84335fSJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950d84335fSJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
960d84335fSJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970d84335fSJung-uk Kim  * LIMITED REMEDY.
980d84335fSJung-uk Kim  *
990d84335fSJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000d84335fSJung-uk Kim  * software or system incorporating such software without first obtaining any
1010d84335fSJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
1020d84335fSJung-uk Kim  * any other agency or department of the United States Government. In the
1030d84335fSJung-uk Kim  * event Licensee exports any such software from the United States or
1040d84335fSJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
1050d84335fSJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
1060d84335fSJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
1070d84335fSJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080d84335fSJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
1090d84335fSJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
1100d84335fSJung-uk Kim  * United States government or any agency thereof requires an export license,
1110d84335fSJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
1120d84335fSJung-uk Kim  * such license, approval or letter.
1130d84335fSJung-uk Kim  *
1140d84335fSJung-uk Kim  *****************************************************************************
1150d84335fSJung-uk Kim  *
1160d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
1170d84335fSJung-uk Kim  * following license:
1180d84335fSJung-uk Kim  *
119a9d8d09cSJung-uk Kim  * Redistribution and use in source and binary forms, with or without
120a9d8d09cSJung-uk Kim  * modification, are permitted provided that the following conditions
121a9d8d09cSJung-uk Kim  * are met:
122a9d8d09cSJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
123a9d8d09cSJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
124a9d8d09cSJung-uk Kim  *    without modification.
125a9d8d09cSJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126a9d8d09cSJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
127a9d8d09cSJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
128a9d8d09cSJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
129a9d8d09cSJung-uk Kim  *    binary redistribution.
130a9d8d09cSJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
131a9d8d09cSJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
132a9d8d09cSJung-uk Kim  *    from this software without specific prior written permission.
133a9d8d09cSJung-uk Kim  *
1340d84335fSJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1350d84335fSJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1360d84335fSJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1370d84335fSJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1380d84335fSJung-uk Kim  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1390d84335fSJung-uk Kim  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1400d84335fSJung-uk Kim  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1410d84335fSJung-uk Kim  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1420d84335fSJung-uk Kim  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1430d84335fSJung-uk Kim  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1440d84335fSJung-uk Kim  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1450d84335fSJung-uk Kim  *
1460d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
147a9d8d09cSJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
148a9d8d09cSJung-uk Kim  * Software Foundation.
149a9d8d09cSJung-uk Kim  *
1500d84335fSJung-uk Kim  *****************************************************************************/
151a9d8d09cSJung-uk Kim 
152a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h>
153a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/include/acapps.h>
154a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h>
155a9d8d09cSJung-uk Kim 
156a9d8d09cSJung-uk Kim #define _COMPONENT          ACPI_COMPILER
157a9d8d09cSJung-uk Kim         ACPI_MODULE_NAME    ("asloption")
158a9d8d09cSJung-uk Kim 
159a9d8d09cSJung-uk Kim 
160a9d8d09cSJung-uk Kim /* Local prototypes */
161a9d8d09cSJung-uk Kim 
162a9d8d09cSJung-uk Kim static int
163a9d8d09cSJung-uk Kim AslDoOptions (
164a9d8d09cSJung-uk Kim     int                     argc,
165a9d8d09cSJung-uk Kim     char                    **argv,
166a9d8d09cSJung-uk Kim     BOOLEAN                 IsResponseFile);
167a9d8d09cSJung-uk Kim 
168a9d8d09cSJung-uk Kim static void
169a9d8d09cSJung-uk Kim AslMergeOptionTokens (
170a9d8d09cSJung-uk Kim     char                    *InBuffer,
171a9d8d09cSJung-uk Kim     char                    *OutBuffer);
172a9d8d09cSJung-uk Kim 
173a9d8d09cSJung-uk Kim static int
174a9d8d09cSJung-uk Kim AslDoResponseFile (
175a9d8d09cSJung-uk Kim     char                    *Filename);
176a9d8d09cSJung-uk Kim 
177a9d8d09cSJung-uk Kim 
178a9d8d09cSJung-uk Kim #define ASL_TOKEN_SEPARATORS    " \t\n"
1790d84335fSJung-uk Kim #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"
180a9d8d09cSJung-uk Kim 
181a9d8d09cSJung-uk Kim 
182a9d8d09cSJung-uk Kim /*******************************************************************************
183a9d8d09cSJung-uk Kim  *
184a9d8d09cSJung-uk Kim  * FUNCTION:    AslCommandLine
185a9d8d09cSJung-uk Kim  *
186a9d8d09cSJung-uk Kim  * PARAMETERS:  argc/argv
187a9d8d09cSJung-uk Kim  *
188a9d8d09cSJung-uk Kim  * RETURN:      Last argv index
189a9d8d09cSJung-uk Kim  *
190a9d8d09cSJung-uk Kim  * DESCRIPTION: Command line processing
191a9d8d09cSJung-uk Kim  *
192a9d8d09cSJung-uk Kim  ******************************************************************************/
193a9d8d09cSJung-uk Kim 
194a9d8d09cSJung-uk Kim int
195a9d8d09cSJung-uk Kim AslCommandLine (
196a9d8d09cSJung-uk Kim     int                     argc,
197a9d8d09cSJung-uk Kim     char                    **argv)
198a9d8d09cSJung-uk Kim {
199a9d8d09cSJung-uk Kim     int                     BadCommandLine = 0;
200a9d8d09cSJung-uk Kim     ACPI_STATUS             Status;
201a9d8d09cSJung-uk Kim 
202a9d8d09cSJung-uk Kim 
203a9d8d09cSJung-uk Kim     /* Minimum command line contains at least the command and an input file */
204a9d8d09cSJung-uk Kim 
205a9d8d09cSJung-uk Kim     if (argc < 2)
206a9d8d09cSJung-uk Kim     {
207a9d8d09cSJung-uk Kim         printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
208a9d8d09cSJung-uk Kim         Usage ();
209a9d8d09cSJung-uk Kim         exit (1);
210a9d8d09cSJung-uk Kim     }
211a9d8d09cSJung-uk Kim 
212a9d8d09cSJung-uk Kim     /* Process all command line options */
213a9d8d09cSJung-uk Kim 
214a9d8d09cSJung-uk Kim     BadCommandLine = AslDoOptions (argc, argv, FALSE);
215a9d8d09cSJung-uk Kim 
216a9d8d09cSJung-uk Kim     if (Gbl_DoTemplates)
217a9d8d09cSJung-uk Kim     {
218f8146b88SJung-uk Kim         Status = DtCreateTemplates (argv);
219a9d8d09cSJung-uk Kim         if (ACPI_FAILURE (Status))
220a9d8d09cSJung-uk Kim         {
221a9d8d09cSJung-uk Kim             exit (-1);
222a9d8d09cSJung-uk Kim         }
223a9d8d09cSJung-uk Kim         exit (1);
224a9d8d09cSJung-uk Kim     }
225a9d8d09cSJung-uk Kim 
226a9d8d09cSJung-uk Kim     /* Next parameter must be the input filename */
227a9d8d09cSJung-uk Kim 
228a9d8d09cSJung-uk Kim     if (!argv[AcpiGbl_Optind] &&
229*af051161SJung-uk Kim         !AcpiGbl_DisasmFlag)
230a9d8d09cSJung-uk Kim     {
231a9d8d09cSJung-uk Kim         printf ("Missing input filename\n");
232a9d8d09cSJung-uk Kim         BadCommandLine = TRUE;
233a9d8d09cSJung-uk Kim     }
234a9d8d09cSJung-uk Kim 
235a9d8d09cSJung-uk Kim     if (Gbl_DoSignon)
236a9d8d09cSJung-uk Kim     {
237a9d8d09cSJung-uk Kim         printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
238a9d8d09cSJung-uk Kim         if (Gbl_IgnoreErrors)
239a9d8d09cSJung-uk Kim         {
240a9d8d09cSJung-uk Kim             printf ("Ignoring all errors, forcing AML file generation\n\n");
241a9d8d09cSJung-uk Kim         }
242a9d8d09cSJung-uk Kim     }
243a9d8d09cSJung-uk Kim 
244a9d8d09cSJung-uk Kim     if (BadCommandLine)
245a9d8d09cSJung-uk Kim     {
24679c6d946SJung-uk Kim         printf ("Use -h option for help information\n");
247a9d8d09cSJung-uk Kim         exit (1);
248a9d8d09cSJung-uk Kim     }
249a9d8d09cSJung-uk Kim 
250a9d8d09cSJung-uk Kim     return (AcpiGbl_Optind);
251a9d8d09cSJung-uk Kim }
252a9d8d09cSJung-uk Kim 
253a9d8d09cSJung-uk Kim 
254a9d8d09cSJung-uk Kim /*******************************************************************************
255a9d8d09cSJung-uk Kim  *
256a9d8d09cSJung-uk Kim  * FUNCTION:    AslDoOptions
257a9d8d09cSJung-uk Kim  *
258a9d8d09cSJung-uk Kim  * PARAMETERS:  argc/argv           - Standard argc/argv
259a9d8d09cSJung-uk Kim  *              IsResponseFile      - TRUE if executing a response file.
260a9d8d09cSJung-uk Kim  *
261a9d8d09cSJung-uk Kim  * RETURN:      Status
262a9d8d09cSJung-uk Kim  *
263a9d8d09cSJung-uk Kim  * DESCRIPTION: Command line option processing
264a9d8d09cSJung-uk Kim  *
265a9d8d09cSJung-uk Kim  ******************************************************************************/
266a9d8d09cSJung-uk Kim 
267a9d8d09cSJung-uk Kim static int
268a9d8d09cSJung-uk Kim AslDoOptions (
269a9d8d09cSJung-uk Kim     int                     argc,
270a9d8d09cSJung-uk Kim     char                    **argv,
271a9d8d09cSJung-uk Kim     BOOLEAN                 IsResponseFile)
272a9d8d09cSJung-uk Kim {
273a9d8d09cSJung-uk Kim     ACPI_STATUS             Status;
274a9d8d09cSJung-uk Kim     UINT32                  j;
275a9d8d09cSJung-uk Kim 
276a9d8d09cSJung-uk Kim 
277a9d8d09cSJung-uk Kim     /* Get the command line options */
278a9d8d09cSJung-uk Kim 
279313a0c13SJung-uk Kim     while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch (j)
280a9d8d09cSJung-uk Kim     {
281a9d8d09cSJung-uk Kim     case '@':   /* Begin a response file */
282a9d8d09cSJung-uk Kim 
283a9d8d09cSJung-uk Kim         if (IsResponseFile)
284a9d8d09cSJung-uk Kim         {
285a9d8d09cSJung-uk Kim             printf ("Nested command files are not supported\n");
286a9d8d09cSJung-uk Kim             return (-1);
287a9d8d09cSJung-uk Kim         }
288a9d8d09cSJung-uk Kim 
289a9d8d09cSJung-uk Kim         if (AslDoResponseFile (AcpiGbl_Optarg))
290a9d8d09cSJung-uk Kim         {
291a9d8d09cSJung-uk Kim             return (-1);
292a9d8d09cSJung-uk Kim         }
293a9d8d09cSJung-uk Kim         break;
294a9d8d09cSJung-uk Kim 
295f8146b88SJung-uk Kim     case 'a':   /* Debug options */
296f8146b88SJung-uk Kim 
297f8146b88SJung-uk Kim         switch (AcpiGbl_Optarg[0])
298f8146b88SJung-uk Kim         {
299f8146b88SJung-uk Kim         case 'r':
300f8146b88SJung-uk Kim 
301f8146b88SJung-uk Kim             Gbl_EnableReferenceTypechecking = TRUE;
302f8146b88SJung-uk Kim             break;
303f8146b88SJung-uk Kim 
304f8146b88SJung-uk Kim         default:
305f8146b88SJung-uk Kim 
306f8146b88SJung-uk Kim             printf ("Unknown option: -a%s\n", AcpiGbl_Optarg);
307f8146b88SJung-uk Kim             return (-1);
308f8146b88SJung-uk Kim         }
309f8146b88SJung-uk Kim 
310f8146b88SJung-uk Kim         break;
311f8146b88SJung-uk Kim 
312f8146b88SJung-uk Kim 
3131c0e1b6dSJung-uk Kim     case 'b':   /* Debug options */
314a9d8d09cSJung-uk Kim 
315a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
316a9d8d09cSJung-uk Kim         {
3170d84335fSJung-uk Kim 
3180d84335fSJung-uk Kim         case 'c':
3190d84335fSJung-uk Kim 
3200d84335fSJung-uk Kim             printf ("Debug ASL to ASL+ conversion\n");
3210d84335fSJung-uk Kim 
3220d84335fSJung-uk Kim             Gbl_DoAslConversion = TRUE;
3230d84335fSJung-uk Kim             Gbl_FoldConstants = FALSE;
3240d84335fSJung-uk Kim             Gbl_IntegerOptimizationFlag = FALSE;
3250d84335fSJung-uk Kim             Gbl_ReferenceOptimizationFlag = FALSE;
3260d84335fSJung-uk Kim             Gbl_OptimizeTrivialParseNodes = FALSE;
3270d84335fSJung-uk Kim             Gbl_CaptureComments = TRUE;
3280d84335fSJung-uk Kim             AcpiGbl_DoDisassemblerOptimizations = FALSE;
3290d84335fSJung-uk Kim             AcpiGbl_DebugAslConversion = TRUE;
3300d84335fSJung-uk Kim             AcpiGbl_DmEmitExternalOpcodes = TRUE;
3310d84335fSJung-uk Kim             Gbl_DoExternalsInPlace = TRUE;
3320d84335fSJung-uk Kim 
3330d84335fSJung-uk Kim             return (0);
3340d84335fSJung-uk Kim 
335a9d8d09cSJung-uk Kim         case 'f':
336a9d8d09cSJung-uk Kim 
337a9d8d09cSJung-uk Kim             AslCompilerdebug = 1; /* same as yydebug */
338a9d8d09cSJung-uk Kim             DtParserdebug = 1;
339a9d8d09cSJung-uk Kim             PrParserdebug = 1;
3401c0e1b6dSJung-uk Kim             Gbl_DebugFlag = TRUE;
3415ef50723SJung-uk Kim             Gbl_KeepPreprocessorTempFile = TRUE;
3421c0e1b6dSJung-uk Kim             break;
3431c0e1b6dSJung-uk Kim 
3441c0e1b6dSJung-uk Kim         case 'p':   /* Prune ASL parse tree */
3451c0e1b6dSJung-uk Kim 
3461c0e1b6dSJung-uk Kim             /* Get the required argument */
3471c0e1b6dSJung-uk Kim 
3481c0e1b6dSJung-uk Kim             if (AcpiGetoptArgument (argc, argv))
3491c0e1b6dSJung-uk Kim             {
3501c0e1b6dSJung-uk Kim                 return (-1);
3511c0e1b6dSJung-uk Kim             }
3521c0e1b6dSJung-uk Kim 
3531c0e1b6dSJung-uk Kim             Gbl_PruneParseTree = TRUE;
3541c0e1b6dSJung-uk Kim             Gbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
3551c0e1b6dSJung-uk Kim             break;
3561c0e1b6dSJung-uk Kim 
3571c0e1b6dSJung-uk Kim         case 's':
3581c0e1b6dSJung-uk Kim 
3591c0e1b6dSJung-uk Kim             Gbl_DebugFlag = TRUE;
360a9d8d09cSJung-uk Kim             break;
361a9d8d09cSJung-uk Kim 
362a9d8d09cSJung-uk Kim         case 't':
363a9d8d09cSJung-uk Kim 
3641c0e1b6dSJung-uk Kim             /* Get the required argument */
3651c0e1b6dSJung-uk Kim 
3661c0e1b6dSJung-uk Kim             if (AcpiGetoptArgument (argc, argv))
3671c0e1b6dSJung-uk Kim             {
3681c0e1b6dSJung-uk Kim                 return (-1);
3691c0e1b6dSJung-uk Kim             }
3701c0e1b6dSJung-uk Kim 
3711c0e1b6dSJung-uk Kim             Gbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
372a9d8d09cSJung-uk Kim             break;
373a9d8d09cSJung-uk Kim 
374a9d8d09cSJung-uk Kim         default:
375a9d8d09cSJung-uk Kim 
376a9d8d09cSJung-uk Kim             printf ("Unknown option: -b%s\n", AcpiGbl_Optarg);
377a9d8d09cSJung-uk Kim             return (-1);
378a9d8d09cSJung-uk Kim         }
379a9d8d09cSJung-uk Kim 
380a9d8d09cSJung-uk Kim         break;
381a9d8d09cSJung-uk Kim 
382a9d8d09cSJung-uk Kim     case 'c':
383a9d8d09cSJung-uk Kim 
384a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
385a9d8d09cSJung-uk Kim         {
3860d84335fSJung-uk Kim 
3870d84335fSJung-uk Kim         case 'a':
3880d84335fSJung-uk Kim 
3890d84335fSJung-uk Kim             printf ("Convert ASL to ASL+ with comments\n");
3900d84335fSJung-uk Kim             Gbl_DoAslConversion = TRUE;
3910d84335fSJung-uk Kim             Gbl_FoldConstants = FALSE;
3920d84335fSJung-uk Kim             Gbl_IntegerOptimizationFlag = FALSE;
3930d84335fSJung-uk Kim             Gbl_ReferenceOptimizationFlag = FALSE;
3940d84335fSJung-uk Kim             Gbl_OptimizeTrivialParseNodes = FALSE;
3950d84335fSJung-uk Kim             Gbl_CaptureComments = TRUE;
3960d84335fSJung-uk Kim             AcpiGbl_DoDisassemblerOptimizations = FALSE;
3970d84335fSJung-uk Kim             AcpiGbl_DmEmitExternalOpcodes = TRUE;
3980d84335fSJung-uk Kim             Gbl_DoExternalsInPlace = TRUE;
3990d84335fSJung-uk Kim 
4000d84335fSJung-uk Kim             return (0);
4010d84335fSJung-uk Kim 
402a9d8d09cSJung-uk Kim         case 'r':
403a9d8d09cSJung-uk Kim 
404a9d8d09cSJung-uk Kim             Gbl_NoResourceChecking = TRUE;
405a9d8d09cSJung-uk Kim             break;
406a9d8d09cSJung-uk Kim 
407a9d8d09cSJung-uk Kim         default:
408a9d8d09cSJung-uk Kim 
409a9d8d09cSJung-uk Kim             printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
410a9d8d09cSJung-uk Kim             return (-1);
411a9d8d09cSJung-uk Kim         }
412a9d8d09cSJung-uk Kim         break;
413a9d8d09cSJung-uk Kim 
414a9d8d09cSJung-uk Kim     case 'd':   /* Disassembler */
415a9d8d09cSJung-uk Kim 
416a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
417a9d8d09cSJung-uk Kim         {
418a9d8d09cSJung-uk Kim         case '^':
419a9d8d09cSJung-uk Kim 
420493deb39SJung-uk Kim             /* Get the required argument */
421493deb39SJung-uk Kim 
422493deb39SJung-uk Kim             if (AcpiGetoptArgument (argc, argv))
423493deb39SJung-uk Kim             {
424493deb39SJung-uk Kim                 return (-1);
425493deb39SJung-uk Kim             }
426493deb39SJung-uk Kim 
427a9d8d09cSJung-uk Kim             Gbl_DoCompile = FALSE;
428a9d8d09cSJung-uk Kim             break;
429a9d8d09cSJung-uk Kim 
430a9d8d09cSJung-uk Kim         case 'a':
431a9d8d09cSJung-uk Kim 
432493deb39SJung-uk Kim             /* Get the required argument */
433493deb39SJung-uk Kim 
434493deb39SJung-uk Kim             if (AcpiGetoptArgument (argc, argv))
435493deb39SJung-uk Kim             {
436493deb39SJung-uk Kim                 return (-1);
437493deb39SJung-uk Kim             }
438493deb39SJung-uk Kim 
439a9d8d09cSJung-uk Kim             Gbl_DoCompile = FALSE;
440a9d8d09cSJung-uk Kim             Gbl_DisassembleAll = TRUE;
441a9d8d09cSJung-uk Kim             break;
442a9d8d09cSJung-uk Kim 
443a9d8d09cSJung-uk Kim         case 'b':   /* Do not convert buffers to resource descriptors */
444a9d8d09cSJung-uk Kim 
445a9d8d09cSJung-uk Kim             AcpiGbl_NoResourceDisassembly = TRUE;
446a9d8d09cSJung-uk Kim             break;
447a9d8d09cSJung-uk Kim 
448a9d8d09cSJung-uk Kim         case 'c':
449a9d8d09cSJung-uk Kim 
450a9d8d09cSJung-uk Kim             break;
451a9d8d09cSJung-uk Kim 
4527cf3e94aSJung-uk Kim         case 'f':
4537cf3e94aSJung-uk Kim 
4547cf3e94aSJung-uk Kim             AcpiGbl_ForceAmlDisassembly = TRUE;
4557cf3e94aSJung-uk Kim             break;
4567cf3e94aSJung-uk Kim 
4571c0e1b6dSJung-uk Kim         case 'l':   /* Use legacy ASL code (not ASL+) for disassembly */
4581c0e1b6dSJung-uk Kim 
4591c0e1b6dSJung-uk Kim             Gbl_DoCompile = FALSE;
4601c0e1b6dSJung-uk Kim             AcpiGbl_CstyleDisassembly = FALSE;
4611c0e1b6dSJung-uk Kim             break;
4621c0e1b6dSJung-uk Kim 
463a9d8d09cSJung-uk Kim         default:
464a9d8d09cSJung-uk Kim 
465a9d8d09cSJung-uk Kim             printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
466a9d8d09cSJung-uk Kim             return (-1);
467a9d8d09cSJung-uk Kim         }
468a9d8d09cSJung-uk Kim 
469*af051161SJung-uk Kim         AcpiGbl_DisasmFlag = TRUE;
470a9d8d09cSJung-uk Kim         break;
471a9d8d09cSJung-uk Kim 
472a9d8d09cSJung-uk Kim     case 'D':   /* Define a symbol */
473a9d8d09cSJung-uk Kim 
474a9d8d09cSJung-uk Kim         PrAddDefine (AcpiGbl_Optarg, NULL, TRUE);
475a9d8d09cSJung-uk Kim         break;
476a9d8d09cSJung-uk Kim 
477a9d8d09cSJung-uk Kim     case 'e':   /* External files for disassembler */
478a9d8d09cSJung-uk Kim 
479313a0c13SJung-uk Kim         /* Get entire list of external files */
480313a0c13SJung-uk Kim 
481313a0c13SJung-uk Kim         AcpiGbl_Optind--;
482313a0c13SJung-uk Kim         argv[AcpiGbl_Optind] = AcpiGbl_Optarg;
483313a0c13SJung-uk Kim 
484313a0c13SJung-uk Kim         while (argv[AcpiGbl_Optind] &&
485313a0c13SJung-uk Kim               (argv[AcpiGbl_Optind][0] != '-'))
486313a0c13SJung-uk Kim         {
487313a0c13SJung-uk Kim             Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]);
488a9d8d09cSJung-uk Kim             if (ACPI_FAILURE (Status))
489a9d8d09cSJung-uk Kim             {
490f8146b88SJung-uk Kim                 printf ("Could not add %s to external list\n",
491f8146b88SJung-uk Kim                     argv[AcpiGbl_Optind]);
492a9d8d09cSJung-uk Kim                 return (-1);
493a9d8d09cSJung-uk Kim             }
494313a0c13SJung-uk Kim 
495313a0c13SJung-uk Kim             AcpiGbl_Optind++;
496313a0c13SJung-uk Kim         }
497a9d8d09cSJung-uk Kim         break;
498a9d8d09cSJung-uk Kim 
49979c6d946SJung-uk Kim     case 'f':
50079c6d946SJung-uk Kim 
50179c6d946SJung-uk Kim         switch (AcpiGbl_Optarg[0])
50279c6d946SJung-uk Kim         {
50379c6d946SJung-uk Kim         case '^':   /* Ignore errors and force creation of aml file */
504a9d8d09cSJung-uk Kim 
505a9d8d09cSJung-uk Kim             Gbl_IgnoreErrors = TRUE;
506a9d8d09cSJung-uk Kim             break;
507a9d8d09cSJung-uk Kim 
50879c6d946SJung-uk Kim         case 'e':   /* Disassembler: Get external declaration file */
50979c6d946SJung-uk Kim 
51079c6d946SJung-uk Kim             if (AcpiGetoptArgument (argc, argv))
51179c6d946SJung-uk Kim             {
51279c6d946SJung-uk Kim                 return (-1);
51379c6d946SJung-uk Kim             }
51479c6d946SJung-uk Kim 
51579c6d946SJung-uk Kim             Gbl_ExternalRefFilename = AcpiGbl_Optarg;
51679c6d946SJung-uk Kim             break;
51779c6d946SJung-uk Kim 
51879c6d946SJung-uk Kim         default:
51979c6d946SJung-uk Kim 
52079c6d946SJung-uk Kim             printf ("Unknown option: -f%s\n", AcpiGbl_Optarg);
52179c6d946SJung-uk Kim             return (-1);
52279c6d946SJung-uk Kim         }
52379c6d946SJung-uk Kim         break;
52479c6d946SJung-uk Kim 
525a9d8d09cSJung-uk Kim     case 'G':
526a9d8d09cSJung-uk Kim 
527a9d8d09cSJung-uk Kim         Gbl_CompileGeneric = TRUE;
528a9d8d09cSJung-uk Kim         break;
529a9d8d09cSJung-uk Kim 
530a9d8d09cSJung-uk Kim     case 'g':   /* Get all ACPI tables */
531a9d8d09cSJung-uk Kim 
532313a0c13SJung-uk Kim         printf ("-g option is deprecated, use acpidump utility instead\n");
533313a0c13SJung-uk Kim         exit (1);
534a9d8d09cSJung-uk Kim 
535a9d8d09cSJung-uk Kim     case 'h':
536a9d8d09cSJung-uk Kim 
537a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
538a9d8d09cSJung-uk Kim         {
539a9d8d09cSJung-uk Kim         case '^':
540a9d8d09cSJung-uk Kim 
541*af051161SJung-uk Kim             printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
542a9d8d09cSJung-uk Kim             Usage ();
543a9d8d09cSJung-uk Kim             exit (0);
544a9d8d09cSJung-uk Kim 
545a9d8d09cSJung-uk Kim         case 'c':
546a9d8d09cSJung-uk Kim 
547a9d8d09cSJung-uk Kim             UtDisplayConstantOpcodes ();
548a9d8d09cSJung-uk Kim             exit (0);
549a9d8d09cSJung-uk Kim 
550493deb39SJung-uk Kim         case 'd':
551493deb39SJung-uk Kim 
552493deb39SJung-uk Kim             AslDisassemblyHelp ();
553493deb39SJung-uk Kim             exit (0);
554493deb39SJung-uk Kim 
555a9d8d09cSJung-uk Kim         case 'f':
556a9d8d09cSJung-uk Kim 
557a9d8d09cSJung-uk Kim             AslFilenameHelp ();
558a9d8d09cSJung-uk Kim             exit (0);
559a9d8d09cSJung-uk Kim 
560a9d8d09cSJung-uk Kim         case 'r':
561a9d8d09cSJung-uk Kim 
562a9d8d09cSJung-uk Kim             /* reserved names */
563a9d8d09cSJung-uk Kim 
564a9d8d09cSJung-uk Kim             ApDisplayReservedNames ();
565a9d8d09cSJung-uk Kim             exit (0);
566a9d8d09cSJung-uk Kim 
567a9d8d09cSJung-uk Kim         case 't':
568a9d8d09cSJung-uk Kim 
569a9d8d09cSJung-uk Kim             UtDisplaySupportedTables ();
570a9d8d09cSJung-uk Kim             exit (0);
571a9d8d09cSJung-uk Kim 
572a9d8d09cSJung-uk Kim         default:
573a9d8d09cSJung-uk Kim 
574a9d8d09cSJung-uk Kim             printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
575a9d8d09cSJung-uk Kim             return (-1);
576a9d8d09cSJung-uk Kim         }
577a9d8d09cSJung-uk Kim 
578a9d8d09cSJung-uk Kim     case 'I':   /* Add an include file search directory */
579a9d8d09cSJung-uk Kim 
580a9d8d09cSJung-uk Kim         FlAddIncludeDirectory (AcpiGbl_Optarg);
581a9d8d09cSJung-uk Kim         break;
582a9d8d09cSJung-uk Kim 
583a9d8d09cSJung-uk Kim     case 'i':   /* Output AML as an include file */
584a9d8d09cSJung-uk Kim 
585a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
586a9d8d09cSJung-uk Kim         {
587a9d8d09cSJung-uk Kim         case 'a':
588a9d8d09cSJung-uk Kim 
589a9d8d09cSJung-uk Kim             /* Produce assembly code include file */
590a9d8d09cSJung-uk Kim 
591a9d8d09cSJung-uk Kim             Gbl_AsmIncludeOutputFlag = TRUE;
592a9d8d09cSJung-uk Kim             break;
593a9d8d09cSJung-uk Kim 
594a9d8d09cSJung-uk Kim         case 'c':
595a9d8d09cSJung-uk Kim 
596a9d8d09cSJung-uk Kim             /* Produce C include file */
597a9d8d09cSJung-uk Kim 
598a9d8d09cSJung-uk Kim             Gbl_C_IncludeOutputFlag = TRUE;
599a9d8d09cSJung-uk Kim             break;
600a9d8d09cSJung-uk Kim 
601a9d8d09cSJung-uk Kim         case 'n':
602a9d8d09cSJung-uk Kim 
603a9d8d09cSJung-uk Kim             /* Compiler/Disassembler: Ignore the NOOP operator */
604a9d8d09cSJung-uk Kim 
605a9d8d09cSJung-uk Kim             AcpiGbl_IgnoreNoopOperator = TRUE;
606a9d8d09cSJung-uk Kim             break;
607a9d8d09cSJung-uk Kim 
608a9d8d09cSJung-uk Kim         default:
609a9d8d09cSJung-uk Kim 
610a9d8d09cSJung-uk Kim             printf ("Unknown option: -i%s\n", AcpiGbl_Optarg);
611a9d8d09cSJung-uk Kim             return (-1);
612a9d8d09cSJung-uk Kim         }
613a9d8d09cSJung-uk Kim         break;
614a9d8d09cSJung-uk Kim 
615a9d8d09cSJung-uk Kim     case 'l':   /* Listing files */
616a9d8d09cSJung-uk Kim 
617a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
618a9d8d09cSJung-uk Kim         {
619a9d8d09cSJung-uk Kim         case '^':
620a9d8d09cSJung-uk Kim 
621a9d8d09cSJung-uk Kim             /* Produce listing file (Mixed source/aml) */
622a9d8d09cSJung-uk Kim 
623a9d8d09cSJung-uk Kim             Gbl_ListingFlag = TRUE;
62470e6ab8fSJung-uk Kim             AcpiGbl_DmOpt_Listing = TRUE;
625a9d8d09cSJung-uk Kim             break;
626a9d8d09cSJung-uk Kim 
627a9d8d09cSJung-uk Kim         case 'i':
628a9d8d09cSJung-uk Kim 
629a9d8d09cSJung-uk Kim             /* Produce preprocessor output file */
630a9d8d09cSJung-uk Kim 
631a9d8d09cSJung-uk Kim             Gbl_PreprocessorOutputFlag = TRUE;
632a9d8d09cSJung-uk Kim             break;
633a9d8d09cSJung-uk Kim 
634313a0c13SJung-uk Kim         case 'm':
635313a0c13SJung-uk Kim 
636313a0c13SJung-uk Kim             /* Produce hardware map summary file */
637313a0c13SJung-uk Kim 
638313a0c13SJung-uk Kim             Gbl_MapfileFlag = TRUE;
639313a0c13SJung-uk Kim             break;
640313a0c13SJung-uk Kim 
641a9d8d09cSJung-uk Kim         case 'n':
642a9d8d09cSJung-uk Kim 
643a9d8d09cSJung-uk Kim             /* Produce namespace file */
644a9d8d09cSJung-uk Kim 
645a9d8d09cSJung-uk Kim             Gbl_NsOutputFlag = TRUE;
646a9d8d09cSJung-uk Kim             break;
647a9d8d09cSJung-uk Kim 
648a9d8d09cSJung-uk Kim         case 's':
649a9d8d09cSJung-uk Kim 
650a9d8d09cSJung-uk Kim             /* Produce combined source file */
651a9d8d09cSJung-uk Kim 
652a9d8d09cSJung-uk Kim             Gbl_SourceOutputFlag = TRUE;
653a9d8d09cSJung-uk Kim             break;
654a9d8d09cSJung-uk Kim 
655f8146b88SJung-uk Kim         case 'x':
656f8146b88SJung-uk Kim 
657f8146b88SJung-uk Kim             /* Produce cross-reference file */
658f8146b88SJung-uk Kim 
659f8146b88SJung-uk Kim             Gbl_CrossReferenceOutput = TRUE;
660f8146b88SJung-uk Kim             break;
661f8146b88SJung-uk Kim 
662a9d8d09cSJung-uk Kim         default:
663a9d8d09cSJung-uk Kim 
664a9d8d09cSJung-uk Kim             printf ("Unknown option: -l%s\n", AcpiGbl_Optarg);
665a9d8d09cSJung-uk Kim             return (-1);
666a9d8d09cSJung-uk Kim         }
667a9d8d09cSJung-uk Kim         break;
668a9d8d09cSJung-uk Kim 
669a9d8d09cSJung-uk Kim     case 'm':   /* Set line buffer size */
670a9d8d09cSJung-uk Kim 
671a9d8d09cSJung-uk Kim         Gbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024;
672a9d8d09cSJung-uk Kim         if (Gbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE)
673a9d8d09cSJung-uk Kim         {
674a9d8d09cSJung-uk Kim             Gbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE;
675a9d8d09cSJung-uk Kim         }
676a9d8d09cSJung-uk Kim         printf ("Line Buffer Size: %u\n", Gbl_LineBufferSize);
677a9d8d09cSJung-uk Kim         break;
678a9d8d09cSJung-uk Kim 
679a9d8d09cSJung-uk Kim     case 'n':   /* Parse only */
680a9d8d09cSJung-uk Kim 
681a9d8d09cSJung-uk Kim         Gbl_ParseOnlyFlag = TRUE;
682a9d8d09cSJung-uk Kim         break;
683a9d8d09cSJung-uk Kim 
684a9d8d09cSJung-uk Kim     case 'o':   /* Control compiler AML optimizations */
685a9d8d09cSJung-uk Kim 
686a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
687a9d8d09cSJung-uk Kim         {
688a9d8d09cSJung-uk Kim         case 'a':
689a9d8d09cSJung-uk Kim 
690a9d8d09cSJung-uk Kim             /* Disable all optimizations */
691a9d8d09cSJung-uk Kim 
692a9d8d09cSJung-uk Kim             Gbl_FoldConstants = FALSE;
693a9d8d09cSJung-uk Kim             Gbl_IntegerOptimizationFlag = FALSE;
694a9d8d09cSJung-uk Kim             Gbl_ReferenceOptimizationFlag = FALSE;
6950d84335fSJung-uk Kim             Gbl_OptimizeTrivialParseNodes = FALSE;
6960d84335fSJung-uk Kim 
697a9d8d09cSJung-uk Kim             break;
698a9d8d09cSJung-uk Kim 
699f8146b88SJung-uk Kim         case 'c':
700f8146b88SJung-uk Kim 
701f8146b88SJung-uk Kim             /* Display compile time(s) */
702f8146b88SJung-uk Kim 
703f8146b88SJung-uk Kim             Gbl_CompileTimesFlag = TRUE;
704f8146b88SJung-uk Kim             break;
705f8146b88SJung-uk Kim 
706493deb39SJung-uk Kim         case 'd':
707493deb39SJung-uk Kim 
708493deb39SJung-uk Kim             /* Disable disassembler code optimizations */
709493deb39SJung-uk Kim 
710493deb39SJung-uk Kim             AcpiGbl_DoDisassemblerOptimizations = FALSE;
711493deb39SJung-uk Kim             break;
712493deb39SJung-uk Kim 
713f8146b88SJung-uk Kim         case 'e':
714f8146b88SJung-uk Kim 
7153920312eSJung-uk Kim             /* Disassembler: Emit embedded external operators */
7163920312eSJung-uk Kim 
7173920312eSJung-uk Kim             AcpiGbl_DmEmitExternalOpcodes = TRUE;
718f8146b88SJung-uk Kim             break;
719f8146b88SJung-uk Kim 
7200d84335fSJung-uk Kim         case 'E':
7210d84335fSJung-uk Kim 
7220d84335fSJung-uk Kim             /*
7230d84335fSJung-uk Kim              * iASL: keep External opcodes in place.
7240d84335fSJung-uk Kim              * No affect if Gbl_DoExternals is false.
7250d84335fSJung-uk Kim              */
7260d84335fSJung-uk Kim 
7270d84335fSJung-uk Kim             Gbl_DoExternalsInPlace = TRUE;
7280d84335fSJung-uk Kim             break;
7290d84335fSJung-uk Kim 
730a9d8d09cSJung-uk Kim         case 'f':
731a9d8d09cSJung-uk Kim 
732a9d8d09cSJung-uk Kim             /* Disable folding on "normal" expressions */
733a9d8d09cSJung-uk Kim 
734a9d8d09cSJung-uk Kim             Gbl_FoldConstants = FALSE;
735a9d8d09cSJung-uk Kim             break;
736a9d8d09cSJung-uk Kim 
737a9d8d09cSJung-uk Kim         case 'i':
738a9d8d09cSJung-uk Kim 
739a9d8d09cSJung-uk Kim             /* Disable integer optimization to constants */
740a9d8d09cSJung-uk Kim 
741a9d8d09cSJung-uk Kim             Gbl_IntegerOptimizationFlag = FALSE;
742a9d8d09cSJung-uk Kim             break;
743a9d8d09cSJung-uk Kim 
744a9d8d09cSJung-uk Kim         case 'n':
745a9d8d09cSJung-uk Kim 
746a9d8d09cSJung-uk Kim             /* Disable named reference optimization */
747a9d8d09cSJung-uk Kim 
748a9d8d09cSJung-uk Kim             Gbl_ReferenceOptimizationFlag = FALSE;
749a9d8d09cSJung-uk Kim             break;
750a9d8d09cSJung-uk Kim 
751a9d8d09cSJung-uk Kim         case 't':
752a9d8d09cSJung-uk Kim 
753f8146b88SJung-uk Kim             /* Disable heavy typechecking */
754a9d8d09cSJung-uk Kim 
755f8146b88SJung-uk Kim             Gbl_DoTypechecking = FALSE;
756a9d8d09cSJung-uk Kim             break;
757a9d8d09cSJung-uk Kim 
758a9d8d09cSJung-uk Kim         default:
759a9d8d09cSJung-uk Kim 
760a9d8d09cSJung-uk Kim             printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
761a9d8d09cSJung-uk Kim             return (-1);
762a9d8d09cSJung-uk Kim         }
763a9d8d09cSJung-uk Kim         break;
764a9d8d09cSJung-uk Kim 
765a9d8d09cSJung-uk Kim     case 'P':   /* Preprocessor options */
766a9d8d09cSJung-uk Kim 
767a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
768a9d8d09cSJung-uk Kim         {
769a9d8d09cSJung-uk Kim         case '^':   /* Proprocess only, emit (.i) file */
770a9d8d09cSJung-uk Kim 
771a9d8d09cSJung-uk Kim             Gbl_PreprocessOnly = TRUE;
772a9d8d09cSJung-uk Kim             Gbl_PreprocessorOutputFlag = TRUE;
773a9d8d09cSJung-uk Kim             break;
774a9d8d09cSJung-uk Kim 
775a9d8d09cSJung-uk Kim         case 'n':   /* Disable preprocessor */
776a9d8d09cSJung-uk Kim 
777a9d8d09cSJung-uk Kim             Gbl_PreprocessFlag = FALSE;
778a9d8d09cSJung-uk Kim             break;
779a9d8d09cSJung-uk Kim 
780a9d8d09cSJung-uk Kim         default:
781a9d8d09cSJung-uk Kim 
782a9d8d09cSJung-uk Kim             printf ("Unknown option: -P%s\n", AcpiGbl_Optarg);
783a9d8d09cSJung-uk Kim             return (-1);
784a9d8d09cSJung-uk Kim         }
785a9d8d09cSJung-uk Kim         break;
786a9d8d09cSJung-uk Kim 
787a9d8d09cSJung-uk Kim     case 'p':   /* Override default AML output filename */
788a9d8d09cSJung-uk Kim 
789a9d8d09cSJung-uk Kim         Gbl_OutputFilenamePrefix = AcpiGbl_Optarg;
790313a0c13SJung-uk Kim         UtConvertBackslashes (Gbl_OutputFilenamePrefix);
791a9d8d09cSJung-uk Kim         Gbl_UseDefaultAmlFilename = FALSE;
792a9d8d09cSJung-uk Kim         break;
793a9d8d09cSJung-uk Kim 
7940d84335fSJung-uk Kim     case 'q':   /* ASL/ASl+ converter: compile only and leave badaml. */
7950d84335fSJung-uk Kim 
7960d84335fSJung-uk Kim         printf ("Convert ASL to ASL+ with comments\n");
7970d84335fSJung-uk Kim         Gbl_FoldConstants = FALSE;
7980d84335fSJung-uk Kim         Gbl_IntegerOptimizationFlag = FALSE;
7990d84335fSJung-uk Kim         Gbl_ReferenceOptimizationFlag = FALSE;
8000d84335fSJung-uk Kim         Gbl_OptimizeTrivialParseNodes = FALSE;
8010d84335fSJung-uk Kim         Gbl_CaptureComments = TRUE;
8020d84335fSJung-uk Kim         Gbl_DoExternalsInPlace = TRUE;
8030d84335fSJung-uk Kim         return (0);
8040d84335fSJung-uk Kim 
805a9d8d09cSJung-uk Kim     case 'r':   /* Override revision found in table header */
806a9d8d09cSJung-uk Kim 
807a9d8d09cSJung-uk Kim         Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
808a9d8d09cSJung-uk Kim         break;
809a9d8d09cSJung-uk Kim 
810a9d8d09cSJung-uk Kim     case 's':   /* Create AML in a source code file */
811a9d8d09cSJung-uk Kim 
812a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
813a9d8d09cSJung-uk Kim         {
814a9d8d09cSJung-uk Kim         case 'a':
815a9d8d09cSJung-uk Kim 
816a9d8d09cSJung-uk Kim             /* Produce assembly code output file */
817a9d8d09cSJung-uk Kim 
818a9d8d09cSJung-uk Kim             Gbl_AsmOutputFlag = TRUE;
819a9d8d09cSJung-uk Kim             break;
820a9d8d09cSJung-uk Kim 
821a9d8d09cSJung-uk Kim         case 'c':
822a9d8d09cSJung-uk Kim 
823a9d8d09cSJung-uk Kim             /* Produce C hex output file */
824a9d8d09cSJung-uk Kim 
825a9d8d09cSJung-uk Kim             Gbl_C_OutputFlag = TRUE;
826a9d8d09cSJung-uk Kim             break;
827a9d8d09cSJung-uk Kim 
828a9d8d09cSJung-uk Kim         case 'o':
829a9d8d09cSJung-uk Kim 
830a9d8d09cSJung-uk Kim             /* Produce AML offset table in C */
831a9d8d09cSJung-uk Kim 
832a9d8d09cSJung-uk Kim             Gbl_C_OffsetTableFlag = TRUE;
833a9d8d09cSJung-uk Kim             break;
834a9d8d09cSJung-uk Kim 
835a9d8d09cSJung-uk Kim         default:
836a9d8d09cSJung-uk Kim 
837a9d8d09cSJung-uk Kim             printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
838a9d8d09cSJung-uk Kim             return (-1);
839a9d8d09cSJung-uk Kim         }
840a9d8d09cSJung-uk Kim         break;
841a9d8d09cSJung-uk Kim 
842a9d8d09cSJung-uk Kim     case 't':   /* Produce hex table output file */
843a9d8d09cSJung-uk Kim 
844a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
845a9d8d09cSJung-uk Kim         {
846a9d8d09cSJung-uk Kim         case 'a':
847a9d8d09cSJung-uk Kim 
848a9d8d09cSJung-uk Kim             Gbl_HexOutputFlag = HEX_OUTPUT_ASM;
849a9d8d09cSJung-uk Kim             break;
850a9d8d09cSJung-uk Kim 
851a9d8d09cSJung-uk Kim         case 'c':
852a9d8d09cSJung-uk Kim 
853a9d8d09cSJung-uk Kim             Gbl_HexOutputFlag = HEX_OUTPUT_C;
854a9d8d09cSJung-uk Kim             break;
855a9d8d09cSJung-uk Kim 
856a9d8d09cSJung-uk Kim         case 's':
857a9d8d09cSJung-uk Kim 
858a9d8d09cSJung-uk Kim             Gbl_HexOutputFlag = HEX_OUTPUT_ASL;
859a9d8d09cSJung-uk Kim             break;
860a9d8d09cSJung-uk Kim 
861a9d8d09cSJung-uk Kim         default:
862a9d8d09cSJung-uk Kim 
863a9d8d09cSJung-uk Kim             printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
864a9d8d09cSJung-uk Kim             return (-1);
865a9d8d09cSJung-uk Kim         }
866a9d8d09cSJung-uk Kim         break;
867a9d8d09cSJung-uk Kim 
868a9d8d09cSJung-uk Kim     case 'T':   /* Create a ACPI table template file */
869a9d8d09cSJung-uk Kim 
870a9d8d09cSJung-uk Kim         Gbl_DoTemplates = TRUE;
871a9d8d09cSJung-uk Kim         break;
872a9d8d09cSJung-uk Kim 
873a9d8d09cSJung-uk Kim     case 'v':   /* Version and verbosity settings */
874a9d8d09cSJung-uk Kim 
875a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
876a9d8d09cSJung-uk Kim         {
877a9d8d09cSJung-uk Kim         case '^':
878a9d8d09cSJung-uk Kim 
879a9d8d09cSJung-uk Kim             printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
880a9d8d09cSJung-uk Kim             exit (0);
881a9d8d09cSJung-uk Kim 
882a9d8d09cSJung-uk Kim         case 'a':
883a9d8d09cSJung-uk Kim 
884313a0c13SJung-uk Kim             /* Disable all error/warning/remark messages */
885a9d8d09cSJung-uk Kim 
886a9d8d09cSJung-uk Kim             Gbl_NoErrors = TRUE;
887a9d8d09cSJung-uk Kim             break;
888a9d8d09cSJung-uk Kim 
889313a0c13SJung-uk Kim         case 'e':
890313a0c13SJung-uk Kim 
891313a0c13SJung-uk Kim             /* Disable all warning/remark messages (errors only) */
892313a0c13SJung-uk Kim 
893313a0c13SJung-uk Kim             Gbl_DisplayRemarks = FALSE;
894313a0c13SJung-uk Kim             Gbl_DisplayWarnings = FALSE;
895313a0c13SJung-uk Kim             break;
896313a0c13SJung-uk Kim 
897a9d8d09cSJung-uk Kim         case 'i':
898a9d8d09cSJung-uk Kim             /*
899a9d8d09cSJung-uk Kim              * Support for integrated development environment(s).
900a9d8d09cSJung-uk Kim              *
901a9d8d09cSJung-uk Kim              * 1) No compiler signon
902a9d8d09cSJung-uk Kim              * 2) Send stderr messages to stdout
903a9d8d09cSJung-uk Kim              * 3) Less verbose error messages (single line only for each)
904a9d8d09cSJung-uk Kim              * 4) Error/warning messages are formatted appropriately to
905a9d8d09cSJung-uk Kim              *    be recognized by MS Visual Studio
906a9d8d09cSJung-uk Kim              */
907a9d8d09cSJung-uk Kim             Gbl_VerboseErrors = FALSE;
908a9d8d09cSJung-uk Kim             Gbl_DoSignon = FALSE;
909a9d8d09cSJung-uk Kim             Gbl_Files[ASL_FILE_STDERR].Handle = stdout;
910a9d8d09cSJung-uk Kim             break;
911a9d8d09cSJung-uk Kim 
912a9d8d09cSJung-uk Kim         case 'o':
913a9d8d09cSJung-uk Kim 
914a9d8d09cSJung-uk Kim             Gbl_DisplayOptimizations = TRUE;
915a9d8d09cSJung-uk Kim             break;
916a9d8d09cSJung-uk Kim 
917a9d8d09cSJung-uk Kim         case 'r':
918a9d8d09cSJung-uk Kim 
919a9d8d09cSJung-uk Kim             Gbl_DisplayRemarks = FALSE;
920a9d8d09cSJung-uk Kim             break;
921a9d8d09cSJung-uk Kim 
922a9d8d09cSJung-uk Kim         case 's':
923a9d8d09cSJung-uk Kim 
924a9d8d09cSJung-uk Kim             Gbl_DoSignon = FALSE;
925a9d8d09cSJung-uk Kim             break;
926a9d8d09cSJung-uk Kim 
927a9d8d09cSJung-uk Kim         case 't':
928a9d8d09cSJung-uk Kim 
929a9d8d09cSJung-uk Kim             Gbl_VerboseTemplates = TRUE;
930a9d8d09cSJung-uk Kim             break;
931a9d8d09cSJung-uk Kim 
932a9d8d09cSJung-uk Kim         case 'w':
933a9d8d09cSJung-uk Kim 
934a9d8d09cSJung-uk Kim             /* Get the required argument */
935a9d8d09cSJung-uk Kim 
936a9d8d09cSJung-uk Kim             if (AcpiGetoptArgument (argc, argv))
937a9d8d09cSJung-uk Kim             {
938a9d8d09cSJung-uk Kim                 return (-1);
939a9d8d09cSJung-uk Kim             }
940a9d8d09cSJung-uk Kim 
941a9d8d09cSJung-uk Kim             Status = AslDisableException (AcpiGbl_Optarg);
942a9d8d09cSJung-uk Kim             if (ACPI_FAILURE (Status))
943a9d8d09cSJung-uk Kim             {
944a9d8d09cSJung-uk Kim                 return (-1);
945a9d8d09cSJung-uk Kim             }
946a9d8d09cSJung-uk Kim             break;
947a9d8d09cSJung-uk Kim 
948a9d8d09cSJung-uk Kim         default:
949a9d8d09cSJung-uk Kim 
950a9d8d09cSJung-uk Kim             printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
951a9d8d09cSJung-uk Kim             return (-1);
952a9d8d09cSJung-uk Kim         }
953a9d8d09cSJung-uk Kim         break;
954a9d8d09cSJung-uk Kim 
955a9d8d09cSJung-uk Kim     case 'w': /* Set warning levels */
956a9d8d09cSJung-uk Kim 
957a9d8d09cSJung-uk Kim         switch (AcpiGbl_Optarg[0])
958a9d8d09cSJung-uk Kim         {
959a9d8d09cSJung-uk Kim         case '1':
960a9d8d09cSJung-uk Kim 
961a9d8d09cSJung-uk Kim             Gbl_WarningLevel = ASL_WARNING;
962a9d8d09cSJung-uk Kim             break;
963a9d8d09cSJung-uk Kim 
964a9d8d09cSJung-uk Kim         case '2':
965a9d8d09cSJung-uk Kim 
966a9d8d09cSJung-uk Kim             Gbl_WarningLevel = ASL_WARNING2;
967a9d8d09cSJung-uk Kim             break;
968a9d8d09cSJung-uk Kim 
969a9d8d09cSJung-uk Kim         case '3':
970a9d8d09cSJung-uk Kim 
971a9d8d09cSJung-uk Kim             Gbl_WarningLevel = ASL_WARNING3;
972a9d8d09cSJung-uk Kim             break;
973a9d8d09cSJung-uk Kim 
974a9d8d09cSJung-uk Kim         case 'e':
975a9d8d09cSJung-uk Kim 
976a9d8d09cSJung-uk Kim             Gbl_WarningsAsErrors = TRUE;
977a9d8d09cSJung-uk Kim             break;
978a9d8d09cSJung-uk Kim 
979a9d8d09cSJung-uk Kim         default:
980a9d8d09cSJung-uk Kim 
981a9d8d09cSJung-uk Kim             printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
982a9d8d09cSJung-uk Kim             return (-1);
983a9d8d09cSJung-uk Kim         }
984a9d8d09cSJung-uk Kim         break;
985a9d8d09cSJung-uk Kim 
986a9d8d09cSJung-uk Kim     case 'x':   /* Set debug print output level */
987a9d8d09cSJung-uk Kim 
988a9d8d09cSJung-uk Kim         AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16);
989a9d8d09cSJung-uk Kim         break;
990a9d8d09cSJung-uk Kim 
991a9d8d09cSJung-uk Kim     case 'z':
992a9d8d09cSJung-uk Kim 
993a9d8d09cSJung-uk Kim         Gbl_UseOriginalCompilerId = TRUE;
994a9d8d09cSJung-uk Kim         break;
995a9d8d09cSJung-uk Kim 
996a9d8d09cSJung-uk Kim     default:
997a9d8d09cSJung-uk Kim 
998a9d8d09cSJung-uk Kim         return (-1);
999a9d8d09cSJung-uk Kim     }
1000a9d8d09cSJung-uk Kim 
1001a9d8d09cSJung-uk Kim     return (0);
1002a9d8d09cSJung-uk Kim }
1003a9d8d09cSJung-uk Kim 
1004a9d8d09cSJung-uk Kim 
1005a9d8d09cSJung-uk Kim /*******************************************************************************
1006a9d8d09cSJung-uk Kim  *
1007a9d8d09cSJung-uk Kim  * FUNCTION:    AslMergeOptionTokens
1008a9d8d09cSJung-uk Kim  *
1009a9d8d09cSJung-uk Kim  * PARAMETERS:  InBuffer            - Input containing an option string
1010a9d8d09cSJung-uk Kim  *              OutBuffer           - Merged output buffer
1011a9d8d09cSJung-uk Kim  *
1012a9d8d09cSJung-uk Kim  * RETURN:      None
1013a9d8d09cSJung-uk Kim  *
1014a9d8d09cSJung-uk Kim  * DESCRIPTION: Remove all whitespace from an option string.
1015a9d8d09cSJung-uk Kim  *
1016a9d8d09cSJung-uk Kim  ******************************************************************************/
1017a9d8d09cSJung-uk Kim 
1018a9d8d09cSJung-uk Kim static void
1019a9d8d09cSJung-uk Kim AslMergeOptionTokens (
1020a9d8d09cSJung-uk Kim     char                    *InBuffer,
1021a9d8d09cSJung-uk Kim     char                    *OutBuffer)
1022a9d8d09cSJung-uk Kim {
1023a9d8d09cSJung-uk Kim     char                    *Token;
1024a9d8d09cSJung-uk Kim 
1025a9d8d09cSJung-uk Kim 
1026a9d8d09cSJung-uk Kim     *OutBuffer = 0;
1027a9d8d09cSJung-uk Kim 
1028a9d8d09cSJung-uk Kim     Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS);
1029a9d8d09cSJung-uk Kim     while (Token)
1030a9d8d09cSJung-uk Kim     {
1031a9d8d09cSJung-uk Kim         strcat (OutBuffer, Token);
1032a9d8d09cSJung-uk Kim         Token = strtok (NULL, ASL_TOKEN_SEPARATORS);
1033a9d8d09cSJung-uk Kim     }
1034a9d8d09cSJung-uk Kim }
1035a9d8d09cSJung-uk Kim 
1036a9d8d09cSJung-uk Kim 
1037a9d8d09cSJung-uk Kim /*******************************************************************************
1038a9d8d09cSJung-uk Kim  *
1039a9d8d09cSJung-uk Kim  * FUNCTION:    AslDoResponseFile
1040a9d8d09cSJung-uk Kim  *
1041a9d8d09cSJung-uk Kim  * PARAMETERS:  Filename        - Name of the response file
1042a9d8d09cSJung-uk Kim  *
1043a9d8d09cSJung-uk Kim  * RETURN:      Status
1044a9d8d09cSJung-uk Kim  *
1045a9d8d09cSJung-uk Kim  * DESCRIPTION: Open a response file and process all options within.
1046a9d8d09cSJung-uk Kim  *
1047a9d8d09cSJung-uk Kim  ******************************************************************************/
1048a9d8d09cSJung-uk Kim 
1049a9d8d09cSJung-uk Kim static int
1050a9d8d09cSJung-uk Kim AslDoResponseFile (
1051a9d8d09cSJung-uk Kim     char                    *Filename)
1052a9d8d09cSJung-uk Kim {
1053a9d8d09cSJung-uk Kim     char                    *argv = StringBuffer2;
1054a9d8d09cSJung-uk Kim     FILE                    *ResponseFile;
1055a9d8d09cSJung-uk Kim     int                     OptStatus = 0;
1056a9d8d09cSJung-uk Kim     int                     Opterr;
1057a9d8d09cSJung-uk Kim     int                     Optind;
1058a9d8d09cSJung-uk Kim 
1059a9d8d09cSJung-uk Kim 
1060a9d8d09cSJung-uk Kim     ResponseFile = fopen (Filename, "r");
1061a9d8d09cSJung-uk Kim     if (!ResponseFile)
1062a9d8d09cSJung-uk Kim     {
1063a9d8d09cSJung-uk Kim         printf ("Could not open command file %s, %s\n",
1064a9d8d09cSJung-uk Kim             Filename, strerror (errno));
1065a9d8d09cSJung-uk Kim         return (-1);
1066a9d8d09cSJung-uk Kim     }
1067a9d8d09cSJung-uk Kim 
1068a9d8d09cSJung-uk Kim     /* Must save the current GetOpt globals */
1069a9d8d09cSJung-uk Kim 
1070a9d8d09cSJung-uk Kim     Opterr = AcpiGbl_Opterr;
1071a9d8d09cSJung-uk Kim     Optind = AcpiGbl_Optind;
1072a9d8d09cSJung-uk Kim 
1073a9d8d09cSJung-uk Kim     /*
1074a9d8d09cSJung-uk Kim      * Process all lines in the response file. There must be one complete
1075a9d8d09cSJung-uk Kim      * option per line
1076a9d8d09cSJung-uk Kim      */
1077a9d8d09cSJung-uk Kim     while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile))
1078a9d8d09cSJung-uk Kim     {
1079a9d8d09cSJung-uk Kim         /* Compress all tokens, allowing us to use a single argv entry */
1080a9d8d09cSJung-uk Kim 
1081a9d8d09cSJung-uk Kim         AslMergeOptionTokens (StringBuffer, StringBuffer2);
1082a9d8d09cSJung-uk Kim 
1083a9d8d09cSJung-uk Kim         /* Process the option */
1084a9d8d09cSJung-uk Kim 
1085a9d8d09cSJung-uk Kim         AcpiGbl_Opterr = 0;
1086a9d8d09cSJung-uk Kim         AcpiGbl_Optind = 0;
1087a9d8d09cSJung-uk Kim 
1088a9d8d09cSJung-uk Kim         OptStatus = AslDoOptions (1, &argv, TRUE);
1089a9d8d09cSJung-uk Kim         if (OptStatus)
1090a9d8d09cSJung-uk Kim         {
1091a9d8d09cSJung-uk Kim             printf ("Invalid option in command file %s: %s\n",
1092a9d8d09cSJung-uk Kim                 Filename, StringBuffer);
1093a9d8d09cSJung-uk Kim             break;
1094a9d8d09cSJung-uk Kim         }
1095a9d8d09cSJung-uk Kim     }
1096a9d8d09cSJung-uk Kim 
1097a9d8d09cSJung-uk Kim     /* Restore the GetOpt globals */
1098a9d8d09cSJung-uk Kim 
1099a9d8d09cSJung-uk Kim     AcpiGbl_Opterr = Opterr;
1100a9d8d09cSJung-uk Kim     AcpiGbl_Optind = Optind;
1101a9d8d09cSJung-uk Kim 
1102a9d8d09cSJung-uk Kim     fclose (ResponseFile);
1103a9d8d09cSJung-uk Kim     return (OptStatus);
1104a9d8d09cSJung-uk Kim }
1105