prutils.c revision 1.3.4.2 1 1.3.4.2 rmind /******************************************************************************
2 1.3.4.2 rmind *
3 1.3.4.2 rmind * Module Name: prutils - Preprocessor utilities
4 1.3.4.2 rmind *
5 1.3.4.2 rmind *****************************************************************************/
6 1.3.4.2 rmind
7 1.3.4.2 rmind /*
8 1.3.4.2 rmind * Copyright (C) 2000 - 2013, Intel Corp.
9 1.3.4.2 rmind * All rights reserved.
10 1.3.4.2 rmind *
11 1.3.4.2 rmind * Redistribution and use in source and binary forms, with or without
12 1.3.4.2 rmind * modification, are permitted provided that the following conditions
13 1.3.4.2 rmind * are met:
14 1.3.4.2 rmind * 1. Redistributions of source code must retain the above copyright
15 1.3.4.2 rmind * notice, this list of conditions, and the following disclaimer,
16 1.3.4.2 rmind * without modification.
17 1.3.4.2 rmind * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.3.4.2 rmind * substantially similar to the "NO WARRANTY" disclaimer below
19 1.3.4.2 rmind * ("Disclaimer") and any redistribution must be conditioned upon
20 1.3.4.2 rmind * including a substantially similar Disclaimer requirement for further
21 1.3.4.2 rmind * binary redistribution.
22 1.3.4.2 rmind * 3. Neither the names of the above-listed copyright holders nor the names
23 1.3.4.2 rmind * of any contributors may be used to endorse or promote products derived
24 1.3.4.2 rmind * from this software without specific prior written permission.
25 1.3.4.2 rmind *
26 1.3.4.2 rmind * Alternatively, this software may be distributed under the terms of the
27 1.3.4.2 rmind * GNU General Public License ("GPL") version 2 as published by the Free
28 1.3.4.2 rmind * Software Foundation.
29 1.3.4.2 rmind *
30 1.3.4.2 rmind * NO WARRANTY
31 1.3.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.3.4.2 rmind * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.3.4.2 rmind * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.3.4.2 rmind * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.3.4.2 rmind * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.3.4.2 rmind * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.3.4.2 rmind * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.3.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.3.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.3.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.3.4.2 rmind * POSSIBILITY OF SUCH DAMAGES.
42 1.3.4.2 rmind */
43 1.3.4.2 rmind
44 1.3.4.2 rmind #include "aslcompiler.h"
45 1.3.4.2 rmind #include "dtcompiler.h"
46 1.3.4.2 rmind
47 1.3.4.2 rmind
48 1.3.4.2 rmind #define _COMPONENT ASL_PREPROCESSOR
49 1.3.4.2 rmind ACPI_MODULE_NAME ("prutils")
50 1.3.4.2 rmind
51 1.3.4.2 rmind
52 1.3.4.2 rmind /******************************************************************************
53 1.3.4.2 rmind *
54 1.3.4.2 rmind * FUNCTION: PrGetNextToken
55 1.3.4.2 rmind *
56 1.3.4.2 rmind * PARAMETERS: Buffer - Current line buffer
57 1.3.4.2 rmind * MatchString - String with valid token delimiters
58 1.3.4.2 rmind * Next - Set to next possible token in buffer
59 1.3.4.2 rmind *
60 1.3.4.2 rmind * RETURN: Next token (null-terminated). Modifies the input line.
61 1.3.4.2 rmind * Remainder of line is stored in *Next.
62 1.3.4.2 rmind *
63 1.3.4.2 rmind * DESCRIPTION: Local implementation of strtok() with local storage for the
64 1.3.4.2 rmind * next pointer. Not only thread-safe, but allows multiple
65 1.3.4.2 rmind * parsing of substrings such as expressions.
66 1.3.4.2 rmind *
67 1.3.4.2 rmind *****************************************************************************/
68 1.3.4.2 rmind
69 1.3.4.2 rmind char *
70 1.3.4.2 rmind PrGetNextToken (
71 1.3.4.2 rmind char *Buffer,
72 1.3.4.2 rmind char *MatchString,
73 1.3.4.2 rmind char **Next)
74 1.3.4.2 rmind {
75 1.3.4.2 rmind char *TokenStart;
76 1.3.4.2 rmind
77 1.3.4.2 rmind
78 1.3.4.2 rmind if (!Buffer)
79 1.3.4.2 rmind {
80 1.3.4.2 rmind /* Use Next if it is valid */
81 1.3.4.2 rmind
82 1.3.4.2 rmind Buffer = *Next;
83 1.3.4.2 rmind if (!(*Next))
84 1.3.4.2 rmind {
85 1.3.4.2 rmind return (NULL);
86 1.3.4.2 rmind }
87 1.3.4.2 rmind }
88 1.3.4.2 rmind
89 1.3.4.2 rmind /* Skip any leading delimiters */
90 1.3.4.2 rmind
91 1.3.4.2 rmind while (*Buffer)
92 1.3.4.2 rmind {
93 1.3.4.2 rmind if (strchr (MatchString, *Buffer))
94 1.3.4.2 rmind {
95 1.3.4.2 rmind Buffer++;
96 1.3.4.2 rmind }
97 1.3.4.2 rmind else
98 1.3.4.2 rmind {
99 1.3.4.2 rmind break;
100 1.3.4.2 rmind }
101 1.3.4.2 rmind }
102 1.3.4.2 rmind
103 1.3.4.2 rmind /* Anything left on the line? */
104 1.3.4.2 rmind
105 1.3.4.2 rmind if (!(*Buffer))
106 1.3.4.2 rmind {
107 1.3.4.2 rmind *Next = NULL;
108 1.3.4.2 rmind return (NULL);
109 1.3.4.2 rmind }
110 1.3.4.2 rmind
111 1.3.4.2 rmind TokenStart = Buffer;
112 1.3.4.2 rmind
113 1.3.4.2 rmind /* Find the end of this token */
114 1.3.4.2 rmind
115 1.3.4.2 rmind while (*Buffer)
116 1.3.4.2 rmind {
117 1.3.4.2 rmind if (strchr (MatchString, *Buffer))
118 1.3.4.2 rmind {
119 1.3.4.2 rmind *Buffer = 0;
120 1.3.4.2 rmind *Next = Buffer+1;
121 1.3.4.2 rmind if (!**Next)
122 1.3.4.2 rmind {
123 1.3.4.2 rmind *Next = NULL;
124 1.3.4.2 rmind }
125 1.3.4.2 rmind return (TokenStart);
126 1.3.4.2 rmind }
127 1.3.4.2 rmind Buffer++;
128 1.3.4.2 rmind }
129 1.3.4.2 rmind
130 1.3.4.2 rmind *Next = NULL;
131 1.3.4.2 rmind return (TokenStart);
132 1.3.4.2 rmind }
133 1.3.4.2 rmind
134 1.3.4.2 rmind
135 1.3.4.2 rmind /*******************************************************************************
136 1.3.4.2 rmind *
137 1.3.4.2 rmind * FUNCTION: PrError
138 1.3.4.2 rmind *
139 1.3.4.2 rmind * PARAMETERS: Level - Seriousness (Warning/error, etc.)
140 1.3.4.2 rmind * MessageId - Index into global message buffer
141 1.3.4.2 rmind * Column - Column in current line
142 1.3.4.2 rmind *
143 1.3.4.2 rmind * RETURN: None
144 1.3.4.2 rmind *
145 1.3.4.2 rmind * DESCRIPTION: Preprocessor error reporting. Front end to AslCommonError2
146 1.3.4.2 rmind *
147 1.3.4.2 rmind ******************************************************************************/
148 1.3.4.2 rmind
149 1.3.4.2 rmind void
150 1.3.4.2 rmind PrError (
151 1.3.4.2 rmind UINT8 Level,
152 1.3.4.2 rmind UINT8 MessageId,
153 1.3.4.2 rmind UINT32 Column)
154 1.3.4.2 rmind {
155 1.3.4.2 rmind #if 0
156 1.3.4.2 rmind AcpiOsPrintf ("%s (%u) : %s", Gbl_Files[ASL_FILE_INPUT].Filename,
157 1.3.4.2 rmind Gbl_CurrentLineNumber, Gbl_CurrentLineBuffer);
158 1.3.4.2 rmind #endif
159 1.3.4.2 rmind
160 1.3.4.2 rmind
161 1.3.4.2 rmind if (Column > 120)
162 1.3.4.2 rmind {
163 1.3.4.2 rmind Column = 0;
164 1.3.4.2 rmind }
165 1.3.4.2 rmind
166 1.3.4.2 rmind /* TBD: Need Logical line number? */
167 1.3.4.2 rmind
168 1.3.4.2 rmind AslCommonError2 (Level, MessageId,
169 1.3.4.2 rmind Gbl_CurrentLineNumber, Column,
170 1.3.4.2 rmind Gbl_CurrentLineBuffer,
171 1.3.4.2 rmind Gbl_Files[ASL_FILE_INPUT].Filename, "Preprocessor");
172 1.3.4.2 rmind
173 1.3.4.2 rmind Gbl_PreprocessorError = TRUE;
174 1.3.4.2 rmind }
175 1.3.4.2 rmind
176 1.3.4.2 rmind
177 1.3.4.2 rmind /*******************************************************************************
178 1.3.4.2 rmind *
179 1.3.4.2 rmind * FUNCTION: PrReplaceData
180 1.3.4.2 rmind *
181 1.3.4.2 rmind * PARAMETERS: Buffer - Original(target) buffer pointer
182 1.3.4.2 rmind * LengthToRemove - Length to be removed from target buffer
183 1.3.4.2 rmind * BufferToAdd - Data to be inserted into target buffer
184 1.3.4.2 rmind * LengthToAdd - Length of BufferToAdd
185 1.3.4.2 rmind *
186 1.3.4.2 rmind * RETURN: None
187 1.3.4.2 rmind *
188 1.3.4.2 rmind * DESCRIPTION: Generic buffer data replacement.
189 1.3.4.2 rmind *
190 1.3.4.2 rmind ******************************************************************************/
191 1.3.4.2 rmind
192 1.3.4.2 rmind void
193 1.3.4.2 rmind PrReplaceData (
194 1.3.4.2 rmind char *Buffer,
195 1.3.4.2 rmind UINT32 LengthToRemove,
196 1.3.4.2 rmind char *BufferToAdd,
197 1.3.4.2 rmind UINT32 LengthToAdd)
198 1.3.4.2 rmind {
199 1.3.4.2 rmind UINT32 BufferLength;
200 1.3.4.2 rmind
201 1.3.4.2 rmind
202 1.3.4.2 rmind /* Buffer is a string, so the length must include the terminating zero */
203 1.3.4.2 rmind
204 1.3.4.2 rmind BufferLength = strlen (Buffer) + 1;
205 1.3.4.2 rmind
206 1.3.4.2 rmind if (LengthToRemove != LengthToAdd)
207 1.3.4.2 rmind {
208 1.3.4.2 rmind /*
209 1.3.4.2 rmind * Move some of the existing data
210 1.3.4.2 rmind * 1) If adding more bytes than removing, make room for the new data
211 1.3.4.2 rmind * 2) if removing more bytes than adding, delete the extra space
212 1.3.4.2 rmind */
213 1.3.4.2 rmind if (LengthToRemove > 0)
214 1.3.4.2 rmind {
215 1.3.4.2 rmind memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove),
216 1.3.4.2 rmind (BufferLength - LengthToRemove));
217 1.3.4.2 rmind }
218 1.3.4.2 rmind }
219 1.3.4.2 rmind
220 1.3.4.2 rmind /* Now we can move in the new data */
221 1.3.4.2 rmind
222 1.3.4.2 rmind if (LengthToAdd > 0)
223 1.3.4.2 rmind {
224 1.3.4.2 rmind memmove (Buffer, BufferToAdd, LengthToAdd);
225 1.3.4.2 rmind }
226 1.3.4.2 rmind }
227 1.3.4.2 rmind
228 1.3.4.2 rmind
229 1.3.4.2 rmind /*******************************************************************************
230 1.3.4.2 rmind *
231 1.3.4.2 rmind * FUNCTION: PrOpenIncludeFile
232 1.3.4.2 rmind *
233 1.3.4.2 rmind * PARAMETERS: Filename - Filename or pathname for include file
234 1.3.4.2 rmind *
235 1.3.4.2 rmind * RETURN: None.
236 1.3.4.2 rmind *
237 1.3.4.2 rmind * DESCRIPTION: Open an include file and push it on the input file stack.
238 1.3.4.2 rmind *
239 1.3.4.2 rmind ******************************************************************************/
240 1.3.4.2 rmind
241 1.3.4.2 rmind void
242 1.3.4.2 rmind PrOpenIncludeFile (
243 1.3.4.2 rmind char *Filename)
244 1.3.4.2 rmind {
245 1.3.4.2 rmind FILE *IncludeFile;
246 1.3.4.2 rmind ASL_INCLUDE_DIR *NextDir;
247 1.3.4.2 rmind
248 1.3.4.2 rmind
249 1.3.4.2 rmind /* Start the actual include file on the next line */
250 1.3.4.2 rmind
251 1.3.4.2 rmind Gbl_CurrentLineOffset++;
252 1.3.4.2 rmind
253 1.3.4.2 rmind /* Attempt to open the include file */
254 1.3.4.2 rmind /* If the file specifies an absolute path, just open it */
255 1.3.4.2 rmind
256 1.3.4.2 rmind if ((Filename[0] == '/') ||
257 1.3.4.2 rmind (Filename[0] == '\\') ||
258 1.3.4.2 rmind (Filename[1] == ':'))
259 1.3.4.2 rmind {
260 1.3.4.2 rmind IncludeFile = PrOpenIncludeWithPrefix ("", Filename);
261 1.3.4.2 rmind if (!IncludeFile)
262 1.3.4.2 rmind {
263 1.3.4.2 rmind goto ErrorExit;
264 1.3.4.2 rmind }
265 1.3.4.2 rmind return;
266 1.3.4.2 rmind }
267 1.3.4.2 rmind
268 1.3.4.2 rmind /*
269 1.3.4.2 rmind * The include filename is not an absolute path.
270 1.3.4.2 rmind *
271 1.3.4.2 rmind * First, search for the file within the "local" directory -- meaning
272 1.3.4.2 rmind * the same directory that contains the source file.
273 1.3.4.2 rmind *
274 1.3.4.2 rmind * Construct the file pathname from the global directory name.
275 1.3.4.2 rmind */
276 1.3.4.2 rmind IncludeFile = PrOpenIncludeWithPrefix (Gbl_DirectoryPath, Filename);
277 1.3.4.2 rmind if (IncludeFile)
278 1.3.4.2 rmind {
279 1.3.4.2 rmind return;
280 1.3.4.2 rmind }
281 1.3.4.2 rmind
282 1.3.4.2 rmind /*
283 1.3.4.2 rmind * Second, search for the file within the (possibly multiple)
284 1.3.4.2 rmind * directories specified by the -I option on the command line.
285 1.3.4.2 rmind */
286 1.3.4.2 rmind NextDir = Gbl_IncludeDirList;
287 1.3.4.2 rmind while (NextDir)
288 1.3.4.2 rmind {
289 1.3.4.2 rmind IncludeFile = PrOpenIncludeWithPrefix (NextDir->Dir, Filename);
290 1.3.4.2 rmind if (IncludeFile)
291 1.3.4.2 rmind {
292 1.3.4.2 rmind return;
293 1.3.4.2 rmind }
294 1.3.4.2 rmind
295 1.3.4.2 rmind NextDir = NextDir->Next;
296 1.3.4.2 rmind }
297 1.3.4.2 rmind
298 1.3.4.2 rmind /* We could not open the include file after trying very hard */
299 1.3.4.2 rmind
300 1.3.4.2 rmind ErrorExit:
301 1.3.4.2 rmind snprintf (Gbl_MainTokenBuffer, ASL_DEFAULT_LINE_BUFFER_SIZE, "%s, %s",
302 1.3.4.2 rmind Filename, strerror (errno));
303 1.3.4.2 rmind PrError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 0);
304 1.3.4.2 rmind }
305 1.3.4.2 rmind
306 1.3.4.2 rmind
307 1.3.4.2 rmind /*******************************************************************************
308 1.3.4.2 rmind *
309 1.3.4.2 rmind * FUNCTION: FlOpenIncludeWithPrefix
310 1.3.4.2 rmind *
311 1.3.4.2 rmind * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero
312 1.3.4.2 rmind * length string.
313 1.3.4.2 rmind * Filename - The include filename from the source ASL.
314 1.3.4.2 rmind *
315 1.3.4.2 rmind * RETURN: Valid file descriptor if successful. Null otherwise.
316 1.3.4.2 rmind *
317 1.3.4.2 rmind * DESCRIPTION: Open an include file and push it on the input file stack.
318 1.3.4.2 rmind *
319 1.3.4.2 rmind ******************************************************************************/
320 1.3.4.2 rmind
321 1.3.4.2 rmind FILE *
322 1.3.4.2 rmind PrOpenIncludeWithPrefix (
323 1.3.4.2 rmind char *PrefixDir,
324 1.3.4.2 rmind char *Filename)
325 1.3.4.2 rmind {
326 1.3.4.2 rmind FILE *IncludeFile;
327 1.3.4.2 rmind char *Pathname;
328 1.3.4.2 rmind
329 1.3.4.2 rmind
330 1.3.4.2 rmind /* Build the full pathname to the file */
331 1.3.4.2 rmind
332 1.3.4.2 rmind Pathname = FlMergePathnames (PrefixDir, Filename);
333 1.3.4.2 rmind
334 1.3.4.2 rmind DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
335 1.3.4.2 rmind "Include: Opening file - \"%s\"\n",
336 1.3.4.2 rmind Gbl_CurrentLineNumber, Pathname);
337 1.3.4.2 rmind
338 1.3.4.2 rmind /* Attempt to open the file, push if successful */
339 1.3.4.2 rmind
340 1.3.4.2 rmind IncludeFile = fopen (Pathname, "r");
341 1.3.4.2 rmind if (!IncludeFile)
342 1.3.4.2 rmind {
343 1.3.4.2 rmind fprintf (stderr, "Could not open include file %s\n", Pathname);
344 1.3.4.2 rmind ACPI_FREE (Pathname);
345 1.3.4.2 rmind return (NULL);
346 1.3.4.2 rmind }
347 1.3.4.2 rmind
348 1.3.4.2 rmind /* Push the include file on the open input file stack */
349 1.3.4.2 rmind
350 1.3.4.2 rmind PrPushInputFileStack (IncludeFile, Pathname);
351 1.3.4.2 rmind return (IncludeFile);
352 1.3.4.2 rmind }
353 1.3.4.2 rmind
354 1.3.4.2 rmind
355 1.3.4.2 rmind /*******************************************************************************
356 1.3.4.2 rmind *
357 1.3.4.2 rmind * FUNCTION: AslPushInputFileStack
358 1.3.4.2 rmind *
359 1.3.4.2 rmind * PARAMETERS: InputFile - Open file pointer
360 1.3.4.2 rmind * Filename - Name of the file
361 1.3.4.2 rmind *
362 1.3.4.2 rmind * RETURN: None
363 1.3.4.2 rmind *
364 1.3.4.2 rmind * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
365 1.3.4.2 rmind * to this file. Called when an include file is successfully
366 1.3.4.2 rmind * opened.
367 1.3.4.2 rmind *
368 1.3.4.2 rmind ******************************************************************************/
369 1.3.4.2 rmind
370 1.3.4.2 rmind void
371 1.3.4.2 rmind PrPushInputFileStack (
372 1.3.4.2 rmind FILE *InputFile,
373 1.3.4.2 rmind char *Filename)
374 1.3.4.2 rmind {
375 1.3.4.2 rmind PR_FILE_NODE *Fnode;
376 1.3.4.2 rmind
377 1.3.4.2 rmind
378 1.3.4.2 rmind /* Save the current state in an Fnode */
379 1.3.4.2 rmind
380 1.3.4.2 rmind Fnode = UtLocalCalloc (sizeof (PR_FILE_NODE));
381 1.3.4.2 rmind
382 1.3.4.2 rmind Fnode->File = Gbl_Files[ASL_FILE_INPUT].Handle;
383 1.3.4.2 rmind Fnode->Next = Gbl_InputFileList;
384 1.3.4.2 rmind Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
385 1.3.4.2 rmind Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
386 1.3.4.2 rmind
387 1.3.4.2 rmind /* Push it on the stack */
388 1.3.4.2 rmind
389 1.3.4.2 rmind Gbl_InputFileList = Fnode;
390 1.3.4.2 rmind
391 1.3.4.2 rmind DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
392 1.3.4.2 rmind "Push InputFile Stack: handle %p\n\n",
393 1.3.4.2 rmind Gbl_CurrentLineNumber, InputFile);
394 1.3.4.2 rmind
395 1.3.4.2 rmind /* Reset the global line count and filename */
396 1.3.4.2 rmind
397 1.3.4.2 rmind Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
398 1.3.4.2 rmind Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
399 1.3.4.2 rmind Gbl_PreviousLineNumber = 0;
400 1.3.4.2 rmind Gbl_CurrentLineNumber = 0;
401 1.3.4.2 rmind
402 1.3.4.2 rmind /* Emit a new #line directive for the include file */
403 1.3.4.2 rmind
404 1.3.4.2 rmind FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
405 1.3.4.2 rmind 1, Filename);
406 1.3.4.2 rmind }
407 1.3.4.2 rmind
408 1.3.4.2 rmind
409 1.3.4.2 rmind /*******************************************************************************
410 1.3.4.2 rmind *
411 1.3.4.2 rmind * FUNCTION: AslPopInputFileStack
412 1.3.4.2 rmind *
413 1.3.4.2 rmind * PARAMETERS: None
414 1.3.4.2 rmind *
415 1.3.4.2 rmind * RETURN: 0 if a node was popped, -1 otherwise
416 1.3.4.2 rmind *
417 1.3.4.2 rmind * DESCRIPTION: Pop the top of the input file stack and point the parser to
418 1.3.4.2 rmind * the saved parse buffer contained in the fnode. Also, set the
419 1.3.4.2 rmind * global line counters to the saved values. This function is
420 1.3.4.2 rmind * called when an include file reaches EOF.
421 1.3.4.2 rmind *
422 1.3.4.2 rmind ******************************************************************************/
423 1.3.4.2 rmind
424 1.3.4.2 rmind BOOLEAN
425 1.3.4.2 rmind PrPopInputFileStack (
426 1.3.4.2 rmind void)
427 1.3.4.2 rmind {
428 1.3.4.2 rmind PR_FILE_NODE *Fnode;
429 1.3.4.2 rmind
430 1.3.4.2 rmind
431 1.3.4.2 rmind Fnode = Gbl_InputFileList;
432 1.3.4.2 rmind DbgPrint (ASL_PARSE_OUTPUT, "\n" PR_PREFIX_ID
433 1.3.4.2 rmind "Pop InputFile Stack, Fnode %p\n\n",
434 1.3.4.2 rmind Gbl_CurrentLineNumber, Fnode);
435 1.3.4.2 rmind
436 1.3.4.2 rmind if (!Fnode)
437 1.3.4.2 rmind {
438 1.3.4.2 rmind return (FALSE);
439 1.3.4.2 rmind }
440 1.3.4.2 rmind
441 1.3.4.2 rmind /* Close the current include file */
442 1.3.4.2 rmind
443 1.3.4.2 rmind fclose (Gbl_Files[ASL_FILE_INPUT].Handle);
444 1.3.4.2 rmind
445 1.3.4.2 rmind /* Update the top-of-stack */
446 1.3.4.2 rmind
447 1.3.4.2 rmind Gbl_InputFileList = Fnode->Next;
448 1.3.4.2 rmind
449 1.3.4.2 rmind /* Reset global line counter and filename */
450 1.3.4.2 rmind
451 1.3.4.2 rmind Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
452 1.3.4.2 rmind Gbl_Files[ASL_FILE_INPUT].Handle = Fnode->File;
453 1.3.4.2 rmind Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
454 1.3.4.2 rmind Gbl_PreviousLineNumber = 0;
455 1.3.4.2 rmind
456 1.3.4.2 rmind /* Emit a new #line directive after the include file */
457 1.3.4.2 rmind
458 1.3.4.2 rmind FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
459 1.3.4.2 rmind Gbl_CurrentLineNumber + 1, Fnode->Filename);
460 1.3.4.2 rmind
461 1.3.4.2 rmind /* All done with this node */
462 1.3.4.2 rmind
463 1.3.4.2 rmind ACPI_FREE (Fnode);
464 1.3.4.2 rmind return (TRUE);
465 1.3.4.2 rmind }
466