aslcompiler.l (151937) | aslcompiler.l (167802) |
---|---|
1 2%{ 3/****************************************************************************** 4 * 5 * Module Name: aslcompiler.l - Flex input file | 1 2%{ 3/****************************************************************************** 4 * 5 * Module Name: aslcompiler.l - Flex input file |
6 * $Revision: 1.74 $ | 6 * $Revision: 1.79 $ |
7 * 8 *****************************************************************************/ 9 10/****************************************************************************** 11 * 12 * 1. Copyright Notice 13 * | 7 * 8 *****************************************************************************/ 9 10/****************************************************************************** 11 * 12 * 1. Copyright Notice 13 * |
14 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. | 14 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. |
15 * All rights reserved. 16 * 17 * 2. License 18 * 19 * 2.1. This is your license from Intel Corp. under its intellectual property 20 * rights. You may have additional license terms from the party that provided 21 * you this software, covering your right to use that party's intellectual 22 * property rights. --- 551 unchanged lines hidden (view full) --- 574 575 /* Point the parser to the popped file */ 576 577 yy_delete_buffer (YY_CURRENT_BUFFER); 578 yy_switch_to_buffer (Fnode->State); 579 580 /* All done with this node */ 581 | 15 * All rights reserved. 16 * 17 * 2. License 18 * 19 * 2.1. This is your license from Intel Corp. under its intellectual property 20 * rights. You may have additional license terms from the party that provided 21 * you this software, covering your right to use that party's intellectual 22 * property rights. --- 551 unchanged lines hidden (view full) --- 574 575 /* Point the parser to the popped file */ 576 577 yy_delete_buffer (YY_CURRENT_BUFFER); 578 yy_switch_to_buffer (Fnode->State); 579 580 /* All done with this node */ 581 |
582 ACPI_MEM_FREE (Fnode); | 582 ACPI_FREE (Fnode); |
583 return 0; 584} 585 586 587/******************************************************************************* 588 * 589 * FUNCTION: AslPushInputFileStack 590 * --- 330 unchanged lines hidden (view full) --- 921#define ASL_NORMAL_CHAR 0 922#define ASL_ESCAPE_SEQUENCE 1 923#define ASL_OCTAL_CONSTANT 2 924#define ASL_HEX_CONSTANT 3 925 926char 927literal (void) 928{ | 583 return 0; 584} 585 586 587/******************************************************************************* 588 * 589 * FUNCTION: AslPushInputFileStack 590 * --- 330 unchanged lines hidden (view full) --- 921#define ASL_NORMAL_CHAR 0 922#define ASL_ESCAPE_SEQUENCE 1 923#define ASL_OCTAL_CONSTANT 2 924#define ASL_HEX_CONSTANT 3 925 926char 927literal (void) 928{ |
929 char *s = MsgBuffer; | 929 char *StringBuffer = MsgBuffer; 930 char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; |
930 char *CleanString; 931 char StringChar; 932 UINT32 State = ASL_NORMAL_CHAR; 933 UINT32 i = 0; 934 UINT8 Digit; | 931 char *CleanString; 932 char StringChar; 933 UINT32 State = ASL_NORMAL_CHAR; 934 UINT32 i = 0; 935 UINT8 Digit; |
935 UINT8 StringLength = 0; | |
936 char ConvertBuffer[4]; 937 938 939 /* 940 * Eat chars until end-of-literal. 941 * NOTE: Put back the original surrounding quotes into the 942 * source line buffer. 943 */ 944 InsertLineBuffer ('\"'); 945 while ((StringChar = (char) input()) != EOF) 946 { | 936 char ConvertBuffer[4]; 937 938 939 /* 940 * Eat chars until end-of-literal. 941 * NOTE: Put back the original surrounding quotes into the 942 * source line buffer. 943 */ 944 InsertLineBuffer ('\"'); 945 while ((StringChar = (char) input()) != EOF) 946 { |
947 StringLength++; 948 if (StringLength == ACPI_MAX_STRING_CONVERSION) 949 { 950 /* Emit error only once, but keep going */ 951 952 AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, 953 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 954 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 955 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 956 } 957 | |
958 InsertLineBuffer (StringChar); 959 960DoCharacter: 961 962 switch (State) 963 { 964 case ASL_NORMAL_CHAR: 965 --- 102 unchanged lines hidden (view full) --- 1068 { 1069 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, 1070 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1071 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1072 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1073 } 1074 else 1075 { | 947 InsertLineBuffer (StringChar); 948 949DoCharacter: 950 951 switch (State) 952 { 953 case ASL_NORMAL_CHAR: 954 --- 102 unchanged lines hidden (view full) --- 1057 { 1058 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, 1059 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1060 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1061 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1062 } 1063 else 1064 { |
1076 *s = (char) Digit; 1077 s++; | 1065 *StringBuffer = (char) Digit; 1066 StringBuffer++; 1067 if (StringBuffer >= EndBuffer) 1068 { 1069 goto BufferOverflow; 1070 } |
1078 } 1079 1080 State = ASL_NORMAL_CHAR; 1081 goto DoCharacter; 1082 break; 1083 } 1084 1085 /* Append another digit of the constant */ --- 23 unchanged lines hidden (view full) --- 1109 { 1110 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, 1111 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1112 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1113 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1114 } 1115 else 1116 { | 1071 } 1072 1073 State = ASL_NORMAL_CHAR; 1074 goto DoCharacter; 1075 break; 1076 } 1077 1078 /* Append another digit of the constant */ --- 23 unchanged lines hidden (view full) --- 1102 { 1103 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, 1104 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1105 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1106 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1107 } 1108 else 1109 { |
1117 *s = (char) Digit; 1118 s++; | 1110 *StringBuffer = (char) Digit; 1111 StringBuffer++; 1112 if (StringBuffer >= EndBuffer) 1113 { 1114 goto BufferOverflow; 1115 } |
1119 } 1120 1121 State = ASL_NORMAL_CHAR; 1122 goto DoCharacter; 1123 break; 1124 } 1125 1126 /* Append another digit of the constant */ 1127 1128 ConvertBuffer[i] = StringChar; 1129 i++; 1130 continue; 1131 } 1132 1133 /* Save the finished character */ 1134 | 1116 } 1117 1118 State = ASL_NORMAL_CHAR; 1119 goto DoCharacter; 1120 break; 1121 } 1122 1123 /* Append another digit of the constant */ 1124 1125 ConvertBuffer[i] = StringChar; 1126 i++; 1127 continue; 1128 } 1129 1130 /* Save the finished character */ 1131 |
1135 *s = StringChar; 1136 s++; | 1132 *StringBuffer = StringChar; 1133 StringBuffer++; 1134 if (StringBuffer >= EndBuffer) 1135 { 1136 goto BufferOverflow; 1137 } |
1137 } 1138 1139 /* 1140 * Premature End-Of-File 1141 */ 1142 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, 1143 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1144 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1145 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1146 return (FALSE); 1147 1148 1149CompletedString: 1150 /* 1151 * Null terminate the input string and copy string to a new buffer 1152 */ | 1138 } 1139 1140 /* 1141 * Premature End-Of-File 1142 */ 1143 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, 1144 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1145 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1146 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1147 return (FALSE); 1148 1149 1150CompletedString: 1151 /* 1152 * Null terminate the input string and copy string to a new buffer 1153 */ |
1153 *s = 0; | 1154 *StringBuffer = 0; |
1154 1155 CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1); 1156 if (!CleanString) 1157 { 1158 AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, 1159 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1160 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1161 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1162 return (FALSE); 1163 } 1164 1165 ACPI_STRCPY (CleanString, MsgBuffer); 1166 AslCompilerlval.s = CleanString; 1167 return (TRUE); | 1155 1156 CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1); 1157 if (!CleanString) 1158 { 1159 AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, 1160 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1161 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1162 Gbl_Files[ASL_FILE_INPUT].Filename, NULL); 1163 return (FALSE); 1164 } 1165 1166 ACPI_STRCPY (CleanString, MsgBuffer); 1167 AslCompilerlval.s = CleanString; 1168 return (TRUE); |
1169 1170 1171BufferOverflow: 1172 1173 /* Literal was too long */ 1174 1175 AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, 1176 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 1177 Gbl_CurrentLineOffset, Gbl_CurrentColumn, 1178 Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); 1179 return (FALSE); |
|
1168} 1169 1170 | 1180} 1181 1182 |