aslcompile.c revision 1.3.2.2 1 1.3.2.2 bouyer
2 1.3.2.2 bouyer /******************************************************************************
3 1.3.2.2 bouyer *
4 1.3.2.2 bouyer * Module Name: aslcompile - top level compile module
5 1.3.2.2 bouyer *
6 1.3.2.2 bouyer *****************************************************************************/
7 1.3.2.2 bouyer
8 1.3.2.2 bouyer /*
9 1.3.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
10 1.3.2.2 bouyer * All rights reserved.
11 1.3.2.2 bouyer *
12 1.3.2.2 bouyer * Redistribution and use in source and binary forms, with or without
13 1.3.2.2 bouyer * modification, are permitted provided that the following conditions
14 1.3.2.2 bouyer * are met:
15 1.3.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
16 1.3.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
17 1.3.2.2 bouyer * without modification.
18 1.3.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 1.3.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
20 1.3.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
21 1.3.2.2 bouyer * including a substantially similar Disclaimer requirement for further
22 1.3.2.2 bouyer * binary redistribution.
23 1.3.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
24 1.3.2.2 bouyer * of any contributors may be used to endorse or promote products derived
25 1.3.2.2 bouyer * from this software without specific prior written permission.
26 1.3.2.2 bouyer *
27 1.3.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
28 1.3.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
29 1.3.2.2 bouyer * Software Foundation.
30 1.3.2.2 bouyer *
31 1.3.2.2 bouyer * NO WARRANTY
32 1.3.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 1.3.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 1.3.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 1.3.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 1.3.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 1.3.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 1.3.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 1.3.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 1.3.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 1.3.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 1.3.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
43 1.3.2.2 bouyer */
44 1.3.2.2 bouyer
45 1.3.2.2 bouyer #include "aslcompiler.h"
46 1.3.2.2 bouyer
47 1.3.2.2 bouyer #include <stdio.h>
48 1.3.2.2 bouyer #include <time.h>
49 1.3.2.2 bouyer #include <acapps.h>
50 1.3.2.2 bouyer
51 1.3.2.2 bouyer #define _COMPONENT ACPI_COMPILER
52 1.3.2.2 bouyer ACPI_MODULE_NAME ("aslcompile")
53 1.3.2.2 bouyer
54 1.3.2.2 bouyer /* Local prototypes */
55 1.3.2.2 bouyer
56 1.3.2.2 bouyer static void
57 1.3.2.2 bouyer CmFlushSourceCode (
58 1.3.2.2 bouyer void);
59 1.3.2.2 bouyer
60 1.3.2.2 bouyer static void
61 1.3.2.2 bouyer FlConsumeAnsiComment (
62 1.3.2.2 bouyer ASL_FILE_INFO *FileInfo,
63 1.3.2.2 bouyer ASL_FILE_STATUS *Status);
64 1.3.2.2 bouyer
65 1.3.2.2 bouyer static void
66 1.3.2.2 bouyer FlConsumeNewComment (
67 1.3.2.2 bouyer ASL_FILE_INFO *FileInfo,
68 1.3.2.2 bouyer ASL_FILE_STATUS *Status);
69 1.3.2.2 bouyer
70 1.3.2.2 bouyer
71 1.3.2.2 bouyer /*******************************************************************************
72 1.3.2.2 bouyer *
73 1.3.2.2 bouyer * FUNCTION: AslCompilerSignon
74 1.3.2.2 bouyer *
75 1.3.2.2 bouyer * PARAMETERS: FileId - ID of the output file
76 1.3.2.2 bouyer *
77 1.3.2.2 bouyer * RETURN: None
78 1.3.2.2 bouyer *
79 1.3.2.2 bouyer * DESCRIPTION: Display compiler signon
80 1.3.2.2 bouyer *
81 1.3.2.2 bouyer ******************************************************************************/
82 1.3.2.2 bouyer
83 1.3.2.2 bouyer void
84 1.3.2.2 bouyer AslCompilerSignon (
85 1.3.2.2 bouyer UINT32 FileId)
86 1.3.2.2 bouyer {
87 1.3.2.2 bouyer char *Prefix = "";
88 1.3.2.2 bouyer char *UtilityName;
89 1.3.2.2 bouyer
90 1.3.2.2 bouyer
91 1.3.2.2 bouyer /* Set line prefix depending on the destination file type */
92 1.3.2.2 bouyer
93 1.3.2.2 bouyer switch (FileId)
94 1.3.2.2 bouyer {
95 1.3.2.2 bouyer case ASL_FILE_ASM_SOURCE_OUTPUT:
96 1.3.2.2 bouyer case ASL_FILE_ASM_INCLUDE_OUTPUT:
97 1.3.2.2 bouyer
98 1.3.2.2 bouyer Prefix = "; ";
99 1.3.2.2 bouyer break;
100 1.3.2.2 bouyer
101 1.3.2.2 bouyer case ASL_FILE_HEX_OUTPUT:
102 1.3.2.2 bouyer
103 1.3.2.2 bouyer if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
104 1.3.2.2 bouyer {
105 1.3.2.2 bouyer Prefix = "; ";
106 1.3.2.2 bouyer }
107 1.3.2.2 bouyer else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
108 1.3.2.2 bouyer (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
109 1.3.2.2 bouyer {
110 1.3.2.2 bouyer FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
111 1.3.2.2 bouyer Prefix = " * ";
112 1.3.2.2 bouyer }
113 1.3.2.2 bouyer break;
114 1.3.2.2 bouyer
115 1.3.2.2 bouyer case ASL_FILE_C_SOURCE_OUTPUT:
116 1.3.2.2 bouyer case ASL_FILE_C_INCLUDE_OUTPUT:
117 1.3.2.2 bouyer
118 1.3.2.2 bouyer Prefix = " * ";
119 1.3.2.2 bouyer break;
120 1.3.2.2 bouyer
121 1.3.2.2 bouyer default:
122 1.3.2.2 bouyer /* No other output types supported */
123 1.3.2.2 bouyer break;
124 1.3.2.2 bouyer }
125 1.3.2.2 bouyer
126 1.3.2.2 bouyer /* Running compiler or disassembler? */
127 1.3.2.2 bouyer
128 1.3.2.2 bouyer if (Gbl_DisasmFlag)
129 1.3.2.2 bouyer {
130 1.3.2.2 bouyer UtilityName = AML_DISASSEMBLER_NAME;
131 1.3.2.2 bouyer }
132 1.3.2.2 bouyer else
133 1.3.2.2 bouyer {
134 1.3.2.2 bouyer UtilityName = ASL_COMPILER_NAME;
135 1.3.2.2 bouyer }
136 1.3.2.2 bouyer
137 1.3.2.2 bouyer /* Compiler signon with copyright */
138 1.3.2.2 bouyer
139 1.3.2.2 bouyer FlPrintFile (FileId, "%s\n", Prefix);
140 1.3.2.2 bouyer FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix));
141 1.3.2.2 bouyer }
142 1.3.2.2 bouyer
143 1.3.2.2 bouyer
144 1.3.2.2 bouyer /*******************************************************************************
145 1.3.2.2 bouyer *
146 1.3.2.2 bouyer * FUNCTION: AslCompilerFileHeader
147 1.3.2.2 bouyer *
148 1.3.2.2 bouyer * PARAMETERS: FileId - ID of the output file
149 1.3.2.2 bouyer *
150 1.3.2.2 bouyer * RETURN: None
151 1.3.2.2 bouyer *
152 1.3.2.2 bouyer * DESCRIPTION: Header used at the beginning of output files
153 1.3.2.2 bouyer *
154 1.3.2.2 bouyer ******************************************************************************/
155 1.3.2.2 bouyer
156 1.3.2.2 bouyer void
157 1.3.2.2 bouyer AslCompilerFileHeader (
158 1.3.2.2 bouyer UINT32 FileId)
159 1.3.2.2 bouyer {
160 1.3.2.2 bouyer struct tm *NewTime;
161 1.3.2.2 bouyer time_t Aclock;
162 1.3.2.2 bouyer char *Prefix = "";
163 1.3.2.2 bouyer
164 1.3.2.2 bouyer
165 1.3.2.2 bouyer /* Set line prefix depending on the destination file type */
166 1.3.2.2 bouyer
167 1.3.2.2 bouyer switch (FileId)
168 1.3.2.2 bouyer {
169 1.3.2.2 bouyer case ASL_FILE_ASM_SOURCE_OUTPUT:
170 1.3.2.2 bouyer case ASL_FILE_ASM_INCLUDE_OUTPUT:
171 1.3.2.2 bouyer
172 1.3.2.2 bouyer Prefix = "; ";
173 1.3.2.2 bouyer break;
174 1.3.2.2 bouyer
175 1.3.2.2 bouyer case ASL_FILE_HEX_OUTPUT:
176 1.3.2.2 bouyer
177 1.3.2.2 bouyer if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
178 1.3.2.2 bouyer {
179 1.3.2.2 bouyer Prefix = "; ";
180 1.3.2.2 bouyer }
181 1.3.2.2 bouyer else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
182 1.3.2.2 bouyer (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
183 1.3.2.2 bouyer {
184 1.3.2.2 bouyer Prefix = " * ";
185 1.3.2.2 bouyer }
186 1.3.2.2 bouyer break;
187 1.3.2.2 bouyer
188 1.3.2.2 bouyer case ASL_FILE_C_SOURCE_OUTPUT:
189 1.3.2.2 bouyer case ASL_FILE_C_INCLUDE_OUTPUT:
190 1.3.2.2 bouyer
191 1.3.2.2 bouyer Prefix = " * ";
192 1.3.2.2 bouyer break;
193 1.3.2.2 bouyer
194 1.3.2.2 bouyer default:
195 1.3.2.2 bouyer /* No other output types supported */
196 1.3.2.2 bouyer break;
197 1.3.2.2 bouyer }
198 1.3.2.2 bouyer
199 1.3.2.2 bouyer /* Compilation header with timestamp */
200 1.3.2.2 bouyer
201 1.3.2.2 bouyer (void) time (&Aclock);
202 1.3.2.2 bouyer NewTime = localtime (&Aclock);
203 1.3.2.2 bouyer
204 1.3.2.2 bouyer FlPrintFile (FileId,
205 1.3.2.2 bouyer "%sCompilation of \"%s\" - %s%s\n",
206 1.3.2.2 bouyer Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
207 1.3.2.2 bouyer Prefix);
208 1.3.2.2 bouyer
209 1.3.2.2 bouyer switch (FileId)
210 1.3.2.2 bouyer {
211 1.3.2.2 bouyer case ASL_FILE_C_SOURCE_OUTPUT:
212 1.3.2.2 bouyer case ASL_FILE_C_INCLUDE_OUTPUT:
213 1.3.2.2 bouyer FlPrintFile (FileId, " */\n");
214 1.3.2.2 bouyer break;
215 1.3.2.2 bouyer
216 1.3.2.2 bouyer default:
217 1.3.2.2 bouyer /* Nothing to do for other output types */
218 1.3.2.2 bouyer break;
219 1.3.2.2 bouyer }
220 1.3.2.2 bouyer }
221 1.3.2.2 bouyer
222 1.3.2.2 bouyer
223 1.3.2.2 bouyer /*******************************************************************************
224 1.3.2.2 bouyer *
225 1.3.2.2 bouyer * FUNCTION: CmFlushSourceCode
226 1.3.2.2 bouyer *
227 1.3.2.2 bouyer * PARAMETERS: None
228 1.3.2.2 bouyer *
229 1.3.2.2 bouyer * RETURN: None
230 1.3.2.2 bouyer *
231 1.3.2.2 bouyer * DESCRIPTION: Read in any remaining source code after the parse tree
232 1.3.2.2 bouyer * has been constructed.
233 1.3.2.2 bouyer *
234 1.3.2.2 bouyer ******************************************************************************/
235 1.3.2.2 bouyer
236 1.3.2.2 bouyer static void
237 1.3.2.2 bouyer CmFlushSourceCode (
238 1.3.2.2 bouyer void)
239 1.3.2.2 bouyer {
240 1.3.2.2 bouyer char Buffer;
241 1.3.2.2 bouyer
242 1.3.2.2 bouyer
243 1.3.2.2 bouyer while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR)
244 1.3.2.2 bouyer {
245 1.3.2.2 bouyer InsertLineBuffer ((int) Buffer);
246 1.3.2.2 bouyer }
247 1.3.2.2 bouyer
248 1.3.2.2 bouyer ResetCurrentLineBuffer ();
249 1.3.2.2 bouyer }
250 1.3.2.2 bouyer
251 1.3.2.2 bouyer
252 1.3.2.2 bouyer /*******************************************************************************
253 1.3.2.2 bouyer *
254 1.3.2.2 bouyer * FUNCTION: FlConsume*
255 1.3.2.2 bouyer *
256 1.3.2.2 bouyer * PARAMETERS: FileInfo - Points to an open input file
257 1.3.2.2 bouyer *
258 1.3.2.2 bouyer * RETURN: Number of lines consumed
259 1.3.2.2 bouyer *
260 1.3.2.2 bouyer * DESCRIPTION: Step over both types of comment during check for ascii chars
261 1.3.2.2 bouyer *
262 1.3.2.2 bouyer ******************************************************************************/
263 1.3.2.2 bouyer
264 1.3.2.2 bouyer static void
265 1.3.2.2 bouyer FlConsumeAnsiComment (
266 1.3.2.2 bouyer ASL_FILE_INFO *FileInfo,
267 1.3.2.2 bouyer ASL_FILE_STATUS *Status)
268 1.3.2.2 bouyer {
269 1.3.2.2 bouyer UINT8 Byte;
270 1.3.2.2 bouyer BOOLEAN ClosingComment = FALSE;
271 1.3.2.2 bouyer
272 1.3.2.2 bouyer
273 1.3.2.2 bouyer while (fread (&Byte, 1, 1, FileInfo->Handle))
274 1.3.2.2 bouyer {
275 1.3.2.2 bouyer /* Scan until comment close is found */
276 1.3.2.2 bouyer
277 1.3.2.2 bouyer if (ClosingComment)
278 1.3.2.2 bouyer {
279 1.3.2.2 bouyer if (Byte == '/')
280 1.3.2.2 bouyer {
281 1.3.2.2 bouyer return;
282 1.3.2.2 bouyer }
283 1.3.2.2 bouyer
284 1.3.2.2 bouyer if (Byte != '*')
285 1.3.2.2 bouyer {
286 1.3.2.2 bouyer /* Reset */
287 1.3.2.2 bouyer
288 1.3.2.2 bouyer ClosingComment = FALSE;
289 1.3.2.2 bouyer }
290 1.3.2.2 bouyer }
291 1.3.2.2 bouyer else if (Byte == '*')
292 1.3.2.2 bouyer {
293 1.3.2.2 bouyer ClosingComment = TRUE;
294 1.3.2.2 bouyer }
295 1.3.2.2 bouyer
296 1.3.2.2 bouyer /* Maintain line count */
297 1.3.2.2 bouyer
298 1.3.2.2 bouyer if (Byte == 0x0A)
299 1.3.2.2 bouyer {
300 1.3.2.2 bouyer Status->Line++;
301 1.3.2.2 bouyer }
302 1.3.2.2 bouyer
303 1.3.2.2 bouyer Status->Offset++;
304 1.3.2.2 bouyer }
305 1.3.2.2 bouyer }
306 1.3.2.2 bouyer
307 1.3.2.2 bouyer
308 1.3.2.2 bouyer static void
309 1.3.2.2 bouyer FlConsumeNewComment (
310 1.3.2.2 bouyer ASL_FILE_INFO *FileInfo,
311 1.3.2.2 bouyer ASL_FILE_STATUS *Status)
312 1.3.2.2 bouyer {
313 1.3.2.2 bouyer UINT8 Byte;
314 1.3.2.2 bouyer
315 1.3.2.2 bouyer
316 1.3.2.2 bouyer while (fread (&Byte, 1, 1, FileInfo->Handle))
317 1.3.2.2 bouyer {
318 1.3.2.2 bouyer Status->Offset++;
319 1.3.2.2 bouyer
320 1.3.2.2 bouyer /* Comment ends at newline */
321 1.3.2.2 bouyer
322 1.3.2.2 bouyer if (Byte == 0x0A)
323 1.3.2.2 bouyer {
324 1.3.2.2 bouyer Status->Line++;
325 1.3.2.2 bouyer return;
326 1.3.2.2 bouyer }
327 1.3.2.2 bouyer }
328 1.3.2.2 bouyer }
329 1.3.2.2 bouyer
330 1.3.2.2 bouyer
331 1.3.2.2 bouyer /*******************************************************************************
332 1.3.2.2 bouyer *
333 1.3.2.2 bouyer * FUNCTION: FlCheckForAscii
334 1.3.2.2 bouyer *
335 1.3.2.2 bouyer * PARAMETERS: FileInfo - Points to an open input file
336 1.3.2.2 bouyer *
337 1.3.2.2 bouyer * RETURN: Status
338 1.3.2.2 bouyer *
339 1.3.2.2 bouyer * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters
340 1.3.2.2 bouyer * within comments. Note: does not handle nested comments and does
341 1.3.2.2 bouyer * not handle comment delimiters within string literals. However,
342 1.3.2.2 bouyer * on the rare chance this happens and an invalid character is
343 1.3.2.2 bouyer * missed, the parser will catch the error by failing in some
344 1.3.2.2 bouyer * spectactular manner.
345 1.3.2.2 bouyer *
346 1.3.2.2 bouyer ******************************************************************************/
347 1.3.2.2 bouyer
348 1.3.2.2 bouyer ACPI_STATUS
349 1.3.2.2 bouyer FlCheckForAscii (
350 1.3.2.2 bouyer ASL_FILE_INFO *FileInfo)
351 1.3.2.2 bouyer {
352 1.3.2.2 bouyer UINT8 Byte;
353 1.3.2.2 bouyer ACPI_SIZE BadBytes = 0;
354 1.3.2.2 bouyer BOOLEAN OpeningComment = FALSE;
355 1.3.2.2 bouyer ASL_FILE_STATUS Status;
356 1.3.2.2 bouyer
357 1.3.2.2 bouyer
358 1.3.2.2 bouyer Status.Line = 1;
359 1.3.2.2 bouyer Status.Offset = 0;
360 1.3.2.2 bouyer
361 1.3.2.2 bouyer /* Read the entire file */
362 1.3.2.2 bouyer
363 1.3.2.2 bouyer while (fread (&Byte, 1, 1, FileInfo->Handle))
364 1.3.2.2 bouyer {
365 1.3.2.2 bouyer /* Ignore comment fields (allow non-ascii within) */
366 1.3.2.2 bouyer
367 1.3.2.2 bouyer if (OpeningComment)
368 1.3.2.2 bouyer {
369 1.3.2.2 bouyer /* Check for second comment open delimiter */
370 1.3.2.2 bouyer
371 1.3.2.2 bouyer if (Byte == '*')
372 1.3.2.2 bouyer {
373 1.3.2.2 bouyer FlConsumeAnsiComment (FileInfo, &Status);
374 1.3.2.2 bouyer }
375 1.3.2.2 bouyer
376 1.3.2.2 bouyer if (Byte == '/')
377 1.3.2.2 bouyer {
378 1.3.2.2 bouyer FlConsumeNewComment (FileInfo, &Status);
379 1.3.2.2 bouyer }
380 1.3.2.2 bouyer
381 1.3.2.2 bouyer /* Reset */
382 1.3.2.2 bouyer
383 1.3.2.2 bouyer OpeningComment = FALSE;
384 1.3.2.2 bouyer }
385 1.3.2.2 bouyer else if (Byte == '/')
386 1.3.2.2 bouyer {
387 1.3.2.2 bouyer OpeningComment = TRUE;
388 1.3.2.2 bouyer }
389 1.3.2.2 bouyer
390 1.3.2.2 bouyer /* Check for an ASCII character */
391 1.3.2.2 bouyer
392 1.3.2.2 bouyer if (!ACPI_IS_ASCII (Byte))
393 1.3.2.2 bouyer {
394 1.3.2.2 bouyer if (BadBytes < 10)
395 1.3.2.2 bouyer {
396 1.3.2.2 bouyer AcpiOsPrintf (
397 1.3.2.2 bouyer "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n",
398 1.3.2.2 bouyer Byte, Status.Line, Status.Offset);
399 1.3.2.2 bouyer }
400 1.3.2.2 bouyer
401 1.3.2.2 bouyer BadBytes++;
402 1.3.2.2 bouyer }
403 1.3.2.2 bouyer
404 1.3.2.2 bouyer /* Update line counter */
405 1.3.2.2 bouyer
406 1.3.2.2 bouyer else if (Byte == 0x0A)
407 1.3.2.2 bouyer {
408 1.3.2.2 bouyer Status.Line++;
409 1.3.2.2 bouyer }
410 1.3.2.2 bouyer
411 1.3.2.2 bouyer Status.Offset++;
412 1.3.2.2 bouyer }
413 1.3.2.2 bouyer
414 1.3.2.2 bouyer /* Seek back to the beginning of the source file */
415 1.3.2.2 bouyer
416 1.3.2.2 bouyer fseek (FileInfo->Handle, 0, SEEK_SET);
417 1.3.2.2 bouyer
418 1.3.2.2 bouyer /* Were there any non-ASCII characters in the file? */
419 1.3.2.2 bouyer
420 1.3.2.2 bouyer if (BadBytes)
421 1.3.2.2 bouyer {
422 1.3.2.2 bouyer AcpiOsPrintf (
423 1.3.2.2 bouyer "%u non-ASCII characters found in input source text, could be a binary file\n",
424 1.3.2.2 bouyer BadBytes);
425 1.3.2.2 bouyer AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename);
426 1.3.2.2 bouyer return (AE_BAD_CHARACTER);
427 1.3.2.2 bouyer }
428 1.3.2.2 bouyer
429 1.3.2.2 bouyer /* File is OK */
430 1.3.2.2 bouyer
431 1.3.2.2 bouyer return (AE_OK);
432 1.3.2.2 bouyer }
433 1.3.2.2 bouyer
434 1.3.2.2 bouyer
435 1.3.2.2 bouyer /*******************************************************************************
436 1.3.2.2 bouyer *
437 1.3.2.2 bouyer * FUNCTION: CmDoCompile
438 1.3.2.2 bouyer *
439 1.3.2.2 bouyer * PARAMETERS: None
440 1.3.2.2 bouyer *
441 1.3.2.2 bouyer * RETURN: Status (0 = OK)
442 1.3.2.2 bouyer *
443 1.3.2.2 bouyer * DESCRIPTION: This procedure performs the entire compile
444 1.3.2.2 bouyer *
445 1.3.2.2 bouyer ******************************************************************************/
446 1.3.2.2 bouyer
447 1.3.2.2 bouyer int
448 1.3.2.2 bouyer CmDoCompile (
449 1.3.2.2 bouyer void)
450 1.3.2.2 bouyer {
451 1.3.2.2 bouyer ACPI_STATUS Status;
452 1.3.2.2 bouyer UINT8 FullCompile;
453 1.3.2.2 bouyer UINT8 Event;
454 1.3.2.2 bouyer
455 1.3.2.2 bouyer
456 1.3.2.2 bouyer FullCompile = UtBeginEvent ("*** Total Compile time ***");
457 1.3.2.2 bouyer Event = UtBeginEvent ("Open input and output files");
458 1.3.2.2 bouyer UtEndEvent (Event);
459 1.3.2.2 bouyer
460 1.3.2.2 bouyer /* Build the parse tree */
461 1.3.2.2 bouyer
462 1.3.2.2 bouyer Event = UtBeginEvent ("Parse source code and build parse tree");
463 1.3.2.2 bouyer AslCompilerparse();
464 1.3.2.2 bouyer UtEndEvent (Event);
465 1.3.2.2 bouyer
466 1.3.2.2 bouyer /* Flush out any remaining source after parse tree is complete */
467 1.3.2.2 bouyer
468 1.3.2.2 bouyer Event = UtBeginEvent ("Flush source input");
469 1.3.2.2 bouyer CmFlushSourceCode ();
470 1.3.2.2 bouyer
471 1.3.2.2 bouyer /* Did the parse tree get successfully constructed? */
472 1.3.2.2 bouyer
473 1.3.2.2 bouyer if (!RootNode)
474 1.3.2.2 bouyer {
475 1.3.2.2 bouyer CmCleanupAndExit ();
476 1.3.2.2 bouyer return -1;
477 1.3.2.2 bouyer }
478 1.3.2.2 bouyer
479 1.3.2.2 bouyer /* Optional parse tree dump, compiler debug output only */
480 1.3.2.2 bouyer
481 1.3.2.2 bouyer LsDumpParseTree ();
482 1.3.2.2 bouyer
483 1.3.2.2 bouyer OpcGetIntegerWidth (RootNode);
484 1.3.2.2 bouyer UtEndEvent (Event);
485 1.3.2.2 bouyer
486 1.3.2.2 bouyer /* Pre-process parse tree for any operator transforms */
487 1.3.2.2 bouyer
488 1.3.2.2 bouyer Event = UtBeginEvent ("Parse tree transforms");
489 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
490 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
491 1.3.2.2 bouyer TrAmlTransformWalk, NULL, NULL);
492 1.3.2.2 bouyer UtEndEvent (Event);
493 1.3.2.2 bouyer
494 1.3.2.2 bouyer /* Generate AML opcodes corresponding to the parse tokens */
495 1.3.2.2 bouyer
496 1.3.2.2 bouyer Event = UtBeginEvent ("Generate AML opcodes");
497 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n");
498 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
499 1.3.2.2 bouyer OpcAmlOpcodeWalk, NULL);
500 1.3.2.2 bouyer UtEndEvent (Event);
501 1.3.2.2 bouyer
502 1.3.2.2 bouyer /*
503 1.3.2.2 bouyer * Now that the input is parsed, we can open the AML output file.
504 1.3.2.2 bouyer * Note: by default, the name of this file comes from the table descriptor
505 1.3.2.2 bouyer * within the input file.
506 1.3.2.2 bouyer */
507 1.3.2.2 bouyer Event = UtBeginEvent ("Open AML output file");
508 1.3.2.2 bouyer Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
509 1.3.2.2 bouyer if (ACPI_FAILURE (Status))
510 1.3.2.2 bouyer {
511 1.3.2.2 bouyer AePrintErrorLog (ASL_FILE_STDERR);
512 1.3.2.2 bouyer return -1;
513 1.3.2.2 bouyer }
514 1.3.2.2 bouyer UtEndEvent (Event);
515 1.3.2.2 bouyer
516 1.3.2.2 bouyer /* Interpret and generate all compile-time constants */
517 1.3.2.2 bouyer
518 1.3.2.2 bouyer Event = UtBeginEvent ("Constant folding via AML interpreter");
519 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT,
520 1.3.2.2 bouyer "\nInterpreting compile-time constant expressions\n\n");
521 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
522 1.3.2.2 bouyer OpcAmlConstantWalk, NULL, NULL);
523 1.3.2.2 bouyer UtEndEvent (Event);
524 1.3.2.2 bouyer
525 1.3.2.2 bouyer /* Update AML opcodes if necessary, after constant folding */
526 1.3.2.2 bouyer
527 1.3.2.2 bouyer Event = UtBeginEvent ("Updating AML opcodes after constant folding");
528 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT,
529 1.3.2.2 bouyer "\nUpdating AML opcodes after constant folding\n\n");
530 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
531 1.3.2.2 bouyer NULL, OpcAmlOpcodeUpdateWalk, NULL);
532 1.3.2.2 bouyer UtEndEvent (Event);
533 1.3.2.2 bouyer
534 1.3.2.2 bouyer /* Calculate all AML package lengths */
535 1.3.2.2 bouyer
536 1.3.2.2 bouyer Event = UtBeginEvent ("Generate AML package lengths");
537 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
538 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
539 1.3.2.2 bouyer LnPackageLengthWalk, NULL);
540 1.3.2.2 bouyer UtEndEvent (Event);
541 1.3.2.2 bouyer
542 1.3.2.2 bouyer if (Gbl_ParseOnlyFlag)
543 1.3.2.2 bouyer {
544 1.3.2.2 bouyer AePrintErrorLog (ASL_FILE_STDOUT);
545 1.3.2.2 bouyer UtDisplaySummary (ASL_FILE_STDOUT);
546 1.3.2.2 bouyer if (Gbl_DebugFlag)
547 1.3.2.2 bouyer {
548 1.3.2.2 bouyer /* Print error summary to the debug file */
549 1.3.2.2 bouyer
550 1.3.2.2 bouyer AePrintErrorLog (ASL_FILE_STDERR);
551 1.3.2.2 bouyer UtDisplaySummary (ASL_FILE_STDERR);
552 1.3.2.2 bouyer }
553 1.3.2.2 bouyer return 0;
554 1.3.2.2 bouyer }
555 1.3.2.2 bouyer
556 1.3.2.2 bouyer /*
557 1.3.2.2 bouyer * Create an internal namespace and use it as a symbol table
558 1.3.2.2 bouyer */
559 1.3.2.2 bouyer
560 1.3.2.2 bouyer /* Namespace loading */
561 1.3.2.2 bouyer
562 1.3.2.2 bouyer Event = UtBeginEvent ("Create ACPI Namespace");
563 1.3.2.2 bouyer Status = LdLoadNamespace (RootNode);
564 1.3.2.2 bouyer UtEndEvent (Event);
565 1.3.2.2 bouyer if (ACPI_FAILURE (Status))
566 1.3.2.2 bouyer {
567 1.3.2.2 bouyer return -1;
568 1.3.2.2 bouyer }
569 1.3.2.2 bouyer
570 1.3.2.2 bouyer /* Namespace cross-reference */
571 1.3.2.2 bouyer
572 1.3.2.2 bouyer AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace");
573 1.3.2.2 bouyer Status = LkCrossReferenceNamespace ();
574 1.3.2.2 bouyer if (ACPI_FAILURE (Status))
575 1.3.2.2 bouyer {
576 1.3.2.2 bouyer return -1;
577 1.3.2.2 bouyer }
578 1.3.2.2 bouyer
579 1.3.2.2 bouyer /* Namespace - Check for non-referenced objects */
580 1.3.2.2 bouyer
581 1.3.2.2 bouyer LkFindUnreferencedObjects ();
582 1.3.2.2 bouyer UtEndEvent (AslGbl_NamespaceEvent);
583 1.3.2.2 bouyer
584 1.3.2.2 bouyer /*
585 1.3.2.2 bouyer * Semantic analysis. This can happen only after the
586 1.3.2.2 bouyer * namespace has been loaded and cross-referenced.
587 1.3.2.2 bouyer *
588 1.3.2.2 bouyer * part one - check control methods
589 1.3.2.2 bouyer */
590 1.3.2.2 bouyer Event = UtBeginEvent ("Analyze control method return types");
591 1.3.2.2 bouyer AnalysisWalkInfo.MethodStack = NULL;
592 1.3.2.2 bouyer
593 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n");
594 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
595 1.3.2.2 bouyer AnMethodAnalysisWalkBegin,
596 1.3.2.2 bouyer AnMethodAnalysisWalkEnd, &AnalysisWalkInfo);
597 1.3.2.2 bouyer UtEndEvent (Event);
598 1.3.2.2 bouyer
599 1.3.2.2 bouyer /* Semantic error checking part two - typing of method returns */
600 1.3.2.2 bouyer
601 1.3.2.2 bouyer Event = UtBeginEvent ("Determine object types returned by methods");
602 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n");
603 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
604 1.3.2.2 bouyer NULL, AnMethodTypingWalkEnd, NULL);
605 1.3.2.2 bouyer UtEndEvent (Event);
606 1.3.2.2 bouyer
607 1.3.2.2 bouyer /* Semantic error checking part three - operand type checking */
608 1.3.2.2 bouyer
609 1.3.2.2 bouyer Event = UtBeginEvent ("Analyze AML operand types");
610 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n");
611 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
612 1.3.2.2 bouyer NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
613 1.3.2.2 bouyer UtEndEvent (Event);
614 1.3.2.2 bouyer
615 1.3.2.2 bouyer /* Semantic error checking part four - other miscellaneous checks */
616 1.3.2.2 bouyer
617 1.3.2.2 bouyer Event = UtBeginEvent ("Miscellaneous analysis");
618 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n");
619 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
620 1.3.2.2 bouyer AnOtherSemanticAnalysisWalkBegin,
621 1.3.2.2 bouyer NULL, &AnalysisWalkInfo);
622 1.3.2.2 bouyer UtEndEvent (Event);
623 1.3.2.2 bouyer
624 1.3.2.2 bouyer /* Calculate all AML package lengths */
625 1.3.2.2 bouyer
626 1.3.2.2 bouyer Event = UtBeginEvent ("Finish AML package length generation");
627 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
628 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
629 1.3.2.2 bouyer LnInitLengthsWalk, NULL);
630 1.3.2.2 bouyer TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
631 1.3.2.2 bouyer LnPackageLengthWalk, NULL);
632 1.3.2.2 bouyer UtEndEvent (Event);
633 1.3.2.2 bouyer
634 1.3.2.2 bouyer /* Code generation - emit the AML */
635 1.3.2.2 bouyer
636 1.3.2.2 bouyer Event = UtBeginEvent ("Generate AML code and write output files");
637 1.3.2.2 bouyer CgGenerateAmlOutput ();
638 1.3.2.2 bouyer UtEndEvent (Event);
639 1.3.2.2 bouyer
640 1.3.2.2 bouyer Event = UtBeginEvent ("Write optional output files");
641 1.3.2.2 bouyer CmDoOutputFiles ();
642 1.3.2.2 bouyer UtEndEvent (Event);
643 1.3.2.2 bouyer
644 1.3.2.2 bouyer UtEndEvent (FullCompile);
645 1.3.2.2 bouyer CmCleanupAndExit ();
646 1.3.2.2 bouyer return 0;
647 1.3.2.2 bouyer }
648 1.3.2.2 bouyer
649 1.3.2.2 bouyer
650 1.3.2.2 bouyer /*******************************************************************************
651 1.3.2.2 bouyer *
652 1.3.2.2 bouyer * FUNCTION: CmDoOutputFiles
653 1.3.2.2 bouyer *
654 1.3.2.2 bouyer * PARAMETERS: None
655 1.3.2.2 bouyer *
656 1.3.2.2 bouyer * RETURN: None.
657 1.3.2.2 bouyer *
658 1.3.2.2 bouyer * DESCRIPTION: Create all "listing" type files
659 1.3.2.2 bouyer *
660 1.3.2.2 bouyer ******************************************************************************/
661 1.3.2.2 bouyer
662 1.3.2.2 bouyer void
663 1.3.2.2 bouyer CmDoOutputFiles (
664 1.3.2.2 bouyer void)
665 1.3.2.2 bouyer {
666 1.3.2.2 bouyer
667 1.3.2.2 bouyer /* Create listings and hex files */
668 1.3.2.2 bouyer
669 1.3.2.2 bouyer LsDoListings ();
670 1.3.2.2 bouyer LsDoHexOutput ();
671 1.3.2.2 bouyer
672 1.3.2.2 bouyer /* Dump the namespace to the .nsp file if requested */
673 1.3.2.2 bouyer
674 1.3.2.2 bouyer (void) LsDisplayNamespace ();
675 1.3.2.2 bouyer }
676 1.3.2.2 bouyer
677 1.3.2.2 bouyer
678 1.3.2.2 bouyer /*******************************************************************************
679 1.3.2.2 bouyer *
680 1.3.2.2 bouyer * FUNCTION: CmDumpEvent
681 1.3.2.2 bouyer *
682 1.3.2.2 bouyer * PARAMETERS: Event - A compiler event struct
683 1.3.2.2 bouyer *
684 1.3.2.2 bouyer * RETURN: None.
685 1.3.2.2 bouyer *
686 1.3.2.2 bouyer * DESCRIPTION: Dump a compiler event struct
687 1.3.2.2 bouyer *
688 1.3.2.2 bouyer ******************************************************************************/
689 1.3.2.2 bouyer
690 1.3.2.2 bouyer static void
691 1.3.2.2 bouyer CmDumpEvent (
692 1.3.2.2 bouyer ASL_EVENT_INFO *Event)
693 1.3.2.2 bouyer {
694 1.3.2.2 bouyer UINT32 Delta;
695 1.3.2.2 bouyer UINT32 USec;
696 1.3.2.2 bouyer UINT32 MSec;
697 1.3.2.2 bouyer
698 1.3.2.2 bouyer if (!Event->Valid)
699 1.3.2.2 bouyer {
700 1.3.2.2 bouyer return;
701 1.3.2.2 bouyer }
702 1.3.2.2 bouyer
703 1.3.2.2 bouyer /* Delta will be in 100-nanosecond units */
704 1.3.2.2 bouyer
705 1.3.2.2 bouyer Delta = (UINT32) (Event->EndTime - Event->StartTime);
706 1.3.2.2 bouyer
707 1.3.2.2 bouyer USec = Delta / 10;
708 1.3.2.2 bouyer MSec = Delta / 10000;
709 1.3.2.2 bouyer
710 1.3.2.2 bouyer /* Round milliseconds up */
711 1.3.2.2 bouyer
712 1.3.2.2 bouyer if ((USec - (MSec * 1000)) >= 500)
713 1.3.2.2 bouyer {
714 1.3.2.2 bouyer MSec++;
715 1.3.2.2 bouyer }
716 1.3.2.2 bouyer
717 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n",
718 1.3.2.2 bouyer USec, MSec, Event->EventName);
719 1.3.2.2 bouyer }
720 1.3.2.2 bouyer
721 1.3.2.2 bouyer
722 1.3.2.2 bouyer /*******************************************************************************
723 1.3.2.2 bouyer *
724 1.3.2.2 bouyer * FUNCTION: CmCleanupAndExit
725 1.3.2.2 bouyer *
726 1.3.2.2 bouyer * PARAMETERS: None
727 1.3.2.2 bouyer *
728 1.3.2.2 bouyer * RETURN: None.
729 1.3.2.2 bouyer *
730 1.3.2.2 bouyer * DESCRIPTION: Close all open files and exit the compiler
731 1.3.2.2 bouyer *
732 1.3.2.2 bouyer ******************************************************************************/
733 1.3.2.2 bouyer
734 1.3.2.2 bouyer void
735 1.3.2.2 bouyer CmCleanupAndExit (
736 1.3.2.2 bouyer void)
737 1.3.2.2 bouyer {
738 1.3.2.2 bouyer UINT32 i;
739 1.3.2.2 bouyer
740 1.3.2.2 bouyer
741 1.3.2.2 bouyer AePrintErrorLog (ASL_FILE_STDOUT);
742 1.3.2.2 bouyer if (Gbl_DebugFlag)
743 1.3.2.2 bouyer {
744 1.3.2.2 bouyer /* Print error summary to the debug file */
745 1.3.2.2 bouyer
746 1.3.2.2 bouyer AePrintErrorLog (ASL_FILE_STDERR);
747 1.3.2.2 bouyer }
748 1.3.2.2 bouyer
749 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n");
750 1.3.2.2 bouyer for (i = 0; i < AslGbl_NextEvent; i++)
751 1.3.2.2 bouyer {
752 1.3.2.2 bouyer CmDumpEvent (&AslGbl_Events[i]);
753 1.3.2.2 bouyer }
754 1.3.2.2 bouyer
755 1.3.2.2 bouyer if (Gbl_CompileTimesFlag)
756 1.3.2.2 bouyer {
757 1.3.2.2 bouyer printf ("\nElapsed time for major events\n\n");
758 1.3.2.2 bouyer for (i = 0; i < AslGbl_NextEvent; i++)
759 1.3.2.2 bouyer {
760 1.3.2.2 bouyer CmDumpEvent (&AslGbl_Events[i]);
761 1.3.2.2 bouyer }
762 1.3.2.2 bouyer
763 1.3.2.2 bouyer printf ("\nMiscellaneous compile statistics\n\n");
764 1.3.2.2 bouyer printf ("%11u : %s\n", TotalParseNodes, "Parse nodes");
765 1.3.2.2 bouyer printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches");
766 1.3.2.2 bouyer printf ("%11u : %s\n", TotalNamedObjects, "Named objects");
767 1.3.2.2 bouyer printf ("%11u : %s\n", TotalMethods, "Control methods");
768 1.3.2.2 bouyer printf ("%11u : %s\n", TotalAllocations, "Memory Allocations");
769 1.3.2.2 bouyer printf ("%11u : %s\n", TotalAllocated, "Total allocated memory");
770 1.3.2.2 bouyer printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded");
771 1.3.2.2 bouyer printf ("\n");
772 1.3.2.2 bouyer }
773 1.3.2.2 bouyer
774 1.3.2.2 bouyer if (Gbl_NsLookupCount)
775 1.3.2.2 bouyer {
776 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT,
777 1.3.2.2 bouyer "\n\nMiscellaneous compile statistics\n\n");
778 1.3.2.2 bouyer
779 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT,
780 1.3.2.2 bouyer "%32s : %u\n", "Total Namespace searches",
781 1.3.2.2 bouyer Gbl_NsLookupCount);
782 1.3.2.2 bouyer
783 1.3.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT,
784 1.3.2.2 bouyer "%32s : %u usec\n", "Time per search", ((UINT32)
785 1.3.2.2 bouyer (AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
786 1.3.2.2 bouyer AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) /
787 1.3.2.2 bouyer Gbl_NsLookupCount);
788 1.3.2.2 bouyer }
789 1.3.2.2 bouyer
790 1.3.2.2 bouyer if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
791 1.3.2.2 bouyer {
792 1.3.2.2 bouyer printf ("\nMaximum error count (%u) exceeded\n",
793 1.3.2.2 bouyer ASL_MAX_ERROR_COUNT);
794 1.3.2.2 bouyer }
795 1.3.2.2 bouyer
796 1.3.2.2 bouyer UtDisplaySummary (ASL_FILE_STDOUT);
797 1.3.2.2 bouyer
798 1.3.2.2 bouyer /* Close all open files */
799 1.3.2.2 bouyer
800 1.3.2.2 bouyer for (i = 2; i < ASL_MAX_FILE_TYPE; i++)
801 1.3.2.2 bouyer {
802 1.3.2.2 bouyer FlCloseFile (i);
803 1.3.2.2 bouyer }
804 1.3.2.2 bouyer
805 1.3.2.2 bouyer /* Delete AML file if there are errors */
806 1.3.2.2 bouyer
807 1.3.2.2 bouyer if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) &&
808 1.3.2.2 bouyer Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
809 1.3.2.2 bouyer {
810 1.3.2.2 bouyer if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename))
811 1.3.2.2 bouyer {
812 1.3.2.2 bouyer printf ("%s: ",
813 1.3.2.2 bouyer Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
814 1.3.2.2 bouyer perror ("Could not delete AML file");
815 1.3.2.2 bouyer }
816 1.3.2.2 bouyer }
817 1.3.2.2 bouyer
818 1.3.2.2 bouyer /*
819 1.3.2.2 bouyer * Delete intermediate ("combined") source file (if -ls flag not set)
820 1.3.2.2 bouyer * This file is created during normal ASL/AML compiles. It is not
821 1.3.2.2 bouyer * created by the data table compiler.
822 1.3.2.2 bouyer *
823 1.3.2.2 bouyer * If the -ls flag is set, then the .SRC file should not be deleted.
824 1.3.2.2 bouyer * In this case, Gbl_SourceOutputFlag is set to TRUE.
825 1.3.2.2 bouyer *
826 1.3.2.2 bouyer * Note: Handles are cleared by FlCloseFile above, so we look at the
827 1.3.2.2 bouyer * filename instead, to determine if the .SRC file was actually
828 1.3.2.2 bouyer * created.
829 1.3.2.2 bouyer *
830 1.3.2.2 bouyer * TBD: SourceOutput should be .TMP, then rename if we want to keep it?
831 1.3.2.2 bouyer */
832 1.3.2.2 bouyer if (!Gbl_SourceOutputFlag && Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)
833 1.3.2.2 bouyer {
834 1.3.2.2 bouyer if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename))
835 1.3.2.2 bouyer {
836 1.3.2.2 bouyer printf ("%s: ",
837 1.3.2.2 bouyer Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
838 1.3.2.2 bouyer perror ("Could not delete SRC file");
839 1.3.2.2 bouyer }
840 1.3.2.2 bouyer }
841 1.3.2.2 bouyer }
842 1.3.2.2 bouyer
843 1.3.2.2 bouyer
844