Script Engine code generator.
527{
532
539
540
541
542
544 OperatorSymbol =
ToSymbol(Operator, Error);
545
546#ifdef _SCRIPT_ENGINE_CODEGEN_DBG_EN
547
548
549
550 printf("Operator :\n");
552 printf("\n");
553
554 printf("Semantic Stack:\n");
556 printf("\n");
557
558 printf("Code Buffer:\n");
560 printf(".\n.\n.\n\n");
561#endif
562
564 {
566 {
569 Push(MatchedStack, PToken);
570 }
571 else if (!strcmp(Operator->
Value,
"@START_OF_USER_DEFINED_FUNCTION"))
572 {
573 Op0 =
Pop(MatchedStack);
575
577 {
579 break;
580 }
581
582
583
584
590
591
592
593
594
597 JumpAddressSymbol->
Value = 0xffffffffffffffff;
600
601 if (!*UserDefinedFunctionHead)
602 {
605 CurrentUserDefinedFunction = *UserDefinedFunctionHead;
606 }
607 else
608 {
611 {
613 }
616 CurrentUserDefinedFunction = Node->
NextNode;
617 }
618
619 CurrentUserDefinedFunction->
Name = _strdup(Op0->
Value);
621 CurrentUserDefinedFunction->
Address = CurrentPointer;
622 CurrentUserDefinedFunction->
VariableType = (
long long unsigned)VariableType;
623
624
625
626
632
635 TempSymbol->
Value = 0;
638
639
640
641
647
650 TempSymbol->
Value = 0;
653
656 TempSymbol->
Value = 0;
659
660
661
662
668
671 TempSymbol->
Value = 0xffffffffffffffff;
674
677 TempSymbol->
Value = 0;
680
683 TempSymbol->
Value = 0;
686 }
687 else if (!strcmp(Operator->
Value,
"@FUNCTION_PARAMETER"))
688 {
689 Op0 =
Pop(MatchedStack);
691
693 {
695 break;
696 }
697
699 free((
void *)Op0Symbol->
Value);
702
704 {
706 }
709 }
710 else if (!strcmp(Operator->
Value,
"@END_OF_USER_DEFINED_FUNCTION"))
711 {
714
715 if (!CurrentUserDefinedFunction)
716 {
718 break;
719 }
720 long long unsigned StackTempNumber = 0;
721 for (
UINT64 i = CurrentUserDefinedFunction->
Address; i < CurrentPointer; i++)
722 {
723 Symbol = CodeBuffer->
Head + i;
725 {
726 StackTempNumber = Symbol->
Value + 1;
727 }
728 }
729
730 Symbol = CodeBuffer->
Head + CurrentUserDefinedFunction->
Address + 6;
732
733
734
735
736 for (
UINT64 i = CurrentUserDefinedFunction->
Address; i < CurrentPointer; i++)
737 {
738 Symbol = CodeBuffer->
Head + i;
740 {
741 (CodeBuffer->
Head + i + 1)->
Value = CurrentPointer;
742 i++;
743 }
744 }
745
746
747
748
754
757 TempSymbol->
Value = 0;
760
763 TempSymbol->
Value = 0;
766
767
768
769
775
778 TempSymbol->
Value = 0;
781
787
788 Symbol = CodeBuffer->
Head + CurrentUserDefinedFunction->
Address - 1;
790
792
793 CurrentUserDefinedFunction =
NULL;
794 }
795 else if (!strcmp(Operator->
Value,
"@RETURN_OF_USER_DEFINED_FUNCTION_WITHOUT_VALUE"))
796 {
797 if (!CurrentUserDefinedFunction)
798 {
800 break;
801 }
803 {
805 break;
806 }
807
808
809
810
816
819 Symbol->
Value = 0xfffffffffffffff0;
822 }
823 else if (!strcmp(Operator->
Value,
"@RETURN_OF_USER_DEFINED_FUNCTION_WITH_VALUE"))
824 {
825 if (!CurrentUserDefinedFunction)
826 {
828 break;
829 }
831 {
833 break;
834 }
835
836
837
838
844
845 Op0 =
Pop(MatchedStack);
849
855
856
857
858
864
867 Symbol->
Value = 0xfffffffffffffff0;
870
872 {
873 break;
874 }
875 }
876
877 else if (!strcmp(Operator->
Value,
"@CALL_USER_DEFINED_FUNCTION"))
878 {
879 PTOKEN FunctionToken =
Top(MatchedStack);
881
883 while (Node)
884 {
885 if (!strcmp((
const char *)FunctionToken->
Value, Node->
Name))
886 {
888 break;
889 }
891 }
892
893 if (!Found)
894 {
896 break;
897 }
898
900 }
901 else if (!strcmp(Operator->
Value,
"@CALL_USER_DEFINED_FUNCTION_PARAMETER"))
902 {
903
905
911
915 {
916 break;
917 }
918 }
919 else if (!strcmp(Operator->
Value,
"@END_OF_CALLING_USER_DEFINED_FUNCTION_WITHOUT_RETURNING_VALUE") || !strcmp(Operator->
Value,
"@END_OF_CALLING_USER_DEFINED_FUNCTION_WITH_RETURNING_VALUE"))
920 {
922 int TargetFunctionVariableNum = 0;
923 int VariableNum = 0;
927
928 while (MatchedStack->
Pointer > 0)
929 {
930 FunctionToken =
Pop(MatchedStack);
931
933 {
934 break;
935 }
936 else
937 {
938 VariableNum++;
939
940 }
941 }
942
944 while (Node)
945 {
946 if (!strcmp((
const char *)FunctionToken->
Value, Node->
Name))
947 {
949 break;
950 }
952 }
953
954 if (!Found)
955 {
957 break;
958 }
959
961 {
963 break;
964 }
965
972
978
984
990
995
1000
1001 if (!strcmp(Operator->
Value,
"@END_OF_CALLING_USER_DEFINED_FUNCTION_WITH_RETURNING_VALUE"))
1002 {
1004 {
1006 break;
1007 }
1008
1009
1010
1011
1012 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
1013 Push(MatchedStack, Temp);
1014
1020
1026
1027 TempSymbol =
ToSymbol(Temp, Error);
1029
1031 {
1032 break;
1033 }
1034 }
1035
1037 }
1038 else if (!strcmp(Operator->
Value,
"@MOV"))
1039 {
1041 Op0 =
Pop(MatchedStack);
1043
1044 Op1 =
Pop(MatchedStack);
1046 {
1048 free((
void *)Op1Symbol->
Value);
1051 }
1053 {
1055 free((
void *)Op1Symbol->
Value);
1058 }
1059 else
1060 {
1062 }
1063
1064 if (MatchedStack->
Pointer > 0)
1065 {
1067 {
1069
1071 {
1073 break;
1074 }
1075
1076 Op1Symbol->
VariableType = (
unsigned long long)VariableType;
1077 }
1078 }
1079
1082
1083
1084
1085
1089 {
1090 break;
1091 }
1092 }
1094 {
1096 Op0 =
Pop(MatchedStack);
1098
1101 {
1102 break;
1103 }
1104 }
1106 {
1108 Op0 =
Pop(MatchedStack);
1110
1111 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
1112 Push(MatchedStack, Temp);
1113 TempSymbol =
ToSymbol(Temp, Error);
1114
1117
1120 {
1121 break;
1122 }
1123 }
1125 {
1129 do
1130 {
1131 if (Op1)
1132 {
1134 }
1135 Op1 =
Pop(MatchedStack);
1137 {
1139
1143
1144 OperandCount++;
1146 {
1148 break;
1149 }
1150 }
1151
1153
1155 {
1156 break;
1157 }
1158 Op0 =
Pop(MatchedStack);
1161
1162 char * Format = Op0->
Value;
1163
1166 OperandCountSymbol->
Value = OperandCount;
1167
1170
1173 {
1175 break;
1176 }
1177
1178 unsigned int FirstArgPointer = CodeBuffer->
Pointer;
1179
1181 unsigned int ArgCount = TempStack->
Pointer;
1182 for (
int i = TempStack->
Pointer - 1; i >= 0; i--)
1183 {
1184 Symbol = TempStack->
Head + i;
1186 }
1188 (
unsigned long long)(FirstArgPointer *
sizeof(
SYMBOL)));
1190
1192 char * Str = Format;
1193 do
1194 {
1195
1196
1197
1198 if (*Str == '%')
1199 {
1200 CHAR Temp = *(Str + 1);
1201
1202 if (Temp == 'd' || Temp == 'i' || Temp == 'u' || Temp == 'o' ||
1203 Temp == 'x' || Temp == 'c' || Temp == 'p' || Temp == 's' ||
1204
1205 !strncmp(Str, "%ws", 3) || !strncmp(Str, "%ls", 3) ||
1206
1207 !strncmp(Str, "%ld", 3) || !strncmp(Str, "%li", 3) ||
1208 !strncmp(Str, "%lu", 3) || !strncmp(Str, "%lo", 3) ||
1209 !strncmp(Str, "%lx", 3) ||
1210
1211 !strncmp(Str, "%hd", 3) || !strncmp(Str, "%hi", 3) ||
1212 !strncmp(Str, "%hu", 3) || !strncmp(Str, "%ho", 3) ||
1213 !strncmp(Str, "%hx", 3) ||
1214
1215 !strncmp(Str, "%lld", 4) || !strncmp(Str, "%lli", 4) ||
1216 !strncmp(Str, "%llu", 4) || !strncmp(Str, "%llo", 4) ||
1217 !strncmp(Str, "%llx", 4)
1218
1219 )
1220 {
1221 if (i < ArgCount)
1222 {
1223 Symbol = FirstArg + i;
1224 }
1225 else
1226 {
1228 break;
1229 }
1230 Symbol->
Type &= 0xffffffff;
1231 Symbol->
Type |= (
UINT64)(Str - Format - 1) << 32;
1232 i++;
1233 }
1234 }
1235 Str++;
1236 } while (*Str);
1237 if (i != ArgCount)
1238 {
1240 }
1241
1243 {
1244 break;
1245 }
1246 }
1248 {
1250 }
1251 else if (!strcmp(Operator->
Value,
"@IGNORE_LVALUE"))
1252 {
1253 Op0 =
Pop(MatchedStack);
1254 }
1256 {
1258 Op0 =
Pop(MatchedStack);
1260
1261 Op1 =
Pop(MatchedStack);
1263
1267 {
1268 break;
1269 }
1270
1271 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
1272 Push(MatchedStack, Temp);
1273 TempSymbol =
ToSymbol(Temp, Error);
1275
1276
1277
1278
1281 }
1283 {
1285 Op0 =
Pop(MatchedStack);
1287
1288 Op1 =
Pop(MatchedStack);
1290
1294 {
1295 break;
1296 }
1297
1298
1299
1302 }
1304 {
1306 Op0 =
Pop(MatchedStack);
1308
1309 Op1 =
Pop(MatchedStack);
1311
1312 Op2 =
Pop(MatchedStack);
1314
1318
1319 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
1320 Push(MatchedStack, Temp);
1321 TempSymbol =
ToSymbol(Temp, Error);
1323
1325
1326
1327
1328
1332 {
1333 break;
1334 }
1335 }
1337 {
1339 Op0 =
Pop(MatchedStack);
1341
1342 Op1 =
Pop(MatchedStack);
1344
1345 Op2 =
Pop(MatchedStack);
1347
1352 {
1353 break;
1354 }
1355
1356
1357
1361 }
1363 {
1365 Op0 =
Pop(MatchedStack);
1367
1368 Op1 =
Pop(MatchedStack);
1370
1371 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
1372 Push(MatchedStack, Temp);
1373 TempSymbol =
ToSymbol(Temp, Error);
1374
1378
1379
1380
1381
1385 {
1386 break;
1387 }
1388 }
1390 {
1392 Op0 =
Pop(MatchedStack);
1394
1396
1397
1398
1399
1402 {
1403 break;
1404 }
1405 }
1406 else if (!strcmp(Operator->
Value,
"@VARGSTART"))
1407 {
1409 Push(MatchedStack, OperatorCopy);
1410 }
1411 else if (!strcmp(Operator->
Value,
"@START_OF_IF"))
1412 {
1414 Push(MatchedStack, OperatorCopy);
1415 }
1416 else if (!strcmp(Operator->
Value,
"@JZ"))
1417 {
1418
1420
1423 JumpAddressSymbol->
Value = 0xffffffffffffffff;
1426
1427 Op0 =
Pop(MatchedStack);
1429
1431
1432 char str[20] = {0};
1435 Push(MatchedStack, CurrentAddressToken);
1436
1439 {
1440 break;
1441 }
1442 }
1443 else if (!strcmp(Operator->
Value,
"@JMP_TO_END_AND_JZCOMPLETED"))
1444 {
1445
1446
1447
1449 PTOKEN JumpSemanticAddressToken =
Pop(MatchedStack);
1452 JumpAddressSymbol->
Value = CurrentPointer + 2;
1454
1455
1456
1457
1463
1464
1465
1466
1469 JumpAddressSymbol->
Value = 0xffffffffffffffff;
1472
1473
1474
1475
1476 char str[20] = {0};
1477 sprintf(str, "%llu", CurrentPointer);
1479 Push(MatchedStack, CurrentAddressToken);
1480 }
1481 else if (!strcmp(Operator->
Value,
"@END_OF_IF"))
1482 {
1484 PTOKEN JumpSemanticAddressToken =
Pop(MatchedStack);
1486 while (strcmp(JumpSemanticAddressToken->
Value,
"@START_OF_IF"))
1487 {
1489 JumpAddressSymbol = (
PSYMBOL)(CodeBuffer->
Head + JumpSemanticAddress + 1);
1490 JumpAddressSymbol->
Value = CurrentPointer;
1491
1493 JumpSemanticAddressToken =
Pop(MatchedStack);
1494 }
1496 }
1497 else if (!strcmp(Operator->
Value,
"@START_OF_WHILE"))
1498 {
1499
1500
1501
1503 Push(MatchedStack, OperatorCopy);
1504
1505 char str[20] = {0};
1508 Push(MatchedStack, CurrentAddressToken);
1509 }
1510 else if (!strcmp(Operator->
Value,
"@START_OF_WHILE_COMMANDS"))
1511 {
1514
1516 OperatorSymbol =
ToSymbol(JzToken, Error);
1518
1521 JumpAddressSymbol->
Value = 0xffffffffffffffff;
1522
1523 Op0 =
Pop(MatchedStack);
1525
1526 PTOKEN StartOfWhileToken =
Pop(MatchedStack);
1527
1528 char str[20];
1529 sprintf(str, "%llu", CurrentPointer + 1);
1531 Push(MatchedStack, CurrentAddressToken);
1532 Push(MatchedStack, StartOfWhileToken);
1533
1536
1538
1540
1543 {
1544 break;
1545 }
1546 }
1547 else if (!strcmp(Operator->
Value,
"@END_OF_WHILE"))
1548 {
1549
1550
1551
1557
1558
1559
1560
1561 PTOKEN JumpAddressToken =
Pop(MatchedStack);
1564
1568 {
1569 break;
1570 }
1571
1572
1573
1574
1575
1577
1578 do
1579 {
1581 JumpAddressToken =
Pop(MatchedStack);
1582 if (!strcmp(JumpAddressToken->
Value,
"@START_OF_WHILE"))
1583 {
1584 break;
1585 }
1587 JumpAddressSymbol = (
PSYMBOL)(CodeBuffer->
Head + JumpAddress);
1588 JumpAddressSymbol->
Value = CurrentPointer;
1589
1592 }
1593 else if (!strcmp(Operator->
Value,
"@START_OF_DO_WHILE"))
1594 {
1595
1596
1597
1599 Push(MatchedStack, OperatorCopy);
1600
1601 char str[20];
1604 Push(MatchedStack, CurrentAddressToken);
1605 }
1606 else if (!strcmp(Operator->
Value,
"@END_OF_DO_WHILE"))
1607 {
1608
1609
1610
1616
1617
1618
1619
1620 Op0 =
Pop(MatchedStack);
1622
1623
1624
1625
1626 PTOKEN JumpAddressToken =
Pop(MatchedStack);
1628
1630
1633
1635
1637
1639 {
1640 break;
1641 }
1642
1643
1644
1645
1646
1648
1649 do
1650 {
1652 JumpAddressToken =
Pop(MatchedStack);
1653 if (!strcmp(JumpAddressToken->
Value,
"@START_OF_DO_WHILE"))
1654 {
1655 break;
1656 }
1658
1659#ifdef _SCRIPT_ENGINE_LL1_DBG_EN
1660 printf("Jz Jump Address = %lld\n", JumpAddress);
1661#endif
1662 JumpAddressSymbol = (
PSYMBOL)(CodeBuffer->
Head + JumpAddress);
1663 JumpAddressSymbol->
Value = CurrentPointer;
1664
1667 }
1668 else if (!strcmp(Operator->
Value,
"@START_OF_FOR"))
1669 {
1670
1671
1672
1674 Push(MatchedStack, OperatorCopy);
1675
1676
1677
1678
1679 char str[20] = {0};
1682 Push(MatchedStack, CurrentAddressToken);
1683 }
1684 else if (!strcmp(Operator->
Value,
"@FOR_INC_DEC"))
1685 {
1686
1687
1688
1689
1690
1691
1692
1698
1699
1700
1701
1704 JnzAddressSymbol->
Value = 0xffffffffffffffff;
1707
1708
1709
1710
1711 Op0 =
Pop(MatchedStack);
1713
1716 {
1717 break;
1718 }
1719
1720
1721
1722
1723
1724
1725
1731
1732
1733
1734
1737 JumpAddressSymbol->
Value = 0xffffffffffffffff;
1740
1741
1742
1743
1744 PTOKEN StartOfForAddressToken =
Pop(MatchedStack);
1745
1746
1747
1748
1749 char str[20] = {0};
1752 Push(MatchedStack, CurrentAddressToken);
1753
1754
1755
1756
1757 Push(MatchedStack, StartOfForAddressToken);
1758 }
1759 else if (!strcmp(Operator->
Value,
"@START_OF_FOR_COMMANDS"))
1760 {
1761
1762
1763
1764
1765
1766
1767
1773
1774
1775
1776
1777 PTOKEN JumpAddressToken =
Pop(MatchedStack);
1779
1781
1786 {
1787 break;
1788 }
1789
1790
1791
1792
1794 JumpAddressToken =
Pop(MatchedStack);
1796
1797 JumpAddressSymbol = (
PSYMBOL)(CodeBuffer->
Head + JumpAddress - 1);
1798 JumpAddressSymbol->
Value = CurrentPointer;
1799
1800
1801
1802
1803 char str[20] = {0};
1804 sprintf(str, "%llu", JumpAddress - 4);
1806 Push(MatchedStack, JzAddressToken);
1807
1808
1809
1810
1812 Push(MatchedStack, IncDecToken);
1813
1814
1815
1816
1817 Push(MatchedStack, JumpAddressToken);
1818 }
1819 else if (!strcmp(Operator->
Value,
"@END_OF_FOR"))
1820 {
1821
1822
1823
1824
1825
1826
1827
1833
1834
1835
1836
1837 PTOKEN JumpAddressToken =
Pop(MatchedStack);
1839
1841
1845
1847 {
1848 break;
1849 }
1850
1851 JumpAddressToken =
Pop(MatchedStack);
1852
1853
1854
1855
1856
1858
1859 do
1860 {
1862 JumpAddressToken =
Pop(MatchedStack);
1863 if (!strcmp(JumpAddressToken->
Value,
"@START_OF_FOR"))
1864 {
1865 break;
1866 }
1867 else
1868 {
1870
1871 JumpAddressSymbol = (
PSYMBOL)(CodeBuffer->
Head + JumpAddress);
1872 JumpAddressSymbol->
Value = CurrentPointer;
1873 }
1874
1877 }
1878 else if (!strcmp(Operator->
Value,
"@BREAK"))
1879 {
1880
1881
1882
1883
1886 do
1887 {
1888 TempToken =
Pop(MatchedStack);
1889
1890 if ((!strcmp(TempToken->
Value,
"@START_OF_FOR")) ||
1891 (!strcmp(TempToken->
Value,
"@START_OF_WHILE")) ||
1892 (!strcmp(TempToken->
Value,
"@START_OF_DO_WHILE")))
1893 {
1894
1895
1896
1897 Push(MatchedStack, TempToken);
1898
1899
1900
1901
1902
1904 char str[20];
1905 sprintf(str, "%llu", CurrentPointer);
1907 Push(MatchedStack, CurrentAddressToken);
1908
1909
1910
1911
1912
1913
1914
1915
1921
1922
1923
1924
1927 JumpAddressSymbol->
Value = 0xffffffffffffffff;
1930
1931
1932
1933
1934 do
1935 {
1936 TempToken =
Pop(TempStack);
1937 Push(MatchedStack, TempToken);
1938
1939 }
while (TempStack->
Pointer != 0);
1940 break;
1941 }
1942 else if (MatchedStack->
Pointer == 0)
1943 {
1946 break;
1947 }
1948 else
1949 {
1950 Push(TempStack, TempToken);
1951 }
1952
1955 }
1956 else if (!strcmp(Operator->
Value,
"@CONTINUE"))
1957 {
1958
1959
1960
1963 do
1964 {
1965 TempToken =
Pop(MatchedStack);
1966
1967 if (!strcmp(TempToken->
Value,
"@INC_DEC"))
1968 {
1969
1970
1971
1972 Push(MatchedStack, TempToken);
1973
1974
1975
1976
1982
1983
1984
1985
1986 TempToken =
Pop(TempStack);
1987 Push(MatchedStack, TempToken);
1988
1994
1995
1996
1997
1998 do
1999 {
2000 TempToken =
Pop(TempStack);
2001 Push(MatchedStack, TempToken);
2002
2003 }
while (TempStack->
Pointer != 0);
2004 break;
2005 }
2006 else if (MatchedStack->
Pointer == 0)
2007 {
2009 break;
2010 }
2011 else
2012 {
2013 Push(TempStack, TempToken);
2014 }
2015
2017
2019 }
2021 {
2023 Op0 =
Pop(MatchedStack);
2025
2026 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
2027 Push(MatchedStack, Temp);
2028 TempSymbol =
ToSymbol(Temp, Error);
2029
2032
2035 {
2036 break;
2037 }
2038 }
2040 {
2042 Op0 =
Pop(MatchedStack);
2044
2045 Op1 =
Pop(MatchedStack);
2047
2051 {
2052 break;
2053 }
2054
2055 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
2056 Push(MatchedStack, Temp);
2057 TempSymbol =
ToSymbol(Temp, Error);
2059
2060
2061
2062
2065 }
2067 {
2069 Op0 =
Pop(MatchedStack);
2071
2072 Op1 =
Pop(MatchedStack);
2074
2075 Op2 =
Pop(MatchedStack);
2077
2081
2082 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
2083 Push(MatchedStack, Temp);
2084 TempSymbol =
ToSymbol(Temp, Error);
2086
2087
2088
2089
2094 {
2095 break;
2096 }
2097 }
2099 {
2101 Op0 =
Pop(MatchedStack);
2103
2104 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
2105 Push(MatchedStack, Temp);
2106 TempSymbol =
ToSymbol(Temp, Error);
2107
2110
2113 {
2114 break;
2115 }
2116 }
2118 {
2120 Op0 =
Pop(MatchedStack);
2122
2123 Op1 =
Pop(MatchedStack);
2125
2129 {
2130 break;
2131 }
2132
2133 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
2134 Push(MatchedStack, Temp);
2135 TempSymbol =
ToSymbol(Temp, Error);
2137
2138
2139
2140
2143 }
2144
2146 {
2148 Op0 =
Pop(MatchedStack);
2150
2151 Op1 =
Pop(MatchedStack);
2153
2154 Op2 =
Pop(MatchedStack);
2156
2160
2161 Temp =
NewTemp(Error, CurrentUserDefinedFunction);
2162 Push(MatchedStack, Temp);
2163 TempSymbol =
ToSymbol(Temp, Error);
2165
2166
2167
2168
2173 {
2174 break;
2175 }
2176 }
2177 else
2178 {
2180 }
2181 break;
2182 }
2183
2184#ifdef _SCRIPT_ENGINE_CODEGEN_DBG_EN
2185
2186
2187
2188 printf("Semantic Stack:\n");
2190 printf("\n");
2191
2192 printf("Code Buffer:\n");
2194 printf("------------------------------------------\n\n");
2195#endif
2196
2197 if (Op0)
2199
2200 if (Op1)
2202
2203 if (Op2)
2205
2207
2208 if (Op0Symbol)
2210
2211 if (Op1Symbol)
2213
2214 if (Op2Symbol)
2216
2217 if (TempSymbol)
2219
2220 return;
2221}
int BOOL
Definition BasicTypes.h:23
#define TRUE
Definition BasicTypes.h:55
unsigned int UINT32
Definition BasicTypes.h:48
char CHAR
Definition BasicTypes.h:31
#define SYMBOL_STACK_INDEX_TYPE
Definition ScriptEngineCommonDefinitions.h:69
#define SYMBOL_STACK_TEMP_TYPE
Definition ScriptEngineCommonDefinitions.h:67
#define FUNC_CALL
Definition ScriptEngineCommonDefinitions.h:142
#define SYMBOL_GLOBAL_ID_TYPE
Definition ScriptEngineCommonDefinitions.h:54
#define SYMBOL_LOCAL_ID_TYPE
Definition ScriptEngineCommonDefinitions.h:55
#define SYMBOL_FUNCTION_PARAMETER_ID_TYPE
Definition ScriptEngineCommonDefinitions.h:65
#define FUNC_JMP
Definition ScriptEngineCommonDefinitions.h:123
#define FUNC_MOV
Definition ScriptEngineCommonDefinitions.h:131
#define FUNC_SUB
Definition ScriptEngineCommonDefinitions.h:112
#define FUNC_POP
Definition ScriptEngineCommonDefinitions.h:141
#define SYMBOL_STACK_BASE_INDEX_TYPE
Definition ScriptEngineCommonDefinitions.h:70
#define SYMBOL_VARIABLE_COUNT_TYPE
Definition ScriptEngineCommonDefinitions.h:62
#define FUNC_RET
Definition ScriptEngineCommonDefinitions.h:143
#define FUNC_PUSH
Definition ScriptEngineCommonDefinitions.h:140
#define FUNC_ADD
Definition ScriptEngineCommonDefinitions.h:111
#define FUNC_JZ
Definition ScriptEngineCommonDefinitions.h:124
#define SYMBOL_SEMANTIC_RULE_TYPE
Definition ScriptEngineCommonDefinitions.h:59
#define SYMBOL_RETURN_VALUE_TYPE
Definition ScriptEngineCommonDefinitions.h:71
#define SYMBOL_NUM_TYPE
Definition ScriptEngineCommonDefinitions.h:56
#define FUNC_JNZ
Definition ScriptEngineCommonDefinitions.h:125
RequestedActionOfThePacket Value(0x1) 00000000
NULL()
Definition test-case-generator.py:530
char IsType6Func(PTOKEN Operator)
Checks whether this Token type is TwoOpFunc1.
Definition common.c:858
PTOKEN Pop(PTOKEN_LIST TokenList)
Removes last Token of a TokenList and returns it.
Definition common.c:485
PTOKEN Top(PTOKEN_LIST TokenList)
Returns last Token of a TokenList.
Definition common.c:506
char IsType2Func(PTOKEN Operator)
Checks whether this Token type is OneOpFunc2.
Definition common.c:758
char IsType10Func(PTOKEN Operator)
Checks whether this Token type is TwoOpFunc3.
Definition common.c:938
char IsType1Func(PTOKEN Operator)
Checks whether this Token type is OneOpFunc1.
Definition common.c:738
char IsType9Func(PTOKEN Operator)
Checks whether this Token type is OneOpFunc3.
Definition common.c:918
char IsType11Func(PTOKEN Operator)
Checks whether this Token type is ThreeOpFunc3.
Definition common.c:958
void PrintTokenList(PTOKEN_LIST TokenList)
Prints each Token inside a TokenList.
Definition common.c:406
char IsType4Func(PTOKEN Operator)
Checks whether this Token type is VarArgFunc1.
Definition common.c:818
char IsType15Func(PTOKEN Operator)
Checks whether this Token type is ThreeOpFunc4.
Definition common.c:1038
void SetType(unsigned long long *Val, unsigned char Type)
Set the Type object.
Definition common.c:1381
char IsOneOperandOperator(PTOKEN Operator)
Checks whether this Token type is OperatorsOneOperandList.
Definition common.c:798
void FreeTemp(PTOKEN Temp)
Frees the memory allocated by Temp.
Definition common.c:691
char IsType12Func(PTOKEN Operator)
Checks whether this Token type is OneOpFunc4.
Definition common.c:978
void RemoveTokenList(PTOKEN_LIST TokenList)
Removes allocated memory of a TOKEN_LIST.
Definition common.c:386
char IsType8Func(PTOKEN Operator)
Checks whether this Token type is ThreeOpFunc1.
Definition common.c:898
unsigned long long DecimalToInt(char *str)
Converts an decimal string to a integer.
Definition common.c:1393
void RemoveToken(PTOKEN *Token)
Removes allocated memory of a token.
Definition common.c:104
PTOKEN NewTemp(PSCRIPT_ENGINE_ERROR_TYPE Error, PUSER_DEFINED_FUNCTION_NODE CurrentFunctionSymbol)
Allocates a new temporary variable and returns it.
Definition common.c:621
PTOKEN_LIST Push(PTOKEN_LIST TokenList, PTOKEN Token)
Adds Token to the last empty position of TokenList.
Definition common.c:424
char IsType13Func(PTOKEN Operator)
Checks whether this Token type is TwoOpFunc4.
Definition common.c:998
PTOKEN CopyToken(PTOKEN Token)
Copies a PTOKEN.
Definition common.c:312
char IsVariableType(PTOKEN Operator)
Checks whether this Token type is VariableType.
Definition common.c:1059
char IsType14Func(PTOKEN Operator)
Checks whether this Token type is ThreeOpFunc2.
Definition common.c:1018
char IsType5Func(PTOKEN Operator)
Checks whether this Token type is ZeroOpFunc1.
Definition common.c:838
void CleanStackTempList(void)
Resets the stack temporary variables map.
Definition common.c:723
PTOKEN NewToken(TOKEN_TYPE Type, char *Value)
Definition common.c:60
char IsType7Func(PTOKEN Operator)
Checks whether this Token type is TwoOpFunc2.
Definition common.c:878
char IsTwoOperandOperator(PTOKEN Operator)
Checks whether this Token type is OperatorsTwoOperandList.
Definition common.c:778
PTOKEN_LIST NewTokenList(void)
Definition common.c:349
void PrintToken(PTOKEN Token)
Prints token @detail prints value and type of token.
Definition common.c:119
PSYMBOL_BUFFER PushSymbol(PSYMBOL_BUFFER SymbolBuffer, const PSYMBOL Symbol)
Gets a symbol and push it into the symbol buffer.
Definition script-engine.c:2742
void PrintSymbolBuffer(const PVOID SymbolBuffer)
Prints a symbol buffer.
Definition script-engine.c:2859
int NewGlobalIdentifier(PTOKEN Token)
Allocates a new global variable and returns the integer assigned to it.
Definition script-engine.c:3180
PSYMBOL ToSymbol(PTOKEN Token, PSCRIPT_ENGINE_ERROR_TYPE Error)
Converts Token to Symbol and returns the reference to it.
Definition script-engine.c:2612
PSYMBOL NewSymbol(void)
Allocates a new SYMBOL and returns the reference to it.
Definition script-engine.c:2460
int NewLocalIdentifier(PTOKEN Token)
Allocates a new local variable and returns the integer assigned to it.
Definition script-engine.c:3194
int NewFunctionParameterIdentifier(PTOKEN Token)
Definition script-engine.c:3208
void RemoveSymbolBuffer(PVOID SymbolBuffer)
Frees the memory allocated by SymbolBuffer.
Definition script-engine.c:2725
void RemoveSymbol(PSYMBOL *Symbol)
Frees the memory allocate by this Symbol.
Definition script-engine.c:2561
PSYMBOL_BUFFER NewSymbolBuffer(void)
allocates a new Symbol Buffer and returns the reference to it
Definition script-engine.c:2699
this structure is a dynamic container of TOKENS
Definition common.h:83
unsigned int Pointer
Definition common.h:85
read tokens from input stored in this structure
Definition common.h:72
TOKEN_TYPE Type
Definition common.h:73
Definition ScriptEngineCommonDefinitions.h:21
unsigned int Pointer
Definition ScriptEngineCommonDefinitions.h:23
PSYMBOL Head
Definition ScriptEngineCommonDefinitions.h:22
Definition ScriptEngineCommonDefinitions.h:6
long long unsigned Value
Definition ScriptEngineCommonDefinitions.h:10
long long unsigned VariableType
Definition ScriptEngineCommonDefinitions.h:9
long long unsigned Type
Definition ScriptEngineCommonDefinitions.h:7
Definition ScriptEngineCommonDefinitions.h:43
long long unsigned ParameterNumber
Definition ScriptEngineCommonDefinitions.h:48
long long unsigned StackTempNumber
Definition ScriptEngineCommonDefinitions.h:49
char * Name
Definition ScriptEngineCommonDefinitions.h:44
struct USER_DEFINED_FUNCTION_NODE * NextNode
Definition ScriptEngineCommonDefinitions.h:50
long long unsigned Address
Definition ScriptEngineCommonDefinitions.h:45
long long unsigned VariableType
Definition ScriptEngineCommonDefinitions.h:46
PSYMBOL_BUFFER ParameterBuffer
Definition ScriptEngineCommonDefinitions.h:47
VARIABLE_TYPE * HandleType(PTOKEN_LIST PtokenStack)
Return a variable type.
Definition type.c:28
VARIABLE_TYPE * VARIABLE_TYPE_UNKNOWN
Definition type.c:3
VARIABLE_TYPE * VARIABLE_TYPE_VOID
Definition type.c:5