xref: /freebsd/sys/contrib/dev/acpica/components/utilities/utstring.c (revision 58308fadece25ae4c12bd2f4dce3d73d9c23be43)
1efcc2a30SJung-uk Kim /*******************************************************************************
2efcc2a30SJung-uk Kim  *
3efcc2a30SJung-uk Kim  * Module Name: utstring - Common functions for strings and characters
4efcc2a30SJung-uk Kim  *
5efcc2a30SJung-uk Kim  ******************************************************************************/
6efcc2a30SJung-uk Kim 
70d84335fSJung-uk Kim /******************************************************************************
80d84335fSJung-uk Kim  *
90d84335fSJung-uk Kim  * 1. Copyright Notice
100d84335fSJung-uk Kim  *
11*58308fadSJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
12efcc2a30SJung-uk Kim  * All rights reserved.
13efcc2a30SJung-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  *
119efcc2a30SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
120efcc2a30SJung-uk Kim  * modification, are permitted provided that the following conditions
121efcc2a30SJung-uk Kim  * are met:
122efcc2a30SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
123efcc2a30SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
124efcc2a30SJung-uk Kim  *    without modification.
125efcc2a30SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126efcc2a30SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
127efcc2a30SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
128efcc2a30SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
129efcc2a30SJung-uk Kim  *    binary redistribution.
130efcc2a30SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
131efcc2a30SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
132efcc2a30SJung-uk Kim  *    from this software without specific prior written permission.
133efcc2a30SJung-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
147efcc2a30SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
148efcc2a30SJung-uk Kim  * Software Foundation.
149efcc2a30SJung-uk Kim  *
1500d84335fSJung-uk Kim  *****************************************************************************/
151efcc2a30SJung-uk Kim 
152efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
153efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
154efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/acnamesp.h>
155efcc2a30SJung-uk Kim 
156efcc2a30SJung-uk Kim 
157efcc2a30SJung-uk Kim #define _COMPONENT          ACPI_UTILITIES
158efcc2a30SJung-uk Kim         ACPI_MODULE_NAME    ("utstring")
159efcc2a30SJung-uk Kim 
160efcc2a30SJung-uk Kim 
161efcc2a30SJung-uk Kim /*******************************************************************************
162efcc2a30SJung-uk Kim  *
163efcc2a30SJung-uk Kim  * FUNCTION:    AcpiUtPrintString
164efcc2a30SJung-uk Kim  *
165efcc2a30SJung-uk Kim  * PARAMETERS:  String          - Null terminated ASCII string
1668d744e47SJung-uk Kim  *              MaxLength       - Maximum output length. Used to constrain the
1678d744e47SJung-uk Kim  *                                length of strings during debug output only.
168efcc2a30SJung-uk Kim  *
169efcc2a30SJung-uk Kim  * RETURN:      None
170efcc2a30SJung-uk Kim  *
171efcc2a30SJung-uk Kim  * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
172efcc2a30SJung-uk Kim  *              sequences.
173efcc2a30SJung-uk Kim  *
174efcc2a30SJung-uk Kim  ******************************************************************************/
175efcc2a30SJung-uk Kim 
176efcc2a30SJung-uk Kim void
AcpiUtPrintString(char * String,UINT16 MaxLength)177efcc2a30SJung-uk Kim AcpiUtPrintString (
178efcc2a30SJung-uk Kim     char                    *String,
1798d744e47SJung-uk Kim     UINT16                  MaxLength)
180efcc2a30SJung-uk Kim {
181efcc2a30SJung-uk Kim     UINT32                  i;
182efcc2a30SJung-uk Kim 
183efcc2a30SJung-uk Kim 
184efcc2a30SJung-uk Kim     if (!String)
185efcc2a30SJung-uk Kim     {
186efcc2a30SJung-uk Kim         AcpiOsPrintf ("<\"NULL STRING PTR\">");
187efcc2a30SJung-uk Kim         return;
188efcc2a30SJung-uk Kim     }
189efcc2a30SJung-uk Kim 
190efcc2a30SJung-uk Kim     AcpiOsPrintf ("\"");
191313a0c13SJung-uk Kim     for (i = 0; (i < MaxLength) && String[i]; i++)
192efcc2a30SJung-uk Kim     {
193efcc2a30SJung-uk Kim         /* Escape sequences */
194efcc2a30SJung-uk Kim 
195efcc2a30SJung-uk Kim         switch (String[i])
196efcc2a30SJung-uk Kim         {
197efcc2a30SJung-uk Kim         case 0x07:
198a9d8d09cSJung-uk Kim 
199efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\a");       /* BELL */
200efcc2a30SJung-uk Kim             break;
201efcc2a30SJung-uk Kim 
202efcc2a30SJung-uk Kim         case 0x08:
203a9d8d09cSJung-uk Kim 
204efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\b");       /* BACKSPACE */
205efcc2a30SJung-uk Kim             break;
206efcc2a30SJung-uk Kim 
207efcc2a30SJung-uk Kim         case 0x0C:
208a9d8d09cSJung-uk Kim 
209efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\f");       /* FORMFEED */
210efcc2a30SJung-uk Kim             break;
211efcc2a30SJung-uk Kim 
212efcc2a30SJung-uk Kim         case 0x0A:
213a9d8d09cSJung-uk Kim 
214efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\n");       /* LINEFEED */
215efcc2a30SJung-uk Kim             break;
216efcc2a30SJung-uk Kim 
217efcc2a30SJung-uk Kim         case 0x0D:
218a9d8d09cSJung-uk Kim 
219efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\r");       /* CARRIAGE RETURN*/
220efcc2a30SJung-uk Kim             break;
221efcc2a30SJung-uk Kim 
222efcc2a30SJung-uk Kim         case 0x09:
223a9d8d09cSJung-uk Kim 
224efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\t");       /* HORIZONTAL TAB */
225efcc2a30SJung-uk Kim             break;
226efcc2a30SJung-uk Kim 
227efcc2a30SJung-uk Kim         case 0x0B:
228a9d8d09cSJung-uk Kim 
229efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\v");       /* VERTICAL TAB */
230efcc2a30SJung-uk Kim             break;
231efcc2a30SJung-uk Kim 
232efcc2a30SJung-uk Kim         case '\'':                      /* Single Quote */
233efcc2a30SJung-uk Kim         case '\"':                      /* Double Quote */
234efcc2a30SJung-uk Kim         case '\\':                      /* Backslash */
235a9d8d09cSJung-uk Kim 
236efcc2a30SJung-uk Kim             AcpiOsPrintf ("\\%c", (int) String[i]);
237efcc2a30SJung-uk Kim             break;
238efcc2a30SJung-uk Kim 
239efcc2a30SJung-uk Kim         default:
240efcc2a30SJung-uk Kim 
241efcc2a30SJung-uk Kim             /* Check for printable character or hex escape */
242efcc2a30SJung-uk Kim 
2435ef50723SJung-uk Kim             if (isprint ((int) String[i]))
244efcc2a30SJung-uk Kim             {
245efcc2a30SJung-uk Kim                 /* This is a normal character */
246efcc2a30SJung-uk Kim 
247efcc2a30SJung-uk Kim                 AcpiOsPrintf ("%c", (int) String[i]);
248efcc2a30SJung-uk Kim             }
249efcc2a30SJung-uk Kim             else
250efcc2a30SJung-uk Kim             {
251efcc2a30SJung-uk Kim                 /* All others will be Hex escapes */
252efcc2a30SJung-uk Kim 
253efcc2a30SJung-uk Kim                 AcpiOsPrintf ("\\x%2.2X", (INT32) String[i]);
254efcc2a30SJung-uk Kim             }
255efcc2a30SJung-uk Kim             break;
256efcc2a30SJung-uk Kim         }
257efcc2a30SJung-uk Kim     }
258f8146b88SJung-uk Kim 
259efcc2a30SJung-uk Kim     AcpiOsPrintf ("\"");
260efcc2a30SJung-uk Kim 
261efcc2a30SJung-uk Kim     if (i == MaxLength && String[i])
262efcc2a30SJung-uk Kim     {
263efcc2a30SJung-uk Kim         AcpiOsPrintf ("...");
264efcc2a30SJung-uk Kim     }
265efcc2a30SJung-uk Kim }
266efcc2a30SJung-uk Kim 
267efcc2a30SJung-uk Kim 
268efcc2a30SJung-uk Kim /*******************************************************************************
269efcc2a30SJung-uk Kim  *
270efcc2a30SJung-uk Kim  * FUNCTION:    AcpiUtRepairName
271efcc2a30SJung-uk Kim  *
272efcc2a30SJung-uk Kim  * PARAMETERS:  Name            - The ACPI name to be repaired
273efcc2a30SJung-uk Kim  *
274efcc2a30SJung-uk Kim  * RETURN:      Repaired version of the name
275efcc2a30SJung-uk Kim  *
276efcc2a30SJung-uk Kim  * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
277efcc2a30SJung-uk Kim  *              return the new name. NOTE: the Name parameter must reside in
278efcc2a30SJung-uk Kim  *              read/write memory, cannot be a const.
279efcc2a30SJung-uk Kim  *
280efcc2a30SJung-uk Kim  * An ACPI Name must consist of valid ACPI characters. We will repair the name
281efcc2a30SJung-uk Kim  * if necessary because we don't want to abort because of this, but we want
282efcc2a30SJung-uk Kim  * all namespace names to be printable. A warning message is appropriate.
283efcc2a30SJung-uk Kim  *
284efcc2a30SJung-uk Kim  * This issue came up because there are in fact machines that exhibit
285efcc2a30SJung-uk Kim  * this problem, and we want to be able to enable ACPI support for them,
286efcc2a30SJung-uk Kim  * even though there are a few bad names.
287efcc2a30SJung-uk Kim  *
288efcc2a30SJung-uk Kim  ******************************************************************************/
289efcc2a30SJung-uk Kim 
290efcc2a30SJung-uk Kim void
AcpiUtRepairName(char * Name)291efcc2a30SJung-uk Kim AcpiUtRepairName (
292efcc2a30SJung-uk Kim     char                    *Name)
293efcc2a30SJung-uk Kim {
294efcc2a30SJung-uk Kim     UINT32                  i;
295efcc2a30SJung-uk Kim     BOOLEAN                 FoundBadChar = FALSE;
296efcc2a30SJung-uk Kim     UINT32                  OriginalName;
297efcc2a30SJung-uk Kim 
298efcc2a30SJung-uk Kim 
299efcc2a30SJung-uk Kim     ACPI_FUNCTION_NAME (UtRepairName);
300efcc2a30SJung-uk Kim 
301efcc2a30SJung-uk Kim 
302f8146b88SJung-uk Kim     /*
303f8146b88SJung-uk Kim      * Special case for the root node. This can happen if we get an
304f8146b88SJung-uk Kim      * error during the execution of module-level code.
305f8146b88SJung-uk Kim      */
306278f0de6SJung-uk Kim     if (ACPI_COMPARE_NAMESEG (Name, ACPI_ROOT_PATHNAME))
307f8146b88SJung-uk Kim     {
308f8146b88SJung-uk Kim         return;
309f8146b88SJung-uk Kim     }
310f8146b88SJung-uk Kim 
3119a4bc520SJung-uk Kim     ACPI_COPY_NAMESEG (&OriginalName, &Name[0]);
312efcc2a30SJung-uk Kim 
313efcc2a30SJung-uk Kim     /* Check each character in the name */
314efcc2a30SJung-uk Kim 
315278f0de6SJung-uk Kim     for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
316efcc2a30SJung-uk Kim     {
317f8146b88SJung-uk Kim         if (AcpiUtValidNameChar (Name[i], i))
318efcc2a30SJung-uk Kim         {
319efcc2a30SJung-uk Kim             continue;
320efcc2a30SJung-uk Kim         }
321efcc2a30SJung-uk Kim 
322efcc2a30SJung-uk Kim         /*
323efcc2a30SJung-uk Kim          * Replace a bad character with something printable, yet technically
3249a4bc520SJung-uk Kim          * "odd". This prevents any collisions with existing "good"
325efcc2a30SJung-uk Kim          * names in the namespace.
326efcc2a30SJung-uk Kim          */
3279a4bc520SJung-uk Kim         Name[i] = '_';
328efcc2a30SJung-uk Kim         FoundBadChar = TRUE;
329efcc2a30SJung-uk Kim     }
330efcc2a30SJung-uk Kim 
331efcc2a30SJung-uk Kim     if (FoundBadChar)
332efcc2a30SJung-uk Kim     {
333efcc2a30SJung-uk Kim         /* Report warning only if in strict mode or debug mode */
334efcc2a30SJung-uk Kim 
335efcc2a30SJung-uk Kim         if (!AcpiGbl_EnableInterpreterSlack)
336efcc2a30SJung-uk Kim         {
337efcc2a30SJung-uk Kim             ACPI_WARNING ((AE_INFO,
3389a4bc520SJung-uk Kim                 "Invalid character(s) in name (0x%.8X) %p, repaired: [%4.4s]",
3399a4bc520SJung-uk Kim                 OriginalName, Name, &Name[0]));
340efcc2a30SJung-uk Kim         }
341efcc2a30SJung-uk Kim         else
342efcc2a30SJung-uk Kim         {
343efcc2a30SJung-uk Kim             ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
344efcc2a30SJung-uk Kim                 "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
345efcc2a30SJung-uk Kim                 OriginalName, Name));
346efcc2a30SJung-uk Kim         }
347efcc2a30SJung-uk Kim     }
348efcc2a30SJung-uk Kim }
349efcc2a30SJung-uk Kim 
350efcc2a30SJung-uk Kim 
351efcc2a30SJung-uk Kim #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
352efcc2a30SJung-uk Kim /*******************************************************************************
353efcc2a30SJung-uk Kim  *
354efcc2a30SJung-uk Kim  * FUNCTION:    UtConvertBackslashes
355efcc2a30SJung-uk Kim  *
356efcc2a30SJung-uk Kim  * PARAMETERS:  Pathname        - File pathname string to be converted
357efcc2a30SJung-uk Kim  *
358efcc2a30SJung-uk Kim  * RETURN:      Modifies the input Pathname
359efcc2a30SJung-uk Kim  *
360efcc2a30SJung-uk Kim  * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within
361efcc2a30SJung-uk Kim  *              the entire input file pathname string.
362efcc2a30SJung-uk Kim  *
363efcc2a30SJung-uk Kim  ******************************************************************************/
364efcc2a30SJung-uk Kim 
365efcc2a30SJung-uk Kim void
UtConvertBackslashes(char * Pathname)366efcc2a30SJung-uk Kim UtConvertBackslashes (
367efcc2a30SJung-uk Kim     char                    *Pathname)
368efcc2a30SJung-uk Kim {
369efcc2a30SJung-uk Kim 
370efcc2a30SJung-uk Kim     if (!Pathname)
371efcc2a30SJung-uk Kim     {
372efcc2a30SJung-uk Kim         return;
373efcc2a30SJung-uk Kim     }
374efcc2a30SJung-uk Kim 
375efcc2a30SJung-uk Kim     while (*Pathname)
376efcc2a30SJung-uk Kim     {
377efcc2a30SJung-uk Kim         if (*Pathname == '\\')
378efcc2a30SJung-uk Kim         {
379efcc2a30SJung-uk Kim             *Pathname = '/';
380efcc2a30SJung-uk Kim         }
381efcc2a30SJung-uk Kim 
382efcc2a30SJung-uk Kim         Pathname++;
383efcc2a30SJung-uk Kim     }
384efcc2a30SJung-uk Kim }
385efcc2a30SJung-uk Kim #endif
386