1 /******************************************************************************
3 * Module Name: aslsupport.l - Flex/lex scanner C support routines.
4 * NOTE: Included into aslcompile.l, not compiled by itself.
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************
117 * Alternatively, you may choose to be licensed under the terms of the
120 * Redistribution and use in source and binary forms, with or without
121 * modification, are permitted provided that the following conditions
123 * 1. Redistributions of source code must retain the above copyright
124 * notice, this list of conditions, and the following disclaimer,
125 * without modification.
126 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
127 * substantially similar to the "NO WARRANTY" disclaimer below
128 * ("Disclaimer") and any redistribution must be conditioned upon
129 * including a substantially similar Disclaimer requirement for further
130 * binary redistribution.
131 * 3. Neither the names of the above-listed copyright holders nor the names
132 * of any contributors may be used to endorse or promote products derived
133 * from this software without specific prior written permission.
135 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
136 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
137 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
138 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
139 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
140 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
141 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
142 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
143 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
144 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
145 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
147 * Alternatively, you may choose to be licensed under the terms of the
148 * GNU General Public License ("GPL") version 2 as published by the Free
149 * Software Foundation.
151 *****************************************************************************/
155 #define ASL_SPACES_PER_TAB 4
157 #define ASL_NORMAL_CHAR 0
158 #define ASL_ESCAPE_SEQUENCE 1
159 #define ASL_OCTAL_CONSTANT 2
160 #define ASL_HEX_CONSTANT 3
164 yyerror (char const *s)
167 AcpiOsPrintf ("YYERROR: %s\n", s);
171 /*******************************************************************************
173 * FUNCTION: AslParserCleanup
175 * Used to delete the current buffer
177 ******************************************************************************/
184 yy_delete_buffer (YY_CURRENT_BUFFER);
188 /*******************************************************************************
190 * FUNCTION: AslDoLineDirective
192 * PARAMETERS: None. Uses input() to access current source code line
194 * RETURN: Updates global line number and filename
196 * DESCRIPTION: Handle #line directives emitted by the preprocessor.
198 * The #line directive is emitted by the preprocesser, and is used to
199 * pass through line numbers from the original source code file to the
200 * preprocessor output file (.i). This allows any compiler-generated
201 * error messages to be displayed with the correct line number.
203 ******************************************************************************/
215 AslGbl_HasIncludeFiles = TRUE;
217 /* Eat the entire line that contains the #line directive */
219 AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer;
221 while ((c = input()) != '\n' && c != EOF)
223 *AslGbl_LineBufPtr = c;
226 *AslGbl_LineBufPtr = 0;
228 /* First argument is the actual line number */
230 Token = strtok (AslGbl_CurrentLineBuffer, " ");
236 /* First argument is the line number */
238 LineNumber = (UINT32) UtDoConstant (Token);
240 /* Emit the appropriate number of newlines */
242 AslGbl_CurrentColumn = 0;
243 if (LineNumber > AslGbl_CurrentLineNumber)
245 for (i = 0; i < (LineNumber - AslGbl_CurrentLineNumber); i++)
247 FlWriteFile (ASL_FILE_SOURCE_OUTPUT, "\n", 1);
248 AslGbl_CurrentColumn++;
252 FlSetLineNumber (LineNumber);
254 /* Second argument is the optional filename (in double quotes) */
256 Token = strtok (NULL, " \"");
259 Filename = UtLocalCacheCalloc (strlen (Token) + 1);
260 strcpy (Filename, Token);
261 FlSetFilename (Filename);
264 /* Third argument is not supported at this time */
268 /* Reset globals for a new line */
270 AslGbl_CurrentLineOffset += AslGbl_CurrentColumn;
271 AslGbl_CurrentColumn = 0;
272 AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer;
276 /*******************************************************************************
278 * FUNCTION: AslPopInputFileStack
282 * RETURN: 0 if a node was popped, -1 otherwise
284 * DESCRIPTION: Pop the top of the input file stack and point the parser to
285 * the saved parse buffer contained in the fnode. Also, set the
286 * global line counters to the saved values. This function is
287 * called when an include file reaches EOF.
289 ******************************************************************************/
292 AslPopInputFileStack (
295 ASL_FILE_NODE *Fnode;
298 AslGbl_PreviousIncludeFilename = AslGbl_Files[ASL_FILE_INPUT].Filename;
299 Fnode = AslGbl_IncludeFileStack;
300 DbgPrint (ASL_PARSE_OUTPUT,
301 "\nPop InputFile Stack, Fnode %p\n", Fnode);
303 DbgPrint (ASL_PARSE_OUTPUT,
304 "Include: Closing \"%s\"\n\n", AslGbl_Files[ASL_FILE_INPUT].Filename);
311 /* Close the current include file */
315 /* Update the top-of-stack */
317 AslGbl_IncludeFileStack = Fnode->Next;
319 /* Reset global line counter and filename */
321 AslGbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
322 AslGbl_CurrentLineNumber = Fnode->CurrentLineNumber;
324 /* Point the parser to the popped file */
326 yy_delete_buffer (YY_CURRENT_BUFFER);
327 yy_switch_to_buffer (Fnode->State);
329 /* All done with this node */
336 /*******************************************************************************
338 * FUNCTION: AslPushInputFileStack
340 * PARAMETERS: InputFile - Open file pointer
341 * Filename - Name of the file
345 * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
346 * to this file. Called when an include file is successfully
349 ******************************************************************************/
352 AslPushInputFileStack (
356 ASL_FILE_NODE *Fnode;
357 YY_BUFFER_STATE State;
360 /* Save the current state in an Fnode */
362 Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
365 Fnode->Next = AslGbl_IncludeFileStack;
366 Fnode->State = YY_CURRENT_BUFFER;
367 Fnode->Filename = AslGbl_Files[ASL_FILE_INPUT].Filename;
368 Fnode->CurrentLineNumber = AslGbl_CurrentLineNumber;
370 /* Push it on the stack */
372 AslGbl_IncludeFileStack = Fnode;
374 /* Point the parser to this file */
376 State = yy_create_buffer (InputFile, YY_BUF_SIZE);
377 yy_switch_to_buffer (State);
379 DbgPrint (ASL_PARSE_OUTPUT,
380 "\nPush InputFile Stack, returning %p\n\n", InputFile);
382 /* Reset the global line count and filename */
384 AslGbl_Files[ASL_FILE_INPUT].Filename =
385 UtLocalCacheCalloc (strlen (Filename) + 1);
387 strcpy (AslGbl_Files[ASL_FILE_INPUT].Filename, Filename);
389 AslGbl_CurrentLineNumber = 1;
392 /* converter: reset the comment state to STANDARD_COMMENT */
394 AslGbl_CommentState.CommentType = STANDARD_COMMENT;
398 /*******************************************************************************
400 * FUNCTION: AslResetCurrentLineBuffer
406 * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
408 ******************************************************************************/
411 AslResetCurrentLineBuffer (
415 if (AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
417 FlWriteFile (ASL_FILE_SOURCE_OUTPUT, AslGbl_CurrentLineBuffer,
418 AslGbl_LineBufPtr - AslGbl_CurrentLineBuffer);
421 AslGbl_CurrentLineOffset += AslGbl_CurrentColumn;
422 AslGbl_CurrentColumn = 0;
424 AslGbl_CurrentLineNumber++;
425 AslGbl_LogicalLineNumber++;
426 AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer;
430 /*******************************************************************************
432 * FUNCTION: AslInsertLineBuffer
434 * PARAMETERS: SourceChar - One char from the input ASL source file
438 * DESCRIPTION: Put one character of the source file into the temp line buffer
440 ******************************************************************************/
443 AslInsertLineBuffer (
450 if (SourceChar == EOF)
455 AslGbl_InputByteCount++;
457 /* Handle tabs. Convert to spaces */
459 if (SourceChar == '\t')
462 Count = ASL_SPACES_PER_TAB -
463 (AslGbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
466 for (i = 0; i < Count; i++)
468 AslGbl_CurrentColumn++;
470 /* Insert the character into the line buffer */
472 *AslGbl_LineBufPtr = (UINT8) SourceChar;
475 if (AslGbl_LineBufPtr >
476 (AslGbl_CurrentLineBuffer + (AslGbl_LineBufferSize - 1)))
480 * Warning if we have split a long source line.
481 * <Probably overkill>
483 sprintf (MsgBuffer, "Max %u", AslGbl_LineBufferSize);
484 AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
485 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
486 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
487 AslGbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
490 AslResetCurrentLineBuffer ();
492 else if (SourceChar == '\n')
496 AslResetCurrentLineBuffer ();
499 if (AcpiGbl_CaptureComments)
501 CvProcessCommentState (SourceChar);
507 /*******************************************************************************
511 * PARAMETERS: yytext - Contains the matched keyword.
512 * Type - Keyword/Character type:
513 * 0 = anything except a keyword
514 * 1 = pseudo-keywords
515 * 2 = non-executable ASL keywords
516 * 3 = executable ASL keywords
520 * DESCRIPTION: Count keywords and put them into the line buffer
522 ******************************************************************************/
535 AslGbl_TotalKeywords++;
536 AslGbl_TotalNamedObjects++;
541 AslGbl_TotalKeywords++;
542 AslGbl_TotalExecutableOpcodes++;
550 for (p = yytext; *p != '\0'; p++)
552 AslInsertLineBuffer (*p);
553 *AslGbl_LineBufPtr = 0;
558 /*******************************************************************************
560 * FUNCTION: AslDoComment
566 * DESCRIPTION: Process a standard comment.
568 ******************************************************************************/
576 char *StringBuffer = AslGbl_MsgBuffer;
577 char *EndBuffer = AslGbl_MsgBuffer + ASL_MSG_BUFFER_SIZE;
578 ASL_COMMENT_STATE CurrentState = AslGbl_CommentState; /* to reference later on */
581 AslInsertLineBuffer ('/');
582 AslInsertLineBuffer ('*');
583 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
593 /* Eat chars until end-of-comment */
595 while (((c = input ()) != '*') && (c != EOF))
597 AslInsertLineBuffer (c);
598 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
612 * Check for nested comment -- can help catch cases where a previous
613 * comment was accidently left unterminated
615 if ((c1 == '/') && (c == '*'))
617 AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
618 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
619 AslGbl_InputByteCount, AslGbl_CurrentColumn,
620 AslGbl_Files[ASL_FILE_INPUT].Filename, NULL);
623 /* Comment is closed only if the NEXT character is a slash */
625 AslInsertLineBuffer (c);
626 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
632 if (((c1 = input ()) != '/') && (c1 != EOF))
642 if (StringBuffer > EndBuffer)
647 AslInsertLineBuffer (c1);
648 CvProcessComment (CurrentState, StringBuffer, c1);
654 * Premature End-Of-File
656 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
657 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
658 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
659 AslGbl_Files[ASL_FILE_INPUT].Filename, NULL);
665 /* Comment was too long */
667 AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
668 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
669 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
670 AslGbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
676 /*******************************************************************************
678 * FUNCTION: AslDoCommentType2
684 * DESCRIPTION: Process a new "//" comment. Inline comments will be converted
685 * to "/ *" standard comments.
687 ******************************************************************************/
694 char *StringBuffer = AslGbl_MsgBuffer;
695 char *EndBuffer = AslGbl_MsgBuffer + ASL_MSG_BUFFER_SIZE;
696 ASL_COMMENT_STATE CurrentState = AslGbl_CommentState;
699 AslInsertLineBuffer ('/');
701 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
703 AslInsertLineBuffer ('*');
711 AslInsertLineBuffer ('/');
714 while (((c = input ()) != '\n') && (c != EOF))
716 AslInsertLineBuffer (c);
717 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
726 /* End of file is OK, change to newline. Let parser detect EOF later */
731 if (StringBuffer > EndBuffer)
735 AslInsertLineBuffer (c);
737 CvProcessCommentType2 (CurrentState, StringBuffer);
743 /* Comment was too long */
745 AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
746 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
747 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
748 AslGbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
754 /*******************************************************************************
756 * FUNCTION: AslDoStringLiteral
762 * DESCRIPTION: Process a string literal (surrounded by quotes)
764 ******************************************************************************/
770 char *StringBuffer = AslGbl_MsgBuffer;
771 char *EndBuffer = AslGbl_MsgBuffer + ASL_MSG_BUFFER_SIZE;
774 UINT32 State = ASL_NORMAL_CHAR;
777 char ConvertBuffer[4];
781 * Eat chars until end-of-literal.
782 * NOTE: Put back the original surrounding quotes into the
783 * source line buffer.
785 AslInsertLineBuffer ('\"');
786 while ((StringChar = input()) != EOF)
788 AslInsertLineBuffer (StringChar);
793 case ASL_NORMAL_CHAR:
799 * Special handling for backslash-escape sequence. We will
800 * toss the backslash and translate the escape char(s).
802 State = ASL_ESCAPE_SEQUENCE;
807 /* String terminator */
809 goto CompletedString;
818 case ASL_ESCAPE_SEQUENCE:
820 State = ASL_NORMAL_CHAR;
825 StringChar = 0x07; /* BELL */
830 StringChar = 0x08; /* BACKSPACE */
835 StringChar = 0x0C; /* FORMFEED */
840 StringChar = 0x0A; /* LINEFEED */
845 StringChar = 0x0D; /* CARRIAGE RETURN*/
850 StringChar = 0x09; /* HORIZONTAL TAB */
855 StringChar = 0x0B; /* VERTICAL TAB */
860 State = ASL_HEX_CONSTANT;
864 case '\'': /* Single Quote */
865 case '\"': /* Double Quote */
866 case '\\': /* Backslash */
872 /* Check for an octal digit (0-7) */
874 if (ACPI_IS_OCTAL_DIGIT (StringChar))
876 State = ASL_OCTAL_CONSTANT;
877 ConvertBuffer[0] = StringChar;
882 /* Unknown escape sequence issue warning, but use the character */
884 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
885 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
886 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
887 AslGbl_Files[ASL_FILE_INPUT].Filename, NULL);
893 case ASL_OCTAL_CONSTANT:
895 /* Up to three octal digits allowed */
897 if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
901 * Reached end of the constant. Convert the assembled ASCII
902 * string and resume processing of the next character
904 ConvertBuffer[i] = 0;
905 Digit = (UINT8) strtoul (ConvertBuffer, NULL, 8);
907 /* Check for NULL or non-ascii character (ignore if so) */
909 if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
911 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
912 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
913 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
914 AslGbl_Files[ASL_FILE_INPUT].Filename, NULL);
918 *StringBuffer = (char) Digit;
920 if (StringBuffer >= EndBuffer)
926 State = ASL_NORMAL_CHAR;
931 /* Append another digit of the constant */
933 ConvertBuffer[i] = StringChar;
937 case ASL_HEX_CONSTANT:
939 /* Up to two hex digits allowed */
941 if (!isxdigit (StringChar) ||
945 * Reached end of the constant. Convert the assembled ASCII
946 * string and resume processing of the next character
948 ConvertBuffer[i] = 0;
949 Digit = (UINT8) strtoul (ConvertBuffer, NULL, 16);
951 /* Check for NULL or non-ascii character (ignore if so) */
953 if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
955 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
956 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
957 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
958 AslGbl_Files[ASL_FILE_INPUT].Filename, NULL);
962 *StringBuffer = (char) Digit;
964 if (StringBuffer >= EndBuffer)
970 State = ASL_NORMAL_CHAR;
975 /* Append another digit of the constant */
977 ConvertBuffer[i] = StringChar;
986 /* Save the finished character */
988 *StringBuffer = StringChar;
990 if (StringBuffer >= EndBuffer)
997 * Premature End-Of-File
999 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
1000 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
1001 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
1002 AslGbl_Files[ASL_FILE_INPUT].Filename, NULL);
1008 * Null terminate the input string and copy string to a new buffer
1012 CleanString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1);
1013 strcpy (CleanString, AslGbl_MsgBuffer);
1014 AslCompilerlval.s = CleanString;
1020 /* Literal was too long */
1022 AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
1023 AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber,
1024 AslGbl_CurrentLineOffset, AslGbl_CurrentColumn,
1025 AslGbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");