Rev 1498 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1498 | serge | 1 | |
2 | * |
||
3 | * Module Name: aslmain - compiler main and utilities |
||
4 | * |
||
5 | *****************************************************************************/ |
||
6 | |||
7 | |||
8 | * |
||
9 | * 1. Copyright Notice |
||
10 | * |
||
11 | * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
||
2216 | Serge | 12 | * All rights reserved. |
1498 | serge | 13 | * |
14 | * 2. License |
||
15 | * |
||
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
||
17 | * rights. You may have additional license terms from the party that provided |
||
18 | * you this software, covering your right to use that party's intellectual |
||
19 | * property rights. |
||
20 | * |
||
21 | * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a |
||
22 | * copy of the source code appearing in this file ("Covered Code") an |
||
23 | * irrevocable, perpetual, worldwide license under Intel's copyrights in the |
||
24 | * base code distributed originally by Intel ("Original Intel Code") to copy, |
||
25 | * make derivatives, distribute, use and display any portion of the Covered |
||
26 | * Code in any form, with the right to sublicense such rights; and |
||
27 | * |
||
28 | * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent |
||
29 | * license (with the right to sublicense), under only those claims of Intel |
||
30 | * patents that are infringed by the Original Intel Code, to make, use, sell, |
||
31 | * offer to sell, and import the Covered Code and derivative works thereof |
||
32 | * solely to the minimum extent necessary to exercise the above copyright |
||
33 | * license, and in no event shall the patent license extend to any additions |
||
34 | * to or modifications of the Original Intel Code. No other license or right |
||
35 | * is granted directly or by implication, estoppel or otherwise; |
||
36 | * |
||
37 | * The above copyright and patent license is granted only if the following |
||
38 | * conditions are met: |
||
39 | * |
||
40 | * 3. Conditions |
||
41 | * |
||
42 | * 3.1. Redistribution of Source with Rights to Further Distribute Source. |
||
43 | * Redistribution of source code of any substantial portion of the Covered |
||
44 | * Code or modification with rights to further distribute source must include |
||
45 | * the above Copyright Notice, the above License, this list of Conditions, |
||
46 | * and the following Disclaimer and Export Compliance provision. In addition, |
||
47 | * Licensee must cause all Covered Code to which Licensee contributes to |
||
48 | * contain a file documenting the changes Licensee made to create that Covered |
||
49 | * Code and the date of any change. Licensee must include in that file the |
||
50 | * documentation of any changes made by any predecessor Licensee. Licensee |
||
51 | * must include a prominent statement that the modification is derived, |
||
52 | * directly or indirectly, from Original Intel Code. |
||
53 | * |
||
54 | * 3.2. Redistribution of Source with no Rights to Further Distribute Source. |
||
55 | * Redistribution of source code of any substantial portion of the Covered |
||
56 | * Code or modification without rights to further distribute source must |
||
57 | * include the following Disclaimer and Export Compliance provision in the |
||
58 | * documentation and/or other materials provided with distribution. In |
||
59 | * addition, Licensee may not authorize further sublicense of source of any |
||
60 | * portion of the Covered Code, and must include terms to the effect that the |
||
61 | * license from Licensee to its licensee is limited to the intellectual |
||
62 | * property embodied in the software Licensee provides to its licensee, and |
||
63 | * not to intellectual property embodied in modifications its licensee may |
||
64 | * make. |
||
65 | * |
||
66 | * 3.3. Redistribution of Executable. Redistribution in executable form of any |
||
67 | * substantial portion of the Covered Code or modification must reproduce the |
||
68 | * above Copyright Notice, and the following Disclaimer and Export Compliance |
||
69 | * provision in the documentation and/or other materials provided with the |
||
70 | * distribution. |
||
71 | * |
||
72 | * 3.4. Intel retains all right, title, and interest in and to the Original |
||
73 | * Intel Code. |
||
74 | * |
||
75 | * 3.5. Neither the name Intel nor any other trademark owned or controlled by |
||
76 | * Intel shall be used in advertising or otherwise to promote the sale, use or |
||
77 | * other dealings in products derived from or relating to the Covered Code |
||
78 | * without prior written authorization from Intel. |
||
79 | * |
||
80 | * 4. Disclaimer and Export Compliance |
||
81 | * |
||
82 | * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED |
||
83 | * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE |
||
84 | * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, |
||
85 | * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY |
||
86 | * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY |
||
87 | * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A |
||
88 | * PARTICULAR PURPOSE. |
||
89 | * |
||
90 | * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES |
||
91 | * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR |
||
92 | * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, |
||
93 | * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY |
||
94 | * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL |
||
95 | * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS |
||
96 | * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY |
||
97 | * LIMITED REMEDY. |
||
98 | * |
||
99 | * 4.3. Licensee shall not export, either directly or indirectly, any of this |
||
100 | * software or system incorporating such software without first obtaining any |
||
101 | * required license or other approval from the U. S. Department of Commerce or |
||
102 | * any other agency or department of the United States Government. In the |
||
103 | * event Licensee exports any such software from the United States or |
||
104 | * re-exports any such software from a foreign destination, Licensee shall |
||
105 | * ensure that the distribution and export/re-export of the software is in |
||
106 | * compliance with all laws, regulations, orders, or other restrictions of the |
||
107 | * U.S. Export Administration Regulations. Licensee agrees that neither it nor |
||
108 | * any of its subsidiaries will export/re-export any technical data, process, |
||
109 | * software, or service, directly or indirectly, to any country for which the |
||
110 | * United States government or any agency thereof requires an export license, |
||
111 | * other governmental approval, or letter of assurance, without first obtaining |
||
112 | * such license, approval or letter. |
||
113 | * |
||
114 | *****************************************************************************/ |
||
115 | |||
116 | |||
117 | |||
118 | |||
119 | |||
120 | #include "acapps.h" |
||
121 | #include "acdisasm.h" |
||
2216 | Serge | 122 | |
1498 | serge | 123 | |
124 | #include |
||
125 | #endif |
||
126 | |||
127 | |||
128 | ACPI_MODULE_NAME ("aslmain") |
||
129 | |||
130 | |||
131 | |||
132 | |||
133 | Options ( |
||
134 | void); |
||
135 | |||
136 | |||
137 | HelpMessage ( |
||
138 | void); |
||
139 | |||
140 | |||
141 | Usage ( |
||
142 | void); |
||
143 | |||
144 | |||
145 | AslInitialize ( |
||
146 | void); |
||
147 | |||
148 | |||
149 | AslCommandLine ( |
||
150 | int argc, |
||
151 | char **argv); |
||
152 | |||
153 | |||
154 | AslDoOptions ( |
||
155 | int argc, |
||
156 | char **argv, |
||
157 | BOOLEAN IsResponseFile); |
||
158 | |||
159 | |||
160 | AslMergeOptionTokens ( |
||
161 | char *InBuffer, |
||
162 | char *OutBuffer); |
||
163 | |||
164 | |||
165 | AslDoResponseFile ( |
||
166 | char *Filename); |
||
167 | |||
168 | |||
169 | |||
170 | #define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:T:v:w:x:z" |
||
2216 | Serge | 171 | |
1498 | serge | 172 | |
173 | |||
174 | * |
||
175 | * FUNCTION: Options |
||
176 | * |
||
177 | * PARAMETERS: None |
||
178 | * |
||
179 | * RETURN: None |
||
180 | * |
||
181 | * DESCRIPTION: Display option help message |
||
182 | * |
||
183 | ******************************************************************************/ |
||
184 | |||
185 | |||
186 | Options ( |
||
187 | void) |
||
188 | { |
||
189 | |||
190 | |||
191 | printf (" -@ |
||
192 | printf (" -I |
||
193 | |||
194 | |||
195 | printf (" -p |
||
196 | printf (" -va Disable all errors and warnings (summary only)\n"); |
||
197 | printf (" -vi Less verbose errors and warnings for use with IDEs\n"); |
||
198 | printf (" -vo Enable optimization comments\n"); |
||
199 | printf (" -vr Disable remarks\n"); |
||
200 | printf (" -vs Disable signon\n"); |
||
201 | printf (" -w<1|2|3> Set warning reporting level\n"); |
||
202 | |||
203 | |||
204 | printf (" -s Create AML in assembler or C source file (*.asm or *.c)\n"); |
||
205 | printf (" -i Create assembler or C include file (*.inc or *.h)\n"); |
||
206 | printf (" -t Create AML in assembler, C, or ASL hex table (*.hex)\n"); |
||
207 | |||
208 | |||
209 | printf (" -oa Disable all optimizations (compatibility mode)\n"); |
||
210 | printf (" -of Disable constant folding\n"); |
||
211 | printf (" -oi Disable integer optimization to Zero/One/Ones\n"); |
||
212 | printf (" -on Disable named reference string optimization\n"); |
||
213 | printf (" -cr Disable Resource Descriptor error checking\n"); |
||
214 | printf (" -r |
||
215 | |||
216 | |||
2216 | Serge | 217 | printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n"); |
1498 | serge | 218 | printf (" -ln Create namespace file (*.nsp)\n"); |
219 | printf (" -ls Create combined source file (expanded includes) (*.src)\n"); |
||
220 | |||
221 | |||
2216 | Serge | 222 | printf (" -T |
223 | printf (" -vt Create verbose templates (full disassembly)\n"); |
||
224 | |||
225 | |||
1498 | serge | 226 | printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n"); |
227 | printf (" -da [f1,f2] Disassemble multiple tables from single namespace\n"); |
||
2216 | Serge | 228 | printf (" -dc [file] Disassemble AML and immediately compile it\n"); |
1498 | serge | 229 | printf (" (Obtain DSDT from current system if no input file)\n"); |
230 | printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n"); |
||
231 | printf (" -2 Emit ACPI 2.0 compatible ASL code\n"); |
||
232 | printf (" -g Get ACPI tables and write to files (*.dat)\n"); |
||
233 | |||
234 | |||
235 | printf (" -h Additional help and compiler debug options\n"); |
||
236 | printf (" -hc Display operators allowed in constant expressions\n"); |
||
237 | printf (" -hr Display ACPI reserved method names\n"); |
||
238 | printf (" -ht Display currently supported ACPI table names\n"); |
||
2216 | Serge | 239 | } |
1498 | serge | 240 | |
241 | |||
242 | |||
243 | * |
||
244 | * FUNCTION: HelpMessage |
||
245 | * |
||
246 | * PARAMETERS: None |
||
247 | * |
||
248 | * RETURN: None |
||
249 | * |
||
250 | * DESCRIPTION: Display help message |
||
251 | * |
||
252 | ******************************************************************************/ |
||
253 | |||
254 | |||
255 | HelpMessage ( |
||
256 | void) |
||
257 | { |
||
258 | |||
259 | |||
260 | printf (" Output filenames are generated by appending an extension to a common\n"); |
||
261 | printf (" filename prefix. The filename prefix is obtained via one of the\n"); |
||
262 | printf (" following methods (in priority order):\n"); |
||
263 | printf (" 1) The -p option specifies the prefix\n"); |
||
264 | printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); |
||
265 | printf (" 3) The prefix of the input filename\n"); |
||
266 | printf ("\n"); |
||
267 | |||
268 | |||
269 | |||
270 | |||
271 | printf (" -b |
||
272 | printf (" Types: Parse/Tree/Both\n"); |
||
273 | printf (" -f Ignore errors, force creation of AML output file(s)\n"); |
||
274 | printf (" -n Parse only, no output generation\n"); |
||
275 | printf (" -ot Display compile times\n"); |
||
276 | printf (" -x |
||
277 | printf (" -z Do not insert new compiler ID for DataTables\n"); |
||
278 | } |
||
279 | |||
280 | |||
281 | |||
282 | * |
||
283 | * FUNCTION: Usage |
||
284 | * |
||
285 | * PARAMETERS: None |
||
286 | * |
||
287 | * RETURN: None |
||
288 | * |
||
289 | * DESCRIPTION: Display usage and option message |
||
290 | * |
||
291 | ******************************************************************************/ |
||
292 | |||
293 | |||
294 | Usage ( |
||
295 | void) |
||
296 | { |
||
297 | |||
298 | |||
2216 | Serge | 299 | printf ("Usage: %s [Options] [Files]\n\n", ASL_INVOCATION_NAME); |
300 | Options (); |
||
1498 | serge | 301 | } |
302 | |||
303 | |||
304 | |||
305 | * |
||
306 | * FUNCTION: AslInitialize |
||
307 | * |
||
308 | * PARAMETERS: None |
||
309 | * |
||
310 | * RETURN: None |
||
311 | * |
||
312 | * DESCRIPTION: Initialize compiler globals |
||
313 | * |
||
314 | ******************************************************************************/ |
||
315 | |||
316 | |||
317 | AslInitialize ( |
||
318 | void) |
||
319 | { |
||
320 | UINT32 i; |
||
321 | |||
322 | |||
323 | |||
324 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0)); |
||
325 | #endif |
||
326 | |||
327 | |||
328 | |||
329 | |||
330 | { |
||
331 | Gbl_Files[i].Handle = NULL; |
||
332 | Gbl_Files[i].Filename = NULL; |
||
333 | } |
||
334 | |||
335 | |||
336 | Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; |
||
337 | |||
338 | |||
339 | Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; |
||
340 | } |
||
341 | |||
342 | |||
343 | |||
344 | * |
||
345 | * FUNCTION: AslMergeOptionTokens |
||
346 | * |
||
347 | * PARAMETERS: InBuffer - Input containing an option string |
||
348 | * OutBuffer - Merged output buffer |
||
349 | * |
||
350 | * RETURN: None |
||
351 | * |
||
352 | * DESCRIPTION: Remove all whitespace from an option string. |
||
353 | * |
||
354 | ******************************************************************************/ |
||
355 | |||
356 | |||
357 | AslMergeOptionTokens ( |
||
358 | char *InBuffer, |
||
359 | char *OutBuffer) |
||
360 | { |
||
361 | char *Token; |
||
362 | |||
363 | |||
364 | |||
365 | |||
366 | |||
367 | while (Token) |
||
368 | { |
||
369 | strcat (OutBuffer, Token); |
||
370 | Token = strtok (NULL, ASL_TOKEN_SEPARATORS); |
||
371 | } |
||
372 | } |
||
373 | |||
374 | |||
375 | |||
376 | * |
||
377 | * FUNCTION: AslDoResponseFile |
||
378 | * |
||
379 | * PARAMETERS: Filename - Name of the response file |
||
380 | * |
||
381 | * RETURN: Status |
||
382 | * |
||
383 | * DESCRIPTION: Open a response file and process all options within. |
||
384 | * |
||
385 | ******************************************************************************/ |
||
386 | |||
387 | |||
388 | AslDoResponseFile ( |
||
389 | char *Filename) |
||
390 | { |
||
391 | char *argv = StringBuffer2; |
||
392 | FILE *ResponseFile; |
||
393 | int OptStatus = 0; |
||
394 | int Opterr; |
||
395 | int Optind; |
||
396 | |||
397 | |||
398 | |||
399 | if (!ResponseFile) |
||
400 | { |
||
401 | printf ("Could not open command file %s, %s\n", |
||
402 | Filename, strerror (errno)); |
||
403 | return -1; |
||
404 | } |
||
405 | |||
406 | |||
407 | |||
408 | |||
409 | Optind = AcpiGbl_Optind; |
||
410 | |||
411 | |||
412 | * Process all lines in the response file. There must be one complete |
||
413 | * option per line |
||
414 | */ |
||
415 | while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) |
||
416 | { |
||
417 | /* Compress all tokens, allowing us to use a single argv entry */ |
||
418 | |||
419 | |||
420 | |||
421 | |||
422 | |||
423 | |||
424 | AcpiGbl_Optind = 0; |
||
425 | |||
426 | |||
427 | if (OptStatus) |
||
428 | { |
||
429 | printf ("Invalid option in command file %s: %s\n", |
||
430 | Filename, StringBuffer); |
||
431 | break; |
||
432 | } |
||
433 | } |
||
434 | |||
435 | |||
436 | |||
437 | |||
438 | AcpiGbl_Optind = Optind; |
||
439 | |||
440 | |||
441 | return (OptStatus); |
||
442 | } |
||
443 | |||
444 | |||
445 | |||
446 | * |
||
447 | * FUNCTION: AslDoOptions |
||
448 | * |
||
449 | * PARAMETERS: argc/argv - Standard argc/argv |
||
450 | * IsResponseFile - TRUE if executing a response file. |
||
451 | * |
||
452 | * RETURN: Status |
||
453 | * |
||
454 | * DESCRIPTION: Command line option processing |
||
455 | * |
||
456 | ******************************************************************************/ |
||
457 | |||
458 | |||
459 | AslDoOptions ( |
||
460 | int argc, |
||
461 | char **argv, |
||
462 | BOOLEAN IsResponseFile) |
||
463 | { |
||
464 | int j; |
||
465 | ACPI_STATUS Status; |
||
2216 | Serge | 466 | |
1498 | serge | 467 | |
468 | |||
469 | |||
470 | |||
471 | { |
||
472 | case '@': /* Begin a response file */ |
||
473 | |||
474 | |||
475 | { |
||
476 | printf ("Nested command files are not supported\n"); |
||
477 | return -1; |
||
478 | } |
||
479 | |||
480 | |||
481 | { |
||
482 | return -1; |
||
483 | } |
||
484 | break; |
||
485 | |||
486 | |||
487 | |||
488 | |||
489 | |||
490 | break; |
||
491 | |||
492 | |||
493 | |||
494 | |||
495 | |||
496 | { |
||
497 | case 'b': |
||
498 | AslCompilerdebug = 1; /* same as yydebug */ |
||
499 | DtParserdebug = 1; |
||
2216 | Serge | 500 | break; |
1498 | serge | 501 | |
502 | |||
503 | AslCompilerdebug = 1; /* same as yydebug */ |
||
504 | DtParserdebug = 1; |
||
2216 | Serge | 505 | break; |
1498 | serge | 506 | |
507 | |||
508 | break; |
||
509 | |||
510 | |||
511 | printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); |
||
512 | return (-1); |
||
513 | } |
||
514 | |||
515 | |||
516 | |||
517 | |||
518 | break; |
||
519 | |||
520 | |||
521 | |||
522 | switch (AcpiGbl_Optarg[0]) |
||
523 | { |
||
524 | case 'r': |
||
525 | Gbl_NoResourceChecking = TRUE; |
||
526 | break; |
||
527 | |||
528 | |||
529 | printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); |
||
530 | return (-1); |
||
531 | } |
||
532 | break; |
||
533 | |||
534 | |||
535 | |||
536 | switch (AcpiGbl_Optarg[0]) |
||
537 | { |
||
538 | case '^': |
||
539 | Gbl_DoCompile = FALSE; |
||
540 | break; |
||
541 | |||
542 | |||
2216 | Serge | 543 | Gbl_DoCompile = FALSE; |
544 | Gbl_DisassembleAll = TRUE; |
||
545 | break; |
||
546 | |||
547 | |||
1498 | serge | 548 | break; |
549 | |||
550 | |||
551 | printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); |
||
552 | return (-1); |
||
553 | } |
||
554 | |||
555 | |||
556 | break; |
||
557 | |||
558 | |||
559 | |||
560 | Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg); |
||
2216 | Serge | 561 | if (ACPI_FAILURE (Status)) |
562 | { |
||
563 | printf ("Could not add %s to external list\n", AcpiGbl_Optarg); |
||
564 | return (-1); |
||
565 | } |
||
566 | break; |
||
1498 | serge | 567 | |
568 | |||
569 | |||
570 | |||
571 | |||
572 | |||
573 | |||
574 | break; |
||
575 | |||
576 | |||
577 | |||
578 | |||
579 | |||
580 | |||
581 | |||
582 | Gbl_DoCompile = FALSE; |
||
583 | break; |
||
584 | |||
585 | |||
586 | |||
587 | |||
588 | |||
589 | { |
||
590 | case '^': |
||
591 | HelpMessage (); |
||
592 | exit (0); |
||
593 | |||
594 | |||
595 | UtDisplayConstantOpcodes (); |
||
596 | exit (0); |
||
597 | |||
598 | |||
599 | /* reserved names */ |
||
600 | |||
601 | |||
602 | exit (0); |
||
603 | |||
604 | |||
2216 | Serge | 605 | UtDisplaySupportedTables (); |
606 | exit (0); |
||
607 | |||
608 | |||
1498 | serge | 609 | printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); |
610 | return (-1); |
||
611 | } |
||
612 | |||
613 | |||
614 | |||
615 | |||
616 | |||
617 | break; |
||
618 | |||
619 | |||
620 | |||
621 | |||
622 | |||
623 | { |
||
624 | case 'a': |
||
625 | |||
626 | |||
627 | |||
628 | |||
629 | break; |
||
630 | |||
631 | |||
632 | |||
633 | |||
634 | |||
635 | |||
636 | break; |
||
637 | |||
638 | |||
639 | printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); |
||
640 | return (-1); |
||
641 | } |
||
642 | break; |
||
643 | |||
644 | |||
645 | |||
646 | |||
647 | |||
648 | { |
||
649 | case '^': |
||
650 | /* Produce listing file (Mixed source/aml) */ |
||
651 | |||
652 | |||
653 | break; |
||
654 | |||
655 | |||
656 | /* Produce namespace file */ |
||
657 | |||
658 | |||
659 | break; |
||
660 | |||
661 | |||
662 | /* Produce combined source file */ |
||
663 | |||
664 | |||
665 | break; |
||
666 | |||
667 | |||
668 | printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); |
||
669 | return (-1); |
||
670 | } |
||
671 | break; |
||
672 | |||
673 | |||
674 | |||
675 | |||
676 | |||
677 | { |
||
678 | case 'a': |
||
679 | |||
680 | |||
681 | |||
682 | |||
683 | Gbl_IntegerOptimizationFlag = FALSE; |
||
684 | Gbl_ReferenceOptimizationFlag = FALSE; |
||
685 | break; |
||
686 | |||
687 | |||
688 | |||
689 | |||
690 | |||
691 | |||
692 | break; |
||
693 | |||
694 | |||
695 | |||
696 | |||
697 | |||
698 | |||
699 | break; |
||
700 | |||
701 | |||
702 | |||
703 | |||
704 | |||
705 | |||
706 | break; |
||
707 | |||
708 | |||
709 | |||
710 | |||
711 | |||
712 | |||
713 | break; |
||
714 | |||
715 | |||
716 | printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); |
||
717 | return (-1); |
||
718 | } |
||
719 | break; |
||
720 | |||
721 | |||
722 | |||
723 | |||
724 | |||
725 | |||
726 | |||
727 | break; |
||
728 | |||
729 | |||
730 | |||
731 | |||
732 | |||
733 | |||
734 | |||
735 | Gbl_UseDefaultAmlFilename = FALSE; |
||
736 | break; |
||
737 | |||
738 | |||
739 | |||
740 | Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); |
||
741 | break; |
||
742 | |||
743 | |||
744 | |||
745 | |||
746 | |||
747 | { |
||
748 | case 'a': |
||
749 | |||
750 | |||
751 | |||
752 | |||
753 | break; |
||
754 | |||
755 | |||
756 | |||
757 | |||
758 | |||
759 | |||
760 | break; |
||
761 | |||
762 | |||
763 | printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); |
||
764 | return (-1); |
||
765 | } |
||
766 | break; |
||
767 | |||
768 | |||
769 | |||
770 | |||
771 | |||
772 | |||
773 | |||
774 | { |
||
775 | case 'a': |
||
776 | Gbl_HexOutputFlag = HEX_OUTPUT_ASM; |
||
777 | break; |
||
778 | |||
779 | |||
780 | Gbl_HexOutputFlag = HEX_OUTPUT_C; |
||
781 | break; |
||
782 | |||
783 | |||
784 | Gbl_HexOutputFlag = HEX_OUTPUT_ASL; |
||
785 | break; |
||
786 | |||
787 | |||
788 | printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); |
||
789 | return (-1); |
||
790 | } |
||
791 | break; |
||
792 | |||
793 | |||
794 | |||
2216 | Serge | 795 | Gbl_DoTemplates = TRUE; |
796 | Gbl_TemplateSignature = AcpiGbl_Optarg; |
||
797 | break; |
||
798 | |||
799 | |||
800 | |||
1498 | serge | 801 | |
802 | |||
803 | { |
||
804 | case 'a': |
||
805 | /* Disable All error/warning messages */ |
||
806 | |||
807 | |||
808 | break; |
||
809 | |||
810 | |||
811 | /* Less verbose error messages */ |
||
812 | |||
813 | |||
814 | break; |
||
815 | |||
816 | |||
817 | Gbl_DisplayOptimizations = TRUE; |
||
818 | break; |
||
819 | |||
820 | |||
821 | Gbl_DisplayRemarks = FALSE; |
||
822 | break; |
||
823 | |||
824 | |||
825 | Gbl_DoSignon = FALSE; |
||
826 | break; |
||
827 | |||
828 | |||
2216 | Serge | 829 | Gbl_VerboseTemplates = TRUE; |
830 | break; |
||
831 | |||
832 | |||
1498 | serge | 833 | printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); |
834 | return (-1); |
||
835 | } |
||
836 | break; |
||
837 | |||
838 | |||
839 | |||
840 | |||
841 | |||
842 | { |
||
843 | case '1': |
||
844 | Gbl_WarningLevel = ASL_WARNING; |
||
845 | break; |
||
846 | |||
847 | |||
848 | Gbl_WarningLevel = ASL_WARNING2; |
||
849 | break; |
||
850 | |||
851 | |||
852 | Gbl_WarningLevel = ASL_WARNING3; |
||
853 | break; |
||
854 | |||
855 | |||
856 | printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); |
||
857 | return (-1); |
||
858 | } |
||
859 | break; |
||
860 | |||
861 | |||
862 | |||
863 | |||
864 | |||
865 | break; |
||
866 | |||
867 | |||
868 | |||
869 | |||
870 | |||
871 | break; |
||
872 | |||
873 | |||
874 | |||
875 | |||
876 | |||
877 | } |
||
878 | |||
879 | |||
880 | } |
||
881 | |||
882 | |||
883 | |||
884 | * |
||
885 | * FUNCTION: AslCommandLine |
||
886 | * |
||
887 | * PARAMETERS: argc/argv |
||
888 | * |
||
889 | * RETURN: Last argv index |
||
890 | * |
||
891 | * DESCRIPTION: Command line processing |
||
892 | * |
||
893 | ******************************************************************************/ |
||
894 | |||
895 | |||
896 | AslCommandLine ( |
||
897 | int argc, |
||
898 | char **argv) |
||
899 | { |
||
900 | int BadCommandLine = 0; |
||
901 | ACPI_STATUS Status; |
||
2216 | Serge | 902 | |
1498 | serge | 903 | |
904 | |||
905 | |||
906 | |||
907 | { |
||
908 | printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); |
||
2216 | Serge | 909 | Usage (); |
1498 | serge | 910 | exit (1); |
911 | } |
||
912 | |||
913 | |||
914 | |||
915 | |||
916 | |||
917 | |||
2216 | Serge | 918 | { |
919 | Status = DtCreateTemplates (Gbl_TemplateSignature); |
||
920 | if (ACPI_FAILURE (Status)) |
||
921 | { |
||
922 | exit (-1); |
||
923 | } |
||
924 | exit (1); |
||
925 | } |
||
926 | |||
927 | |||
1498 | serge | 928 | |
929 | |||
930 | !Gbl_DisasmFlag && |
||
931 | !Gbl_GetAllTables) |
||
932 | { |
||
933 | printf ("Missing input filename\n"); |
||
934 | BadCommandLine = TRUE; |
||
935 | } |
||
936 | |||
937 | |||
938 | { |
||
939 | printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); |
||
2216 | Serge | 940 | } |
1498 | serge | 941 | |
942 | |||
943 | |||
944 | |||
945 | { |
||
946 | printf ("\n"); |
||
947 | Usage (); |
||
948 | exit (1); |
||
949 | } |
||
950 | |||
951 | |||
952 | } |
||
953 | |||
954 | |||
955 | |||
956 | * |
||
957 | * FUNCTION: main |
||
958 | * |
||
959 | * PARAMETERS: Standard argc/argv |
||
960 | * |
||
961 | * RETURN: Program termination code |
||
962 | * |
||
963 | * DESCRIPTION: C main routine for the Asl Compiler. Handle command line |
||
964 | * options and begin the compile for each file on the command line |
||
965 | * |
||
966 | ******************************************************************************/ |
||
967 | |||
968 | |||
969 | main ( |
||
970 | int argc, |
||
971 | char **argv) |
||
972 | { |
||
973 | ACPI_STATUS Status; |
||
974 | int Index1; |
||
2216 | Serge | 975 | int Index2; |
976 | |||
1498 | serge | 977 | |
978 | |||
2216 | Serge | 979 | |
980 | |||
1498 | serge | 981 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | |
982 | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); |
||
983 | #endif |
||
984 | |||
985 | |||
986 | |||
987 | |||
988 | Index1 = Index2 = AslCommandLine (argc, argv); |
||
2216 | Serge | 989 | |
1498 | serge | 990 | |
991 | |||
992 | |||
993 | { |
||
994 | Status = AslDoOneFile (NULL); |
||
995 | if (ACPI_FAILURE (Status)) |
||
996 | { |
||
997 | return (-1); |
||
998 | } |
||
999 | return (0); |
||
1000 | } |
||
1001 | |||
1002 | |||
2216 | Serge | 1003 | { |
1004 | while (argv[Index1]) |
||
1005 | { |
||
1006 | Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList); |
||
1007 | if (ACPI_FAILURE (Status)) |
||
1008 | { |
||
1009 | return (-1); |
||
1010 | } |
||
1011 | |||
1012 | |||
1013 | } |
||
1014 | } |
||
1015 | |||
1016 | |||
1498 | serge | 1017 | |
1018 | |||
2216 | Serge | 1019 | { |
1498 | serge | 1020 | Status = AslDoOnePathname (argv[Index2], AslDoOneFile); |
2216 | Serge | 1021 | if (ACPI_FAILURE (Status)) |
1498 | serge | 1022 | { |
1023 | return (-1); |
||
1024 | } |
||
1025 | |||
1026 | |||
2216 | Serge | 1027 | } |
1498 | serge | 1028 | |
1029 | |||
2216 | Serge | 1030 | { |
1031 | AcpiDmClearExternalFileList(); |
||
1032 | } |
||
1033 | |||
1034 | |||
1498 | serge | 1035 | }>>1|2|3> |
1036 |