19c7c683cSJung-uk Kim /****************************************************************************** 29c7c683cSJung-uk Kim * 39c7c683cSJung-uk Kim * Module Name: asllistsup - Listing file support utilities 49c7c683cSJung-uk Kim * 59c7c683cSJung-uk Kim *****************************************************************************/ 69c7c683cSJung-uk Kim 70d84335fSJung-uk Kim /****************************************************************************** 80d84335fSJung-uk Kim * 90d84335fSJung-uk Kim * 1. Copyright Notice 100d84335fSJung-uk Kim * 11*804fe266SJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp. 129c7c683cSJung-uk Kim * All rights reserved. 139c7c683cSJung-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 * 1199c7c683cSJung-uk Kim * Redistribution and use in source and binary forms, with or without 1209c7c683cSJung-uk Kim * modification, are permitted provided that the following conditions 1219c7c683cSJung-uk Kim * are met: 1229c7c683cSJung-uk Kim * 1. Redistributions of source code must retain the above copyright 1239c7c683cSJung-uk Kim * notice, this list of conditions, and the following disclaimer, 1249c7c683cSJung-uk Kim * without modification. 1259c7c683cSJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1269c7c683cSJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below 1279c7c683cSJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon 1289c7c683cSJung-uk Kim * including a substantially similar Disclaimer requirement for further 1299c7c683cSJung-uk Kim * binary redistribution. 1309c7c683cSJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names 1319c7c683cSJung-uk Kim * of any contributors may be used to endorse or promote products derived 1329c7c683cSJung-uk Kim * from this software without specific prior written permission. 1339c7c683cSJung-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 1479c7c683cSJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free 1489c7c683cSJung-uk Kim * Software Foundation. 1499c7c683cSJung-uk Kim * 1500d84335fSJung-uk Kim *****************************************************************************/ 1519c7c683cSJung-uk Kim 1529c7c683cSJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h> 1539c7c683cSJung-uk Kim #include "aslcompiler.y.h" 1549c7c683cSJung-uk Kim 1559c7c683cSJung-uk Kim 1569c7c683cSJung-uk Kim #define _COMPONENT ACPI_COMPILER 1579c7c683cSJung-uk Kim ACPI_MODULE_NAME ("aslistsup") 1589c7c683cSJung-uk Kim 1599c7c683cSJung-uk Kim 1609c7c683cSJung-uk Kim /******************************************************************************* 1619c7c683cSJung-uk Kim * 1629c7c683cSJung-uk Kim * FUNCTION: LsDumpAscii 1639c7c683cSJung-uk Kim * 1649c7c683cSJung-uk Kim * PARAMETERS: FileId - ID of current listing file 1659c7c683cSJung-uk Kim * Count - Number of bytes to convert 1669c7c683cSJung-uk Kim * Buffer - Buffer of bytes to convert 1679c7c683cSJung-uk Kim * 1689c7c683cSJung-uk Kim * RETURN: None 1699c7c683cSJung-uk Kim * 1709c7c683cSJung-uk Kim * DESCRIPTION: Convert hex bytes to ascii 1719c7c683cSJung-uk Kim * 1729c7c683cSJung-uk Kim ******************************************************************************/ 1739c7c683cSJung-uk Kim 1749c7c683cSJung-uk Kim void 1759c7c683cSJung-uk Kim LsDumpAscii ( 1769c7c683cSJung-uk Kim UINT32 FileId, 1779c7c683cSJung-uk Kim UINT32 Count, 1789c7c683cSJung-uk Kim UINT8 *Buffer) 1799c7c683cSJung-uk Kim { 1809c7c683cSJung-uk Kim UINT8 BufChar; 1819c7c683cSJung-uk Kim UINT32 i; 1829c7c683cSJung-uk Kim 1839c7c683cSJung-uk Kim 1849c7c683cSJung-uk Kim FlPrintFile (FileId, " \""); 1859c7c683cSJung-uk Kim for (i = 0; i < Count; i++) 1869c7c683cSJung-uk Kim { 1879c7c683cSJung-uk Kim BufChar = Buffer[i]; 1889c7c683cSJung-uk Kim if (isprint (BufChar)) 1899c7c683cSJung-uk Kim { 1909c7c683cSJung-uk Kim FlPrintFile (FileId, "%c", BufChar); 1919c7c683cSJung-uk Kim } 1929c7c683cSJung-uk Kim else 1939c7c683cSJung-uk Kim { 1949c7c683cSJung-uk Kim /* Not a printable character, just put out a dot */ 1959c7c683cSJung-uk Kim 1969c7c683cSJung-uk Kim FlPrintFile (FileId, "."); 1979c7c683cSJung-uk Kim } 1989c7c683cSJung-uk Kim } 199f8146b88SJung-uk Kim 2009c7c683cSJung-uk Kim FlPrintFile (FileId, "\""); 2019c7c683cSJung-uk Kim } 2029c7c683cSJung-uk Kim 2039c7c683cSJung-uk Kim 2049c7c683cSJung-uk Kim /******************************************************************************* 2059c7c683cSJung-uk Kim * 2069c7c683cSJung-uk Kim * FUNCTION: LsDumpAsciiInComment 2079c7c683cSJung-uk Kim * 2089c7c683cSJung-uk Kim * PARAMETERS: FileId - ID of current listing file 2099c7c683cSJung-uk Kim * Count - Number of bytes to convert 2109c7c683cSJung-uk Kim * Buffer - Buffer of bytes to convert 2119c7c683cSJung-uk Kim * 2129c7c683cSJung-uk Kim * RETURN: None 2139c7c683cSJung-uk Kim * 2149c7c683cSJung-uk Kim * DESCRIPTION: Convert hex bytes to ascii 2159c7c683cSJung-uk Kim * 2169c7c683cSJung-uk Kim ******************************************************************************/ 2179c7c683cSJung-uk Kim 2189c7c683cSJung-uk Kim void 2199c7c683cSJung-uk Kim LsDumpAsciiInComment ( 2209c7c683cSJung-uk Kim UINT32 FileId, 2219c7c683cSJung-uk Kim UINT32 Count, 2229c7c683cSJung-uk Kim UINT8 *Buffer) 2239c7c683cSJung-uk Kim { 2249c7c683cSJung-uk Kim UINT8 BufChar = 0; 2259c7c683cSJung-uk Kim UINT8 LastChar; 2269c7c683cSJung-uk Kim UINT32 i; 2279c7c683cSJung-uk Kim 2289c7c683cSJung-uk Kim 2299c7c683cSJung-uk Kim FlPrintFile (FileId, " \""); 2309c7c683cSJung-uk Kim for (i = 0; i < Count; i++) 2319c7c683cSJung-uk Kim { 2329c7c683cSJung-uk Kim LastChar = BufChar; 2339c7c683cSJung-uk Kim BufChar = Buffer[i]; 2349c7c683cSJung-uk Kim 2359c7c683cSJung-uk Kim if (isprint (BufChar)) 2369c7c683cSJung-uk Kim { 2379c7c683cSJung-uk Kim /* Handle embedded C comment sequences */ 2389c7c683cSJung-uk Kim 2399c7c683cSJung-uk Kim if (((LastChar == '*') && (BufChar == '/')) || 2409c7c683cSJung-uk Kim ((LastChar == '/') && (BufChar == '*'))) 2419c7c683cSJung-uk Kim { 2429c7c683cSJung-uk Kim /* Insert a space to break the sequence */ 2439c7c683cSJung-uk Kim 244a009b7dcSJung-uk Kim FlPrintFile (FileId, " "); 2459c7c683cSJung-uk Kim } 2469c7c683cSJung-uk Kim 2479c7c683cSJung-uk Kim FlPrintFile (FileId, "%c", BufChar); 2489c7c683cSJung-uk Kim } 2499c7c683cSJung-uk Kim else 2509c7c683cSJung-uk Kim { 2519c7c683cSJung-uk Kim /* Not a printable character, just put out a dot */ 2529c7c683cSJung-uk Kim 2539c7c683cSJung-uk Kim FlPrintFile (FileId, "."); 2549c7c683cSJung-uk Kim } 2559c7c683cSJung-uk Kim } 2569c7c683cSJung-uk Kim 2579c7c683cSJung-uk Kim FlPrintFile (FileId, "\""); 2589c7c683cSJung-uk Kim } 2599c7c683cSJung-uk Kim 2609c7c683cSJung-uk Kim 2619c7c683cSJung-uk Kim /******************************************************************************* 2629c7c683cSJung-uk Kim * 2639c7c683cSJung-uk Kim * FUNCTION: LsCheckException 2649c7c683cSJung-uk Kim * 2659c7c683cSJung-uk Kim * PARAMETERS: LineNumber - Current logical (cumulative) line # 2669c7c683cSJung-uk Kim * FileId - ID of output listing file 2679c7c683cSJung-uk Kim * 2689c7c683cSJung-uk Kim * RETURN: None 2699c7c683cSJung-uk Kim * 2709c7c683cSJung-uk Kim * DESCRIPTION: Check if there is an exception for this line, and if there is, 2719c7c683cSJung-uk Kim * put it in the listing immediately. Handles multiple errors 2726f1f1a63SJung-uk Kim * per line. AslGbl_NextError points to the next error in the 2739c7c683cSJung-uk Kim * sorted (by line #) list of compile errors/warnings. 2749c7c683cSJung-uk Kim * 2759c7c683cSJung-uk Kim ******************************************************************************/ 2769c7c683cSJung-uk Kim 2779c7c683cSJung-uk Kim void 2789c7c683cSJung-uk Kim LsCheckException ( 2799c7c683cSJung-uk Kim UINT32 LineNumber, 2809c7c683cSJung-uk Kim UINT32 FileId) 2819c7c683cSJung-uk Kim { 2829c7c683cSJung-uk Kim 2836f1f1a63SJung-uk Kim if ((!AslGbl_NextError) || 2846f1f1a63SJung-uk Kim (LineNumber < AslGbl_NextError->LogicalLineNumber )) 2859c7c683cSJung-uk Kim { 2869c7c683cSJung-uk Kim return; 2879c7c683cSJung-uk Kim } 2889c7c683cSJung-uk Kim 2899c7c683cSJung-uk Kim /* Handle multiple errors per line */ 2909c7c683cSJung-uk Kim 2919c7c683cSJung-uk Kim if (FileId == ASL_FILE_LISTING_OUTPUT) 2929c7c683cSJung-uk Kim { 2936f1f1a63SJung-uk Kim while (AslGbl_NextError && 2946f1f1a63SJung-uk Kim (LineNumber >= AslGbl_NextError->LogicalLineNumber)) 2959c7c683cSJung-uk Kim { 2966f1f1a63SJung-uk Kim AePrintException (FileId, AslGbl_NextError, "\n[****iasl****]\n"); 2976f1f1a63SJung-uk Kim AslGbl_NextError = AslGbl_NextError->Next; 2989c7c683cSJung-uk Kim } 2999c7c683cSJung-uk Kim 3009c7c683cSJung-uk Kim FlPrintFile (FileId, "\n"); 3019c7c683cSJung-uk Kim } 3029c7c683cSJung-uk Kim } 3039c7c683cSJung-uk Kim 3049c7c683cSJung-uk Kim 3059c7c683cSJung-uk Kim /******************************************************************************* 3069c7c683cSJung-uk Kim * 3079c7c683cSJung-uk Kim * FUNCTION: LsWriteListingHexBytes 3089c7c683cSJung-uk Kim * 3099c7c683cSJung-uk Kim * PARAMETERS: Buffer - AML code buffer 3109c7c683cSJung-uk Kim * Length - Number of AML bytes to write 3119c7c683cSJung-uk Kim * FileId - ID of current listing file. 3129c7c683cSJung-uk Kim * 3139c7c683cSJung-uk Kim * RETURN: None 3149c7c683cSJung-uk Kim * 3159c7c683cSJung-uk Kim * DESCRIPTION: Write the contents of the AML buffer to the listing file via 3169c7c683cSJung-uk Kim * the listing buffer. The listing buffer is flushed every 16 3179c7c683cSJung-uk Kim * AML bytes. 3189c7c683cSJung-uk Kim * 3199c7c683cSJung-uk Kim ******************************************************************************/ 3209c7c683cSJung-uk Kim 3219c7c683cSJung-uk Kim void 3229c7c683cSJung-uk Kim LsWriteListingHexBytes ( 3239c7c683cSJung-uk Kim UINT8 *Buffer, 3249c7c683cSJung-uk Kim UINT32 Length, 3259c7c683cSJung-uk Kim UINT32 FileId) 3269c7c683cSJung-uk Kim { 3279c7c683cSJung-uk Kim UINT32 i; 3289c7c683cSJung-uk Kim 3299c7c683cSJung-uk Kim 3309c7c683cSJung-uk Kim /* Transfer all requested bytes */ 3319c7c683cSJung-uk Kim 3329c7c683cSJung-uk Kim for (i = 0; i < Length; i++) 3339c7c683cSJung-uk Kim { 3349c7c683cSJung-uk Kim /* Print line header when buffer is empty */ 3359c7c683cSJung-uk Kim 3366f1f1a63SJung-uk Kim if (AslGbl_CurrentHexColumn == 0) 3379c7c683cSJung-uk Kim { 3386f1f1a63SJung-uk Kim if (AslGbl_HasIncludeFiles) 3399c7c683cSJung-uk Kim { 3409c7c683cSJung-uk Kim FlPrintFile (FileId, "%*s", 10, " "); 3419c7c683cSJung-uk Kim } 3429c7c683cSJung-uk Kim 3439c7c683cSJung-uk Kim switch (FileId) 3449c7c683cSJung-uk Kim { 3459c7c683cSJung-uk Kim case ASL_FILE_LISTING_OUTPUT: 3469c7c683cSJung-uk Kim 3476f1f1a63SJung-uk Kim FlPrintFile (FileId, "%8.8X%s", AslGbl_CurrentAmlOffset, 3489c7c683cSJung-uk Kim ASL_LISTING_LINE_PREFIX); 3499c7c683cSJung-uk Kim break; 3509c7c683cSJung-uk Kim 3519c7c683cSJung-uk Kim case ASL_FILE_ASM_SOURCE_OUTPUT: 3529c7c683cSJung-uk Kim 3539c7c683cSJung-uk Kim FlPrintFile (FileId, " db "); 3549c7c683cSJung-uk Kim break; 3559c7c683cSJung-uk Kim 3569c7c683cSJung-uk Kim case ASL_FILE_C_SOURCE_OUTPUT: 3579c7c683cSJung-uk Kim 3589c7c683cSJung-uk Kim FlPrintFile (FileId, " "); 3599c7c683cSJung-uk Kim break; 3609c7c683cSJung-uk Kim 3619c7c683cSJung-uk Kim default: 362a9d8d09cSJung-uk Kim 3639c7c683cSJung-uk Kim /* No other types supported */ 364a9d8d09cSJung-uk Kim 3659c7c683cSJung-uk Kim return; 3669c7c683cSJung-uk Kim } 3679c7c683cSJung-uk Kim } 3689c7c683cSJung-uk Kim 3699c7c683cSJung-uk Kim /* Transfer AML byte and update counts */ 3709c7c683cSJung-uk Kim 3716f1f1a63SJung-uk Kim AslGbl_AmlBuffer[AslGbl_CurrentHexColumn] = Buffer[i]; 3729c7c683cSJung-uk Kim 3736f1f1a63SJung-uk Kim AslGbl_CurrentHexColumn++; 3746f1f1a63SJung-uk Kim AslGbl_CurrentAmlOffset++; 3759c7c683cSJung-uk Kim 3769c7c683cSJung-uk Kim /* Flush buffer when it is full */ 3779c7c683cSJung-uk Kim 3786f1f1a63SJung-uk Kim if (AslGbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE) 3799c7c683cSJung-uk Kim { 3809c7c683cSJung-uk Kim LsFlushListingBuffer (FileId); 3819c7c683cSJung-uk Kim } 3829c7c683cSJung-uk Kim } 3839c7c683cSJung-uk Kim } 3849c7c683cSJung-uk Kim 3859c7c683cSJung-uk Kim 3869c7c683cSJung-uk Kim /******************************************************************************* 3879c7c683cSJung-uk Kim * 3889c7c683cSJung-uk Kim * FUNCTION: LsWriteSourceLines 3899c7c683cSJung-uk Kim * 3909c7c683cSJung-uk Kim * PARAMETERS: ToLineNumber - 3919c7c683cSJung-uk Kim * ToLogicalLineNumber - Write up to this source line number 3929c7c683cSJung-uk Kim * FileId - ID of current listing file 3939c7c683cSJung-uk Kim * 3949c7c683cSJung-uk Kim * RETURN: None 3959c7c683cSJung-uk Kim * 3969c7c683cSJung-uk Kim * DESCRIPTION: Read then write source lines to the listing file until we have 3979c7c683cSJung-uk Kim * reached the specified logical (cumulative) line number. This 3989c7c683cSJung-uk Kim * automatically echos out comment blocks and other non-AML 3999c7c683cSJung-uk Kim * generating text until we get to the actual AML-generating line 4009c7c683cSJung-uk Kim * of ASL code specified by the logical line number. 4019c7c683cSJung-uk Kim * 4029c7c683cSJung-uk Kim ******************************************************************************/ 4039c7c683cSJung-uk Kim 4049c7c683cSJung-uk Kim void 4059c7c683cSJung-uk Kim LsWriteSourceLines ( 4069c7c683cSJung-uk Kim UINT32 ToLineNumber, 4079c7c683cSJung-uk Kim UINT32 ToLogicalLineNumber, 4089c7c683cSJung-uk Kim UINT32 FileId) 4099c7c683cSJung-uk Kim { 4109c7c683cSJung-uk Kim 4119c7c683cSJung-uk Kim /* Nothing to do for these file types */ 4129c7c683cSJung-uk Kim 4139c7c683cSJung-uk Kim if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || 4149c7c683cSJung-uk Kim (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) 4159c7c683cSJung-uk Kim { 4169c7c683cSJung-uk Kim return; 4179c7c683cSJung-uk Kim } 4189c7c683cSJung-uk Kim 4196f1f1a63SJung-uk Kim AslGbl_CurrentLine = ToLogicalLineNumber; 4209c7c683cSJung-uk Kim 4219c7c683cSJung-uk Kim /* Flush any hex bytes remaining from the last opcode */ 4229c7c683cSJung-uk Kim 4239c7c683cSJung-uk Kim LsFlushListingBuffer (FileId); 4249c7c683cSJung-uk Kim 4259c7c683cSJung-uk Kim /* Read lines and write them as long as we are not caught up */ 4269c7c683cSJung-uk Kim 4276f1f1a63SJung-uk Kim if (AslGbl_SourceLine < AslGbl_CurrentLine) 4289c7c683cSJung-uk Kim { 4299c7c683cSJung-uk Kim /* 4309c7c683cSJung-uk Kim * If we just completed writing some AML hex bytes, output a linefeed 4319c7c683cSJung-uk Kim * to add some whitespace for readability. 4329c7c683cSJung-uk Kim */ 4336f1f1a63SJung-uk Kim if (AslGbl_HexBytesWereWritten) 4349c7c683cSJung-uk Kim { 4359c7c683cSJung-uk Kim FlPrintFile (FileId, "\n"); 4366f1f1a63SJung-uk Kim AslGbl_HexBytesWereWritten = FALSE; 4379c7c683cSJung-uk Kim } 4389c7c683cSJung-uk Kim 4399c7c683cSJung-uk Kim if (FileId == ASL_FILE_C_SOURCE_OUTPUT) 4409c7c683cSJung-uk Kim { 4419c7c683cSJung-uk Kim FlPrintFile (FileId, " /*\n"); 4429c7c683cSJung-uk Kim } 4439c7c683cSJung-uk Kim 4449c7c683cSJung-uk Kim /* Write one line at a time until we have reached the target line # */ 4459c7c683cSJung-uk Kim 4466f1f1a63SJung-uk Kim while ((AslGbl_SourceLine < AslGbl_CurrentLine) && 4479c7c683cSJung-uk Kim LsWriteOneSourceLine (FileId)) 4489c7c683cSJung-uk Kim { ; } 4499c7c683cSJung-uk Kim 4509c7c683cSJung-uk Kim if (FileId == ASL_FILE_C_SOURCE_OUTPUT) 4519c7c683cSJung-uk Kim { 4529c7c683cSJung-uk Kim FlPrintFile (FileId, " */"); 4539c7c683cSJung-uk Kim } 4549c7c683cSJung-uk Kim 4559c7c683cSJung-uk Kim FlPrintFile (FileId, "\n"); 4569c7c683cSJung-uk Kim } 4579c7c683cSJung-uk Kim } 4589c7c683cSJung-uk Kim 4599c7c683cSJung-uk Kim 4609c7c683cSJung-uk Kim /******************************************************************************* 4619c7c683cSJung-uk Kim * 4629c7c683cSJung-uk Kim * FUNCTION: LsWriteOneSourceLine 4639c7c683cSJung-uk Kim * 4649c7c683cSJung-uk Kim * PARAMETERS: FileId - ID of current listing file 4659c7c683cSJung-uk Kim * 4669c7c683cSJung-uk Kim * RETURN: FALSE on EOF (input source file), TRUE otherwise 4679c7c683cSJung-uk Kim * 4689c7c683cSJung-uk Kim * DESCRIPTION: Read one line from the input source file and echo it to the 4699c7c683cSJung-uk Kim * listing file, prefixed with the line number, and if the source 4709c7c683cSJung-uk Kim * file contains include files, prefixed with the current filename 4719c7c683cSJung-uk Kim * 4729c7c683cSJung-uk Kim ******************************************************************************/ 4739c7c683cSJung-uk Kim 4749c7c683cSJung-uk Kim UINT32 4759c7c683cSJung-uk Kim LsWriteOneSourceLine ( 4769c7c683cSJung-uk Kim UINT32 FileId) 4779c7c683cSJung-uk Kim { 4789c7c683cSJung-uk Kim UINT8 FileByte; 4799c7c683cSJung-uk Kim UINT32 Column = 0; 4809c7c683cSJung-uk Kim UINT32 Index = 16; 4819c7c683cSJung-uk Kim BOOLEAN StartOfLine = FALSE; 4829c7c683cSJung-uk Kim BOOLEAN ProcessLongLine = FALSE; 4839c7c683cSJung-uk Kim 4849c7c683cSJung-uk Kim 4856f1f1a63SJung-uk Kim AslGbl_SourceLine++; 4866f1f1a63SJung-uk Kim AslGbl_ListingNode->LineNumber++; 4879c7c683cSJung-uk Kim 4889c7c683cSJung-uk Kim /* Ignore lines that are completely blank (but count the line above) */ 4899c7c683cSJung-uk Kim 4909c7c683cSJung-uk Kim if (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) != AE_OK) 4919c7c683cSJung-uk Kim { 4929c7c683cSJung-uk Kim return (0); 4939c7c683cSJung-uk Kim } 4949c7c683cSJung-uk Kim if (FileByte == '\n') 4959c7c683cSJung-uk Kim { 4969c7c683cSJung-uk Kim return (1); 4979c7c683cSJung-uk Kim } 4989c7c683cSJung-uk Kim 4999c7c683cSJung-uk Kim /* 5009c7c683cSJung-uk Kim * This is a non-empty line, we will print the entire line with 5019c7c683cSJung-uk Kim * the line number and possibly other prefixes and transforms. 5029c7c683cSJung-uk Kim */ 5039c7c683cSJung-uk Kim 5049c7c683cSJung-uk Kim /* Line prefixes for special files, C and ASM output */ 5059c7c683cSJung-uk Kim 5069c7c683cSJung-uk Kim if (FileId == ASL_FILE_C_SOURCE_OUTPUT) 5079c7c683cSJung-uk Kim { 5089c7c683cSJung-uk Kim FlPrintFile (FileId, " *"); 5099c7c683cSJung-uk Kim } 5109c7c683cSJung-uk Kim if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) 5119c7c683cSJung-uk Kim { 5129c7c683cSJung-uk Kim FlPrintFile (FileId, "; "); 5139c7c683cSJung-uk Kim } 5149c7c683cSJung-uk Kim 5156f1f1a63SJung-uk Kim if (AslGbl_HasIncludeFiles) 5169c7c683cSJung-uk Kim { 5179c7c683cSJung-uk Kim /* 5189c7c683cSJung-uk Kim * This file contains "include" statements, print the current 5199c7c683cSJung-uk Kim * filename and line number within the current file 5209c7c683cSJung-uk Kim */ 5219c7c683cSJung-uk Kim FlPrintFile (FileId, "%12s %5d%s", 5226f1f1a63SJung-uk Kim AslGbl_ListingNode->Filename, AslGbl_ListingNode->LineNumber, 5239c7c683cSJung-uk Kim ASL_LISTING_LINE_PREFIX); 5249c7c683cSJung-uk Kim } 5259c7c683cSJung-uk Kim else 5269c7c683cSJung-uk Kim { 5279c7c683cSJung-uk Kim /* No include files, just print the line number */ 5289c7c683cSJung-uk Kim 5296f1f1a63SJung-uk Kim FlPrintFile (FileId, "%8u%s", AslGbl_SourceLine, 5309c7c683cSJung-uk Kim ASL_LISTING_LINE_PREFIX); 5319c7c683cSJung-uk Kim } 5329c7c683cSJung-uk Kim 5339c7c683cSJung-uk Kim /* Read the rest of this line (up to a newline or EOF) */ 5349c7c683cSJung-uk Kim 5359c7c683cSJung-uk Kim do 5369c7c683cSJung-uk Kim { 5379c7c683cSJung-uk Kim if (FileId == ASL_FILE_C_SOURCE_OUTPUT) 5389c7c683cSJung-uk Kim { 5399c7c683cSJung-uk Kim if (FileByte == '/') 5409c7c683cSJung-uk Kim { 5419c7c683cSJung-uk Kim FileByte = '*'; 5429c7c683cSJung-uk Kim } 5439c7c683cSJung-uk Kim } 5449c7c683cSJung-uk Kim 5459c7c683cSJung-uk Kim /* Split long input lines for readability in the listing */ 5469c7c683cSJung-uk Kim 5479c7c683cSJung-uk Kim Column++; 5489c7c683cSJung-uk Kim if (Column >= 128) 5499c7c683cSJung-uk Kim { 5509c7c683cSJung-uk Kim if (!ProcessLongLine) 5519c7c683cSJung-uk Kim { 5529c7c683cSJung-uk Kim if ((FileByte != '}') && 5539c7c683cSJung-uk Kim (FileByte != '{')) 5549c7c683cSJung-uk Kim { 5559c7c683cSJung-uk Kim goto WriteByte; 5569c7c683cSJung-uk Kim } 5579c7c683cSJung-uk Kim 5589c7c683cSJung-uk Kim ProcessLongLine = TRUE; 5599c7c683cSJung-uk Kim } 5609c7c683cSJung-uk Kim 5619c7c683cSJung-uk Kim if (FileByte == '{') 5629c7c683cSJung-uk Kim { 5639c7c683cSJung-uk Kim FlPrintFile (FileId, "\n%*s{\n", Index, " "); 5649c7c683cSJung-uk Kim StartOfLine = TRUE; 5659c7c683cSJung-uk Kim Index += 4; 5669c7c683cSJung-uk Kim continue; 5679c7c683cSJung-uk Kim } 5689c7c683cSJung-uk Kim 5699c7c683cSJung-uk Kim else if (FileByte == '}') 5709c7c683cSJung-uk Kim { 5719c7c683cSJung-uk Kim if (!StartOfLine) 5729c7c683cSJung-uk Kim { 5739c7c683cSJung-uk Kim FlPrintFile (FileId, "\n"); 5749c7c683cSJung-uk Kim } 5759c7c683cSJung-uk Kim 5769c7c683cSJung-uk Kim StartOfLine = TRUE; 5779c7c683cSJung-uk Kim Index -= 4; 5789c7c683cSJung-uk Kim FlPrintFile (FileId, "%*s}\n", Index, " "); 5799c7c683cSJung-uk Kim continue; 5809c7c683cSJung-uk Kim } 5819c7c683cSJung-uk Kim 5829c7c683cSJung-uk Kim /* Ignore spaces/tabs at the start of line */ 5839c7c683cSJung-uk Kim 5849c7c683cSJung-uk Kim else if ((FileByte == ' ') && StartOfLine) 5859c7c683cSJung-uk Kim { 5869c7c683cSJung-uk Kim continue; 5879c7c683cSJung-uk Kim } 5889c7c683cSJung-uk Kim 5899c7c683cSJung-uk Kim else if (StartOfLine) 5909c7c683cSJung-uk Kim { 5919c7c683cSJung-uk Kim StartOfLine = FALSE; 5929c7c683cSJung-uk Kim FlPrintFile (FileId, "%*s", Index, " "); 5939c7c683cSJung-uk Kim } 5949c7c683cSJung-uk Kim 5959c7c683cSJung-uk Kim WriteByte: 5969c7c683cSJung-uk Kim FlWriteFile (FileId, &FileByte, 1); 5979c7c683cSJung-uk Kim if (FileByte == '\n') 5989c7c683cSJung-uk Kim { 5999c7c683cSJung-uk Kim /* 6009c7c683cSJung-uk Kim * This line has been completed. 6019c7c683cSJung-uk Kim * Check if an error occurred on this source line during the compile. 6029c7c683cSJung-uk Kim * If so, we print the error message after the source line. 6039c7c683cSJung-uk Kim */ 6046f1f1a63SJung-uk Kim LsCheckException (AslGbl_SourceLine, FileId); 6059c7c683cSJung-uk Kim return (1); 6069c7c683cSJung-uk Kim } 6079c7c683cSJung-uk Kim } 6089c7c683cSJung-uk Kim else 6099c7c683cSJung-uk Kim { 6109c7c683cSJung-uk Kim FlWriteFile (FileId, &FileByte, 1); 6119c7c683cSJung-uk Kim if (FileByte == '\n') 6129c7c683cSJung-uk Kim { 6139c7c683cSJung-uk Kim /* 6149c7c683cSJung-uk Kim * This line has been completed. 6159c7c683cSJung-uk Kim * Check if an error occurred on this source line during the compile. 6169c7c683cSJung-uk Kim * If so, we print the error message after the source line. 6179c7c683cSJung-uk Kim */ 6186f1f1a63SJung-uk Kim LsCheckException (AslGbl_SourceLine, FileId); 6199c7c683cSJung-uk Kim return (1); 6209c7c683cSJung-uk Kim } 6219c7c683cSJung-uk Kim } 6229c7c683cSJung-uk Kim 6239c7c683cSJung-uk Kim } while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK); 6249c7c683cSJung-uk Kim 6259c7c683cSJung-uk Kim /* EOF on the input file was reached */ 6269c7c683cSJung-uk Kim 6279c7c683cSJung-uk Kim return (0); 6289c7c683cSJung-uk Kim } 6299c7c683cSJung-uk Kim 6309c7c683cSJung-uk Kim 6319c7c683cSJung-uk Kim /******************************************************************************* 6329c7c683cSJung-uk Kim * 6339c7c683cSJung-uk Kim * FUNCTION: LsFlushListingBuffer 6349c7c683cSJung-uk Kim * 6359c7c683cSJung-uk Kim * PARAMETERS: FileId - ID of the listing file 6369c7c683cSJung-uk Kim * 6379c7c683cSJung-uk Kim * RETURN: None 6389c7c683cSJung-uk Kim * 6399c7c683cSJung-uk Kim * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code 6409c7c683cSJung-uk Kim * buffer. Usually called at the termination of a single line 6419c7c683cSJung-uk Kim * of source code or when the buffer is full. 6429c7c683cSJung-uk Kim * 6439c7c683cSJung-uk Kim ******************************************************************************/ 6449c7c683cSJung-uk Kim 6459c7c683cSJung-uk Kim void 6469c7c683cSJung-uk Kim LsFlushListingBuffer ( 6479c7c683cSJung-uk Kim UINT32 FileId) 6489c7c683cSJung-uk Kim { 6499c7c683cSJung-uk Kim UINT32 i; 6509c7c683cSJung-uk Kim 6519c7c683cSJung-uk Kim 6526f1f1a63SJung-uk Kim if (AslGbl_CurrentHexColumn == 0) 6539c7c683cSJung-uk Kim { 6549c7c683cSJung-uk Kim return; 6559c7c683cSJung-uk Kim } 6569c7c683cSJung-uk Kim 6579c7c683cSJung-uk Kim /* Write the hex bytes */ 6589c7c683cSJung-uk Kim 6599c7c683cSJung-uk Kim switch (FileId) 6609c7c683cSJung-uk Kim { 6619c7c683cSJung-uk Kim case ASL_FILE_LISTING_OUTPUT: 6629c7c683cSJung-uk Kim 6636f1f1a63SJung-uk Kim for (i = 0; i < AslGbl_CurrentHexColumn; i++) 6649c7c683cSJung-uk Kim { 6656f1f1a63SJung-uk Kim FlPrintFile (FileId, "%2.2X ", AslGbl_AmlBuffer[i]); 6669c7c683cSJung-uk Kim } 6679c7c683cSJung-uk Kim 6686f1f1a63SJung-uk Kim for (i = 0; i < ((HEX_LISTING_LINE_SIZE - AslGbl_CurrentHexColumn) * 3); i++) 6699c7c683cSJung-uk Kim { 6709c7c683cSJung-uk Kim FlWriteFile (FileId, ".", 1); 6719c7c683cSJung-uk Kim } 6729c7c683cSJung-uk Kim 6739c7c683cSJung-uk Kim /* Write the ASCII character associated with each of the bytes */ 6749c7c683cSJung-uk Kim 6756f1f1a63SJung-uk Kim LsDumpAscii (FileId, AslGbl_CurrentHexColumn, AslGbl_AmlBuffer); 6769c7c683cSJung-uk Kim break; 6779c7c683cSJung-uk Kim 6789c7c683cSJung-uk Kim 6799c7c683cSJung-uk Kim case ASL_FILE_ASM_SOURCE_OUTPUT: 6809c7c683cSJung-uk Kim 6816f1f1a63SJung-uk Kim for (i = 0; i < AslGbl_CurrentHexColumn; i++) 6829c7c683cSJung-uk Kim { 6839c7c683cSJung-uk Kim if (i > 0) 6849c7c683cSJung-uk Kim { 6859c7c683cSJung-uk Kim FlPrintFile (FileId, ","); 6869c7c683cSJung-uk Kim } 687f8146b88SJung-uk Kim 6886f1f1a63SJung-uk Kim FlPrintFile (FileId, "0%2.2Xh", AslGbl_AmlBuffer[i]); 6899c7c683cSJung-uk Kim } 6909c7c683cSJung-uk Kim 6916f1f1a63SJung-uk Kim for (i = 0; i < ((HEX_LISTING_LINE_SIZE - AslGbl_CurrentHexColumn) * 5); i++) 6929c7c683cSJung-uk Kim { 6939c7c683cSJung-uk Kim FlWriteFile (FileId, " ", 1); 6949c7c683cSJung-uk Kim } 6959c7c683cSJung-uk Kim 6969c7c683cSJung-uk Kim FlPrintFile (FileId, " ;%8.8X", 6976f1f1a63SJung-uk Kim AslGbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); 6989c7c683cSJung-uk Kim 6999c7c683cSJung-uk Kim /* Write the ASCII character associated with each of the bytes */ 7009c7c683cSJung-uk Kim 7016f1f1a63SJung-uk Kim LsDumpAscii (FileId, AslGbl_CurrentHexColumn, AslGbl_AmlBuffer); 7029c7c683cSJung-uk Kim break; 7039c7c683cSJung-uk Kim 7049c7c683cSJung-uk Kim 7059c7c683cSJung-uk Kim case ASL_FILE_C_SOURCE_OUTPUT: 7069c7c683cSJung-uk Kim 7076f1f1a63SJung-uk Kim for (i = 0; i < AslGbl_CurrentHexColumn; i++) 7089c7c683cSJung-uk Kim { 7096f1f1a63SJung-uk Kim FlPrintFile (FileId, "0x%2.2X,", AslGbl_AmlBuffer[i]); 7109c7c683cSJung-uk Kim } 7119c7c683cSJung-uk Kim 7129c7c683cSJung-uk Kim /* Pad hex output with spaces if line is shorter than max line size */ 7139c7c683cSJung-uk Kim 7146f1f1a63SJung-uk Kim for (i = 0; i < ((HEX_LISTING_LINE_SIZE - AslGbl_CurrentHexColumn) * 5); i++) 7159c7c683cSJung-uk Kim { 7169c7c683cSJung-uk Kim FlWriteFile (FileId, " ", 1); 7179c7c683cSJung-uk Kim } 7189c7c683cSJung-uk Kim 7199c7c683cSJung-uk Kim /* AML offset for the start of the line */ 7209c7c683cSJung-uk Kim 7219c7c683cSJung-uk Kim FlPrintFile (FileId, " /* %8.8X", 7226f1f1a63SJung-uk Kim AslGbl_CurrentAmlOffset - AslGbl_CurrentHexColumn); 7239c7c683cSJung-uk Kim 7249c7c683cSJung-uk Kim /* Write the ASCII character associated with each of the bytes */ 7259c7c683cSJung-uk Kim 7266f1f1a63SJung-uk Kim LsDumpAsciiInComment (FileId, AslGbl_CurrentHexColumn, AslGbl_AmlBuffer); 7279c7c683cSJung-uk Kim FlPrintFile (FileId, " */"); 7289c7c683cSJung-uk Kim break; 7299c7c683cSJung-uk Kim 7309c7c683cSJung-uk Kim default: 731a9d8d09cSJung-uk Kim 7329c7c683cSJung-uk Kim /* No other types supported */ 733a9d8d09cSJung-uk Kim 7349c7c683cSJung-uk Kim return; 7359c7c683cSJung-uk Kim } 7369c7c683cSJung-uk Kim 7379c7c683cSJung-uk Kim FlPrintFile (FileId, "\n"); 7389c7c683cSJung-uk Kim 7396f1f1a63SJung-uk Kim AslGbl_CurrentHexColumn = 0; 7406f1f1a63SJung-uk Kim AslGbl_HexBytesWereWritten = TRUE; 7419c7c683cSJung-uk Kim } 7429c7c683cSJung-uk Kim 7439c7c683cSJung-uk Kim 7449c7c683cSJung-uk Kim /******************************************************************************* 7459c7c683cSJung-uk Kim * 7469c7c683cSJung-uk Kim * FUNCTION: LsPushNode 7479c7c683cSJung-uk Kim * 7489c7c683cSJung-uk Kim * PARAMETERS: Filename - Pointer to the include filename 7499c7c683cSJung-uk Kim * 7509c7c683cSJung-uk Kim * RETURN: None 7519c7c683cSJung-uk Kim * 7529c7c683cSJung-uk Kim * DESCRIPTION: Push a listing node on the listing/include file stack. This 7539c7c683cSJung-uk Kim * stack enables tracking of include files (infinitely nested) 7549c7c683cSJung-uk Kim * and resumption of the listing of the parent file when the 7559c7c683cSJung-uk Kim * include file is finished. 7569c7c683cSJung-uk Kim * 7579c7c683cSJung-uk Kim ******************************************************************************/ 7589c7c683cSJung-uk Kim 7599c7c683cSJung-uk Kim void 7609c7c683cSJung-uk Kim LsPushNode ( 7619c7c683cSJung-uk Kim char *Filename) 7629c7c683cSJung-uk Kim { 7639c7c683cSJung-uk Kim ASL_LISTING_NODE *Lnode; 7649c7c683cSJung-uk Kim 7659c7c683cSJung-uk Kim 7669c7c683cSJung-uk Kim /* Create a new node */ 7679c7c683cSJung-uk Kim 7689c7c683cSJung-uk Kim Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE)); 7699c7c683cSJung-uk Kim 7709c7c683cSJung-uk Kim /* Initialize */ 7719c7c683cSJung-uk Kim 7729c7c683cSJung-uk Kim Lnode->Filename = Filename; 7739c7c683cSJung-uk Kim Lnode->LineNumber = 0; 7749c7c683cSJung-uk Kim 7759c7c683cSJung-uk Kim /* Link (push) */ 7769c7c683cSJung-uk Kim 7776f1f1a63SJung-uk Kim Lnode->Next = AslGbl_ListingNode; 7786f1f1a63SJung-uk Kim AslGbl_ListingNode = Lnode; 7799c7c683cSJung-uk Kim } 7809c7c683cSJung-uk Kim 7819c7c683cSJung-uk Kim 7829c7c683cSJung-uk Kim /******************************************************************************* 7839c7c683cSJung-uk Kim * 7849c7c683cSJung-uk Kim * FUNCTION: LsPopNode 7859c7c683cSJung-uk Kim * 7869c7c683cSJung-uk Kim * PARAMETERS: None 7879c7c683cSJung-uk Kim * 7889c7c683cSJung-uk Kim * RETURN: List head after current head is popped off 7899c7c683cSJung-uk Kim * 7909c7c683cSJung-uk Kim * DESCRIPTION: Pop the current head of the list, free it, and return the 7919c7c683cSJung-uk Kim * next node on the stack (the new current node). 7929c7c683cSJung-uk Kim * 7939c7c683cSJung-uk Kim ******************************************************************************/ 7949c7c683cSJung-uk Kim 7959c7c683cSJung-uk Kim ASL_LISTING_NODE * 7969c7c683cSJung-uk Kim LsPopNode ( 7979c7c683cSJung-uk Kim void) 7989c7c683cSJung-uk Kim { 7999c7c683cSJung-uk Kim ASL_LISTING_NODE *Lnode; 8009c7c683cSJung-uk Kim 8019c7c683cSJung-uk Kim 8029c7c683cSJung-uk Kim /* Just grab the node at the head of the list */ 8039c7c683cSJung-uk Kim 8046f1f1a63SJung-uk Kim Lnode = AslGbl_ListingNode; 8059c7c683cSJung-uk Kim if ((!Lnode) || 8069c7c683cSJung-uk Kim (!Lnode->Next)) 8079c7c683cSJung-uk Kim { 8089c7c683cSJung-uk Kim AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, 8099c7c683cSJung-uk Kim "Could not pop empty listing stack"); 8106f1f1a63SJung-uk Kim return (AslGbl_ListingNode); 8119c7c683cSJung-uk Kim } 8129c7c683cSJung-uk Kim 8136f1f1a63SJung-uk Kim AslGbl_ListingNode = Lnode->Next; 8149c7c683cSJung-uk Kim ACPI_FREE (Lnode); 8159c7c683cSJung-uk Kim 8169c7c683cSJung-uk Kim /* New "Current" node is the new head */ 8179c7c683cSJung-uk Kim 8186f1f1a63SJung-uk Kim return (AslGbl_ListingNode); 8199c7c683cSJung-uk Kim } 820