1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038
|
Description: Autogenerated patch header for a single-debian-patch file.
The delta against upstream is either kept as a single patch, or maintained
in some VCS, and exported as a single patch instead of more manageable
atomic patches.
Forwarded: not-needed
---
--- basic256-2.0.99.10.orig/BASIC256.pro
+++ basic256-2.0.99.10/BASIC256.pro
@@ -14,7 +14,7 @@ TARGET = basic256
DEPENDPATH += .
INCLUDEPATH += .
QMAKE_CXXFLAGS += -g
-QMAKE_CXXFLAGS += -std=c++11
+QMAKE_CXXFLAGS += -std=c++17
CONFIG += qt debug_and_release
CONFIG += console
OBJECTS_DIR = tmp/obj
@@ -27,6 +27,7 @@ QT += sql
QT += widgets
QT += printsupport
QT += serialport
+QT += multimedia
RESOURCES += resources/resource.qrc
TRANSLATIONS = Translations/basic256_en.ts \
--- basic256-2.0.99.10.orig/BasicDock.cpp
+++ basic256-2.0.99.10/BasicDock.cpp
@@ -17,8 +17,8 @@
#include <qglobal.h>
-#include <QtWidgets/QDockWidget>
-#include <QtWidgets/QAction>
+#include <QDockWidget>
+#include <QAction>
#include <QCloseEvent>
#include "BasicDock.h"
--- basic256-2.0.99.10.orig/BasicDock.h
+++ basic256-2.0.99.10/BasicDock.h
@@ -21,8 +21,8 @@
#include <qglobal.h>
-#include <QtWidgets/QDockWidget>
-#include <QtWidgets/QAction>
+#include <QDockWidget>
+#include <QAction>
#include <QCloseEvent>
--- basic256-2.0.99.10.orig/BasicDownloader.cpp
+++ basic256-2.0.99.10/BasicDownloader.cpp
@@ -39,7 +39,9 @@ void BasicDownloader::download(QUrl url)
inprogress = true;
QNetworkRequest request(url);
//compile with older Ot (for Linux users)
-#if QT_VERSION >= 0x050600
+#if QT_VERSION >= 0x060000
+ request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
+#elif QT_VERSION >= 0x050600
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
request.setHeader(QNetworkRequest::UserAgentHeader, "App/1.0");
@@ -57,7 +59,7 @@ void BasicDownloader::fileDownloaded(QNe
//qDebug() << "BasicDownloader fileDownloaded() attr:" << netreply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString() << "err:" << netreply->error();
if(netreply->error() != QNetworkReply::NoError) {
error->q(ERROR_DOWNLOAD, netreply->errorString());
- }else if(netreply->attribute(QNetworkRequest::HttpStatusCodeAttribute) >= 300) {
+ }else if(netreply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() >= 300) {
error->q(ERROR_DOWNLOAD, netreply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString());
}else{
m_data = netreply->readAll();
--- basic256-2.0.99.10.orig/BasicEdit.cpp
+++ basic256-2.0.99.10/BasicEdit.cpp
@@ -25,11 +25,11 @@
#include <QPainter>
#include <QResizeEvent>
#include <QPaintEvent>
-#include <QtWidgets/QMessageBox>
-#include <QtWidgets/QStatusBar>
-#include <QtPrintSupport/QPrinter>
-#include <QtPrintSupport/QPrintDialog>
-#include <QtWidgets/QFontDialog>
+#include <QMessageBox>
+#include <QStatusBar>
+#include <QPrinter>
+#include <QPrintDialog>
+#include <QFontDialog>
#include "MainWindow.h"
#include "BasicEdit.h"
@@ -40,8 +40,8 @@
extern int guiState;
BasicEdit::BasicEdit(const QString & defaulttitle) {
- currentLine = 1;
- runState = RUNSTATESTOP;
+ currentLine = 1;
+ runState = RUNSTATESTOP;
rightClickBlockNumber = -1;
breakPoints = new QList<int>;
title = defaulttitle;
@@ -85,36 +85,36 @@ BasicEdit::~BasicEdit() {
breakPoints = NULL;
}
if (lineNumberArea) {
- delete lineNumberArea;
- lineNumberArea = NULL;
- }
+ delete lineNumberArea;
+ lineNumberArea = NULL;
+ }
}
void BasicEdit::setFont(QFont f) {
- // set the font and the tab stop at EDITOR_TAB_WIDTH spaces
- QPlainTextEdit::setFont(f);
- QFontMetrics metrics(f);
- setTabStopWidth(metrics.width(" ")*EDITOR_TAB_WIDTH);
+ // set the font and the tab stop at EDITOR_TAB_WIDTH spaces
+ QPlainTextEdit::setFont(f);
+ QFontMetrics metrics(f);
+ setTabStopDistance(metrics.boundingRect(" ").width()*EDITOR_TAB_WIDTH);
updateLineNumberAreaWidth(blockCount());
}
void
BasicEdit::cursorMove() {
- QTextCursor t(textCursor());
- emit(changeStatusBar(tr("Line: ") + QString::number(t.blockNumber()+1)
- + tr(" Character: ") + QString::number(t.positionInBlock())));
+ QTextCursor t(textCursor());
+ emit(changeStatusBar(tr("Line: ") + QString::number(t.blockNumber()+1)
+ + tr(" Character: ") + QString::number(t.positionInBlock())));
}
void
BasicEdit::seekLine(int newLine) {
// go to a line number and set
- // the text cursor
- //
- // code should be proximal in that it should be closest to look at the curent
+ // the text cursor
+ //
+ // code should be proximal in that it should be closest to look at the curent
// position than to go and search the entire program from the top
QTextCursor t = textCursor();
- int line = t.blockNumber()+1; // current line number for the block
+ int line = t.blockNumber()+1; // current line number for the block
// go back or forward to the line from the current position
if (line<newLine) {
// advance forward
@@ -127,28 +127,28 @@ BasicEdit::seekLine(int newLine) {
line--;
}
}
- setTextCursor(t);
+ setTextCursor(t);
}
void BasicEdit::slotWhitespace(bool checked) {
- // toggle the display of whitespace characters
- // http://www.qtcentre.org/threads/27245-Printing-white-spaces-in-QPlainTextEdit-the-QtCreator-way
- QTextOption option = document()->defaultTextOption();
- if (checked) {
- option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
- } else {
- option.setFlags(option.flags() & ~QTextOption::ShowTabsAndSpaces);
- }
- option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
- document()->setDefaultTextOption(option);
+ // toggle the display of whitespace characters
+ // http://www.qtcentre.org/threads/27245-Printing-white-spaces-in-QPlainTextEdit-the-QtCreator-way
+ QTextOption option = document()->defaultTextOption();
+ if (checked) {
+ option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
+ } else {
+ option.setFlags(option.flags() & ~QTextOption::ShowTabsAndSpaces);
+ }
+ option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
+ document()->setDefaultTextOption(option);
}
void BasicEdit::slotWrap(bool checked) {
- if (checked) {
- setLineWrapMode(QPlainTextEdit::WidgetWidth);
- } else {
- setLineWrapMode(QPlainTextEdit::NoWrap);
- }
+ if (checked) {
+ setLineWrapMode(QPlainTextEdit::WidgetWidth);
+ } else {
+ setLineWrapMode(QPlainTextEdit::NoWrap);
+ }
}
void
@@ -160,61 +160,63 @@ BasicEdit::goToLine(int newLine) {
void
BasicEdit::keyPressEvent(QKeyEvent *e) {
- e->accept();
+ e->accept();
//Autoindent new line as previous one
- if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter){
- QPlainTextEdit::keyPressEvent(e);
- QTextCursor cur = textCursor();
- cur.movePosition(QTextCursor::PreviousBlock);
- cur.movePosition(QTextCursor::StartOfBlock);
- cur.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
- QString str = cur.selectedText();
- QRegExp rx("^([\\t ]+)");
- if(str.indexOf(rx) >= 0)
- textCursor().insertText(rx.cap(1));
- }else if(e->key() == Qt::Key_Tab && e->modifiers() == Qt::NoModifier){
- if(!indentSelection())
- QPlainTextEdit::keyPressEvent(e);
- }else if((e->key() == Qt::Key_Tab && e->modifiers() & Qt::ShiftModifier) || e->key() == Qt::Key_Backtab){
- unindentSelection();
- }else{
- QPlainTextEdit::keyPressEvent(e);
- }
+ if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter){
+ QPlainTextEdit::keyPressEvent(e);
+ QTextCursor cur = textCursor();
+ cur.movePosition(QTextCursor::PreviousBlock);
+ cur.movePosition(QTextCursor::StartOfBlock);
+ cur.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
+ QString str = cur.selectedText();
+ QRegularExpression rx("^([\\t ]+)");
+ QRegularExpressionMatch rxm = rx.match(str);
+ if(rxm.hasMatch())
+ textCursor().insertText(rxm.captured(1));
+ }else if(e->key() == Qt::Key_Tab && e->modifiers() == Qt::NoModifier){
+ if(!indentSelection())
+ QPlainTextEdit::keyPressEvent(e);
+ }else if((e->key() == Qt::Key_Tab && e->modifiers() & Qt::ShiftModifier) || e->key() == Qt::Key_Backtab){
+ unindentSelection();
+ }else{
+ QPlainTextEdit::keyPressEvent(e);
+ }
}
void BasicEdit::saveFile(bool overwrite) {
- // BE SURE TO SET filename PROPERTY FIRST
- // or set it to '' to prompt for a new file name
- if (filename == "") {
+ // BE SURE TO SET filename PROPERTY FIRST
+ // or set it to '' to prompt for a new file name
+ if (filename == "") {
emit(setCurrentEditorTab(this)); //activate editor window
filename = QFileDialog::getSaveFileName(this, tr("Save file as"), title+".kbs", tr("BASIC-256 File ") + "(*.kbs);;" + tr("Any File ") + "(*.*)");
- }
+ }
- if (filename != "") {
- QRegExp rx("\\.[^\\/]*$");
- if (rx.indexIn(filename) == -1) {
- filename += ".kbs";
- }
- QFile f(filename);
- bool dooverwrite = true;
- if (!overwrite && f.exists()) {
- dooverwrite = ( QMessageBox::Yes == QMessageBox::warning(this, tr("Save File"),
- tr("The file ") + filename + tr(" already exists.")+ "\n" +tr("Do you want to overwrite?"),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No));
- }
- if (dooverwrite) {
- f.open(QIODevice::WriteOnly | QIODevice::Truncate);
- f.write(this->document()->toPlainText().toUtf8());
- f.close();
- QFileInfo fi(f);
+ if (filename != "") {
+ QRegularExpression rx("\\.[^\\/]*$");
+ QRegularExpressionMatch rxm = rx.match(filename);
+ if (!rxm.hasMatch()) {
+ filename += ".kbs";
+ }
+ QFile f(filename);
+ bool dooverwrite = true;
+ if (!overwrite && f.exists()) {
+ dooverwrite = ( QMessageBox::Yes == QMessageBox::warning(this, tr("Save File"),
+ tr("The file ") + filename + tr(" already exists.")+ "\n" +tr("Do you want to overwrite?"),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No));
+ }
+ if (dooverwrite) {
+ f.open(QIODevice::WriteOnly | QIODevice::Truncate);
+ f.write(this->document()->toPlainText().toUtf8());
+ f.close();
+ QFileInfo fi(f);
document()->setModified(false);
setTitle(fi.fileName());
- QDir::setCurrent(fi.absolutePath());
+ QDir::setCurrent(fi.absolutePath());
emit(addFileToRecentList(filename));
- }
- }
+ }
+ }
}
void BasicEdit::saveAllStep(int s) {
@@ -276,139 +278,139 @@ void BasicEdit::slotPrint() {
void BasicEdit::beautifyProgram() {
- QString program;
- QStringList lines;
- int indent = 0;
- bool indentThisLine = true;
- bool increaseIndent = false;
- bool decreaseIndent = false;
- bool increaseIndentDouble = false;
- bool decreaseIndentDouble = false;
- QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- program = this->document()->toPlainText();
- lines = program.split(QRegExp("\\n"));
- for (int i = 0; i < lines.size(); i++) {
- QString line = lines.at(i);
- line = line.trimmed();
+ QString program;
+ QStringList lines;
+ int indent = 0;
+ bool indentThisLine = true;
+ bool increaseIndent = false;
+ bool decreaseIndent = false;
+ bool increaseIndentDouble = false;
+ bool decreaseIndentDouble = false;
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ program = this->document()->toPlainText();
+ lines = program.split(QRegularExpression("\\n"));
+ for (int i = 0; i < lines.size(); i++) {
+ QString line = lines.at(i);
+ line = line.trimmed();
if(line.isEmpty()){
// label - empty line no indent
indentThisLine = false;
- } else if (line.contains(QRegExp("^\\S+[:]"))) {
- // label - one line no indent
- indentThisLine = false;
- } else if (line.contains(QRegExp("^(for)|(foreach)\\s", Qt::CaseInsensitive))) {
- // for - indent next (block of code)
- increaseIndent = true;
- } else if (line.contains(QRegExp("^next(\\s)", Qt::CaseInsensitive))) {
- // next var - come out of block - reduce indent
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^next$", Qt::CaseInsensitive))) {
- // next - come out of block - reduce indent
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^if\\s.+\\sthen\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // if/then (NOTHING FOLLOWING) - indent next (block of code)
- increaseIndent = true;
- } else if (line.contains(QRegExp("^else\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // else - come out of block and start new block
- decreaseIndent = true;
- increaseIndent = true;
- } else if (line.contains(QRegExp("^end\\s*if\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // end if - come out of block - reduce indent
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^while\\s", Qt::CaseInsensitive))) {
- // while - indent next (block of code)
- increaseIndent = true;
- } else if (line.contains(QRegExp("^end\\s*while\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // endwhile - come out of block
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^function\\s", Qt::CaseInsensitive))) {
- // function - indent next (block of code)
- increaseIndent = true;
- } else if (line.contains(QRegExp("^end\\s*function\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // endfunction - come out of block
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^subroutine\\s", Qt::CaseInsensitive))) {
- // function - indent next (block of code)
- increaseIndent = true;
- } else if (line.contains(QRegExp("^end\\s*subroutine\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // endfunction - come out of block
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^do\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // do - indent next (block of code)
- increaseIndent = true;
- } else if (line.contains(QRegExp("^until\\s", Qt::CaseInsensitive))) {
- // until - come out of block
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^try\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // try indent next (block of code)
- increaseIndent = true;
- } else if (line.contains(QRegExp("^catch\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // catch - come out of block and start new block
- decreaseIndent = true;
- increaseIndent = true;
- } else if (line.contains(QRegExp("^end\\s*try\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // end try - come out of block - reduce indent
- decreaseIndent = true;
- } else if (line.contains(QRegExp("^begin\\s*case\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // begin case double indent next (block of code)
- increaseIndentDouble = true;
- } else if (line.contains(QRegExp("^end\\s*case\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // end case double reduce
- decreaseIndentDouble = true;
- } else if (line.contains(QRegExp("^case\\s.+\\s*((#|(rem\\s)).*)?$", Qt::CaseInsensitive))) {
- // case expression - indent one line
- decreaseIndent = true;
- increaseIndent = true;
- }
- //
- if (decreaseIndent) {
- indent--;
- if (indent<0) indent=0;
- decreaseIndent = false;
- }
- if (decreaseIndentDouble) {
- indent-=2;
- if (indent<0) indent=0;
- decreaseIndentDouble = false;
- }
- if (indentThisLine) {
- line = QString(indent, QChar('\t')) + line;
- } else {
- indentThisLine = true;
- }
- if (increaseIndent) {
- indent++;
- increaseIndent = false;
- }
- if (increaseIndentDouble) {
- indent+=2;
- increaseIndentDouble = false;
- }
- //
- lines.replace(i, line);
- }
+ } else if (line.contains(QRegularExpression("^\\S+[:]"))) {
+ // label - one line no indent
+ indentThisLine = false;
+ } else if (line.contains(QRegularExpression("^(for)|(foreach)\\s", QRegularExpression::CaseInsensitiveOption))) {
+ // for - indent next (block of code)
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^next(\\s)", QRegularExpression::CaseInsensitiveOption))) {
+ // next var - come out of block - reduce indent
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^next$", QRegularExpression::CaseInsensitiveOption))) {
+ // next - come out of block - reduce indent
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^if\\s.+\\sthen\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // if/then (NOTHING FOLLOWING) - indent next (block of code)
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^else\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // else - come out of block and start new block
+ decreaseIndent = true;
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^end\\s*if\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // end if - come out of block - reduce indent
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^while\\s", QRegularExpression::CaseInsensitiveOption))) {
+ // while - indent next (block of code)
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^end\\s*while\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // endwhile - come out of block
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^function\\s", QRegularExpression::CaseInsensitiveOption))) {
+ // function - indent next (block of code)
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^end\\s*function\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // endfunction - come out of block
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^subroutine\\s", QRegularExpression::CaseInsensitiveOption))) {
+ // function - indent next (block of code)
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^end\\s*subroutine\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // endfunction - come out of block
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^do\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // do - indent next (block of code)
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^until\\s", QRegularExpression::CaseInsensitiveOption))) {
+ // until - come out of block
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^try\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // try indent next (block of code)
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^catch\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // catch - come out of block and start new block
+ decreaseIndent = true;
+ increaseIndent = true;
+ } else if (line.contains(QRegularExpression("^end\\s*try\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // end try - come out of block - reduce indent
+ decreaseIndent = true;
+ } else if (line.contains(QRegularExpression("^begin\\s*case\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // begin case double indent next (block of code)
+ increaseIndentDouble = true;
+ } else if (line.contains(QRegularExpression("^end\\s*case\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // end case double reduce
+ decreaseIndentDouble = true;
+ } else if (line.contains(QRegularExpression("^case\\s.+\\s*((#|(rem\\s)).*)?$", QRegularExpression::CaseInsensitiveOption))) {
+ // case expression - indent one line
+ decreaseIndent = true;
+ increaseIndent = true;
+ }
+ //
+ if (decreaseIndent) {
+ indent--;
+ if (indent<0) indent=0;
+ decreaseIndent = false;
+ }
+ if (decreaseIndentDouble) {
+ indent-=2;
+ if (indent<0) indent=0;
+ decreaseIndentDouble = false;
+ }
+ if (indentThisLine) {
+ line = QString(indent, QChar('\t')) + line;
+ } else {
+ indentThisLine = true;
+ }
+ if (increaseIndent) {
+ indent++;
+ increaseIndent = false;
+ }
+ if (increaseIndentDouble) {
+ indent+=2;
+ increaseIndentDouble = false;
+ }
+ //
+ lines.replace(i, line);
+ }
//this->setPlainText(lines.join("\n"));
QTextCursor cursor = this->textCursor();
cursor.select(QTextCursor::Document);
cursor.insertText(lines.join("\n"));
- QApplication::restoreOverrideCursor();
+ QApplication::restoreOverrideCursor();
}
void BasicEdit::findString(QString s, bool reverse, bool casesens, bool words)
{
- if(s.length()==0) return;
- QTextDocument::FindFlags flag;
- if (reverse) flag |= QTextDocument::FindBackward;
- if (casesens) flag |= QTextDocument::FindCaseSensitively;
- if (words) flag |= QTextDocument::FindWholeWords;
+ if(s.length()==0) return;
+ QTextDocument::FindFlags flag;
+ if (reverse) flag |= QTextDocument::FindBackward;
+ if (casesens) flag |= QTextDocument::FindCaseSensitively;
+ if (words) flag |= QTextDocument::FindWholeWords;
- QTextCursor cursor = this->textCursor();
- // here we save the cursor position and the verticalScrollBar value
+ QTextCursor cursor = this->textCursor();
+ // here we save the cursor position and the verticalScrollBar value
QTextCursor cursorSaved = cursor;
int scroll = verticalScrollBar()->value();
if (!find(s, flag))
- {
+ {
//nothing is found | jump to start/end
setUpdatesEnabled(false);
cursor.movePosition(reverse?QTextCursor::End:QTextCursor::Start);
@@ -417,7 +419,7 @@ void BasicEdit::findString(QString s, bo
if (!find(s, flag))
{
// word not found : we set the cursor back to its initial position and restore verticalScrollBar value
- setTextCursor(cursorSaved);
+ setTextCursor(cursorSaved);
verticalScrollBar()->setValue(scroll);
setUpdatesEnabled(true);
QMessageBox::information(this, tr("Find"),
@@ -439,54 +441,54 @@ void BasicEdit::findString(QString s, bo
}
void BasicEdit::replaceString(QString from, QString to, bool reverse, bool casesens, bool words, bool doall) {
- if(from.length()==0) return;
+ if(from.length()==0) return;
- // Replace one time.
- if(!doall){
- //Replace if text is selected - use the cursor from the last find not the copy
+ // Replace one time.
+ if(!doall){
+ //Replace if text is selected - use the cursor from the last find not the copy
QTextCursor cursor = this->textCursor();
if (from.compare(cursor.selectedText(),(casesens ? Qt::CaseSensitive : Qt::CaseInsensitive))==0){
- cursor.insertText(to);
- }
+ cursor.insertText(to);
+ }
- //Make a search
+ //Make a search
findString(from, reverse, casesens, words);
//Replace all
}else{
- QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- setUpdatesEnabled(false);
- QTextCursor cursorSaved = textCursor();
- int scroll = verticalScrollBar()->value();
- QTextCursor cursor = textCursor();
- cursor.beginEditBlock();
- int n = 0;
- cursor.movePosition(QTextCursor::Start);
- setTextCursor(cursor);
- QTextDocument::FindFlags flag;
- if (casesens) flag |= QTextDocument::FindCaseSensitively;
- if (words) flag |= QTextDocument::FindWholeWords;
- while (find(from, flag)){
- if (textCursor().hasSelection()){
- textCursor().insertText(to);
- n++;
- }
- }
- cursor.endEditBlock();
- setUpdatesEnabled(true);
- QApplication::restoreOverrideCursor();
- // set the cursor back to its initial position and restore verticalScrollBar value
- setTextCursor(cursorSaved);
- verticalScrollBar()->setValue(scroll);
- if(n==0)
- QMessageBox::information(this, tr("Replace"),
- tr("String not found."),
- QMessageBox::Ok, QMessageBox::Ok);
- else
- QMessageBox::information(this, tr("Replace"),
- tr("Replace completed.") + "\n" + QString::number(n) + " " + tr("occurrence(s) were replaced."),
- QMessageBox::Ok, QMessageBox::Ok);
- }
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ setUpdatesEnabled(false);
+ QTextCursor cursorSaved = textCursor();
+ int scroll = verticalScrollBar()->value();
+ QTextCursor cursor = textCursor();
+ cursor.beginEditBlock();
+ int n = 0;
+ cursor.movePosition(QTextCursor::Start);
+ setTextCursor(cursor);
+ QTextDocument::FindFlags flag;
+ if (casesens) flag |= QTextDocument::FindCaseSensitively;
+ if (words) flag |= QTextDocument::FindWholeWords;
+ while (find(from, flag)){
+ if (textCursor().hasSelection()){
+ textCursor().insertText(to);
+ n++;
+ }
+ }
+ cursor.endEditBlock();
+ setUpdatesEnabled(true);
+ QApplication::restoreOverrideCursor();
+ // set the cursor back to its initial position and restore verticalScrollBar value
+ setTextCursor(cursorSaved);
+ verticalScrollBar()->setValue(scroll);
+ if(n==0)
+ QMessageBox::information(this, tr("Replace"),
+ tr("String not found."),
+ QMessageBox::Ok, QMessageBox::Ok);
+ else
+ QMessageBox::information(this, tr("Replace"),
+ tr("Replace completed.") + "\n" + QString::number(n) + " " + tr("occurrence(s) were replaced."),
+ QMessageBox::Ok, QMessageBox::Ok);
+ }
}
QString BasicEdit::getCurrentWord() {
@@ -496,8 +498,8 @@ QString BasicEdit::getCurrentWord() {
QTextCursor t(textCursor());
QTextBlock b(t.block());
w = b.text();
- w = w.left(w.indexOf(QRegExp("[^a-zA-Z0-9]"),t.positionInBlock()));
- w = w.mid(w.lastIndexOf(QRegExp("[^a-zA-Z0-9]"))+1);
+ w = w.left(w.indexOf(QRegularExpression("[^a-zA-Z0-9]"),t.positionInBlock()));
+ w = w.mid(w.lastIndexOf(QRegularExpression("[^a-zA-Z0-9]"))+1);
return w;
}
@@ -508,7 +510,7 @@ int BasicEdit::lineNumberAreaWidth() {
max /= 10;
++digits;
}
- int space = 10 + fontMetrics().width(QLatin1Char('9')) * digits;
+ int space = 10 + fontMetrics().boundingRect(QLatin1Char('9')).width() * digits;
return space;
}
@@ -569,7 +571,7 @@ void BasicEdit::highlightCurrentLine() {
//mark brackets if we are editing
- if (runState==RUNSTATESTOP && !isReadOnly()) {
+ if (runState==RUNSTATESTOP && !isReadOnly()) {
QTextCursor cur = textCursor();
int pos = cur.position();
cur.movePosition(QTextCursor::EndOfBlock, QTextCursor::MoveAnchor);
@@ -747,7 +749,7 @@ void BasicEdit::lineNumberAreaPaintEvent
painter.setPen(Qt::red);
int w = lineNumberArea->width();
int bh = blockBoundingRect(block).height();
- int fh = fontMetrics().height();
+ int fh = fontMetrics().boundingRect(" ").height();
painter.drawEllipse((w-(fh-6))/2, top+(bh-(fh-6))/2, fh-6, fh-6);
}
// draw text
@@ -756,7 +758,7 @@ void BasicEdit::lineNumberAreaPaintEvent
} else {
painter.setPen(Qt::black);
}
- painter.drawText(0, top, lineNumberArea->width()-5, fontMetrics().height(), Qt::AlignRight, number);
+ painter.drawText(0, top, lineNumberArea->width()-5, fontMetrics().boundingRect(" ").height(), Qt::AlignRight, number);
}
block = block.next();
@@ -779,14 +781,14 @@ void BasicEdit::lineNumberAreaMouseClick
if (runState == RUNSTATERUN)
return;
// based on mouse click - set the breakpoint in the map/block and highlight the line
- int line;
- QTextBlock block = firstVisibleBlock();
+ int line;
+ QTextBlock block = firstVisibleBlock();
int bottom = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); //bottom from previous block
line = block.blockNumber();
- // line 0 ... (n-1) of what was clicked
- while(block.isValid()) {
- bottom += blockBoundingRect(block).height();
- if (event->y() < bottom) {
+ // line 0 ... (n-1) of what was clicked
+ while(block.isValid()) {
+ bottom += blockBoundingRect(block).height();
+ if (event->localPos().y() < bottom) {
if(event->button() == Qt::LeftButton){
//keep breakPoints list update for debug running mode
if(block.userState()==STATEBREAKPOINT){
@@ -811,9 +813,9 @@ void BasicEdit::lineNumberAreaMouseClick
}
return;
}
- block = block.next();
- line++;
- }
+ block = block.next();
+ line++;
+ }
QMenu contextMenu(this);
contextMenu.addAction ( tr("Clear all breakpoints") , this , SLOT (clearBreakPoints()) );
contextMenu.exec (event->globalPos());
@@ -884,72 +886,72 @@ void BasicEdit::updateBreakPointsList()
int BasicEdit::indentSelection() {
- QTextCursor cur = textCursor();
- if(!cur.hasSelection())
- return false;
- int a = cur.anchor();
- int p = cur.position();
- int start = (a<=p?a:p);
- int end = (a>p?a:p);
-
- cur.beginEditBlock();
- cur.setPosition(end);
- int eblock = cur.block().blockNumber();
- cur.setPosition(start);
- int sblock = cur.block().blockNumber();
-
- for(int i = sblock; i <= eblock; i++)
- {
- cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
- cur.insertText("\t");
- cur.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor);
- }
- cur.endEditBlock();
+ QTextCursor cur = textCursor();
+ if(!cur.hasSelection())
+ return false;
+ int a = cur.anchor();
+ int p = cur.position();
+ int start = (a<=p?a:p);
+ int end = (a>p?a:p);
+
+ cur.beginEditBlock();
+ cur.setPosition(end);
+ int eblock = cur.block().blockNumber();
+ cur.setPosition(start);
+ int sblock = cur.block().blockNumber();
+
+ for(int i = sblock; i <= eblock; i++)
+ {
+ cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
+ cur.insertText("\t");
+ cur.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor);
+ }
+ cur.endEditBlock();
return true;
}
void BasicEdit::unindentSelection() {
- QTextCursor cur = textCursor();
- int a = cur.anchor();
- int p = cur.position();
- int start = (a<=p?a:p);
- int end = (a>p?a:p);
-
- cur.beginEditBlock();
- cur.setPosition(end);
- int eblock = cur.block().blockNumber();
- cur.setPosition(start);
- int sblock = cur.block().blockNumber();
- QString s;
-
- for(int i = sblock; i <= eblock; i++)
- {
- cur.movePosition(QTextCursor::EndOfBlock, QTextCursor::MoveAnchor);
- cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
- s = cur.selectedText();
- if(!s.isEmpty()){
- if(s.startsWith(" ") || s.startsWith(" \t")){
- cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
- cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 4);
- cur.removeSelectedText();
- }else if(s.startsWith(" ") || s.startsWith(" \t")){
- cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
- cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 3);
- cur.removeSelectedText();
- }else if(s.startsWith(" ") || s.startsWith(" \t")){
- cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
- cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 2);
- cur.removeSelectedText();
- }else if(s.startsWith(" ") || s.startsWith("\t")){
- cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
- cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 1);
- cur.removeSelectedText();
- }
- }
- cur.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor);
- }
- cur.endEditBlock();
+ QTextCursor cur = textCursor();
+ int a = cur.anchor();
+ int p = cur.position();
+ int start = (a<=p?a:p);
+ int end = (a>p?a:p);
+
+ cur.beginEditBlock();
+ cur.setPosition(end);
+ int eblock = cur.block().blockNumber();
+ cur.setPosition(start);
+ int sblock = cur.block().blockNumber();
+ QString s;
+
+ for(int i = sblock; i <= eblock; i++)
+ {
+ cur.movePosition(QTextCursor::EndOfBlock, QTextCursor::MoveAnchor);
+ cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
+ s = cur.selectedText();
+ if(!s.isEmpty()){
+ if(s.startsWith(" ") || s.startsWith(" \t")){
+ cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
+ cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 4);
+ cur.removeSelectedText();
+ }else if(s.startsWith(" ") || s.startsWith(" \t")){
+ cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
+ cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 3);
+ cur.removeSelectedText();
+ }else if(s.startsWith(" ") || s.startsWith(" \t")){
+ cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
+ cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 2);
+ cur.removeSelectedText();
+ }else if(s.startsWith(" ") || s.startsWith("\t")){
+ cur.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
+ cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 1);
+ cur.removeSelectedText();
+ }
+ }
+ cur.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor);
+ }
+ cur.endEditBlock();
}
void BasicEdit::setTitle(QString newTitle){
--- basic256-2.0.99.10.orig/BasicGraph.cpp
+++ basic256-2.0.99.10/BasicGraph.cpp
@@ -21,15 +21,14 @@
#include <QClipboard>
#include <QMutex>
-#include <QtPrintSupport/QPrintDialog>
-#include <QtPrintSupport/QPrinter>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QMessageBox>
-#include <QtWidgets/QScrollArea>
-#include <QtWidgets/QToolBar>
+#include <QPrintDialog>
+#include <QPrinter>
+#include <QAction>
+#include <QApplication>
+#include <QMessageBox>
+#include <QScrollArea>
+#include <QToolBar>
#include <QDockWidget>
-#include <QDesktopWidget>
#include "BasicWidget.h"
#include "BasicGraph.h"
@@ -185,7 +184,7 @@ void BasicGraph::resizeWindowToFitConten
dock->setMaximumSize(QWIDGETSIZE_MAX ,QWIDGETSIZE_MAX );
// make graph window visible in screen range (ignoring taskbar area)
- QRect screen (QApplication::desktop()->availableGeometry(this));
+ QRect screen (this->geometry());
QPoint win_position = dock->pos();
QSize win_size = dock->size();
int w = win_size.width()+win_position.x();
@@ -285,7 +284,7 @@ void BasicGraph::mouseReleaseEvent(QMous
}
void BasicGraph::mousePressEvent(QMouseEvent *e) {
- if (e->x() >= 0 && e->x() < gwidth && e->y() >= 0 && e->y() < gheight) {
+ if (e->localPos().x() >= 0 && e->localPos().x() < gwidth && e->localPos().y() >= 0 && e->localPos().y() < gheight) {
QPoint p = gtransforminverted.map(e->pos());
clickX = mouseX = p.x();
clickY = mouseY = p.y();
@@ -402,9 +401,9 @@ void BasicGraph::updateScreenImage(){
}
void BasicGraph::mouseDoubleClickEvent(QMouseEvent * e){
- if (e->x() >= 0 && e->x() < gwidth && e->y() >= 0 && e->y() < gheight) {
- clickX = mouseX = e->x();
- clickY = mouseY = e->y();
+ if (e->localPos().x() >= 0 && e->localPos().x() < gwidth && e->localPos().y() >= 0 && e->localPos().y() < gheight) {
+ clickX = mouseX = e->localPos().x();
+ clickY = mouseY = e->localPos().y();
clickB = e->button() | MOUSEBUTTON_DOUBLECLICK; //set doubleclick flag
mouseB = e->buttons();
}
--- basic256-2.0.99.10.orig/BasicKeyboard.cpp
+++ basic256-2.0.99.10/BasicKeyboard.cpp
@@ -87,7 +87,7 @@ void BasicKeyboard::reset(){
// releasing keys outside and to be detectes=d as pressed
lastKey = 0;
lastText = QString();
- lastModifiers = 0;
+ lastModifiers = Qt::NoModifier;
pressedKeysMap.clear();
}
--- basic256-2.0.99.10.orig/BasicOutput.cpp
+++ basic256-2.0.99.10/BasicOutput.cpp
@@ -22,13 +22,14 @@
#include <QMutex>
#include <QClipboard>
#include <QMimeData>
+#include <QRegularExpression>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QToolBar>
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QMessageBox>
-#include <QtPrintSupport/QPrintDialog>
-#include <QtPrintSupport/QPrinter>
+#include <QAction>
+#include <QToolBar>
+#include <QApplication>
+#include <QMessageBox>
+#include <QPrintDialog>
+#include <QPrinter>
#include "Settings.h"
#include "BasicOutput.h"
@@ -40,12 +41,12 @@ extern BasicKeyboard *basicKeyboard;
BasicOutput::BasicOutput( ) : QTextEdit () {
inputText.clear();
setReadOnly(true);
- setInputMethodHints(Qt::ImhNoPredictiveText);
- setFocusPolicy(Qt::StrongFocus);
- setAcceptRichText(false);
- setUndoRedoEnabled(false);
- gettingInput = false;
- saveLastPosition();
+ setInputMethodHints(Qt::ImhNoPredictiveText);
+ setFocusPolicy(Qt::StrongFocus);
+ setAcceptRichText(false);
+ setUndoRedoEnabled(false);
+ gettingInput = false;
+ saveLastPosition();
}
@@ -54,20 +55,20 @@ BasicOutput::~BasicOutput( ) {
}
void BasicOutput::getInput() {
- // move cursor to the end of the existing text and start input
- inputText.clear();
- gettingInput = true;
- setFocus();
- emit(mainWindowsVisible(2,true));
- restoreLastPosition();
- inputPosition = lastPosition;
- setReadOnly(false);
- updatePasteButton();
+ // move cursor to the end of the existing text and start input
+ inputText.clear();
+ gettingInput = true;
+ setFocus();
+ emit(mainWindowsVisible(2,true));
+ restoreLastPosition();
+ inputPosition = lastPosition;
+ setReadOnly(false);
+ updatePasteButton();
}
void BasicOutput::stopInput() {
- gettingInput = false;
- setReadOnly(true);
+ gettingInput = false;
+ setReadOnly(true);
updatePasteButton();
}
@@ -78,7 +79,7 @@ void BasicOutput::keyPressEvent(QKeyEven
mymutex->lock();
basicKeyboard->keyPressed(e);
QTextEdit::keyPressEvent(e);
- mymutex->unlock();
+ mymutex->unlock();
} else {
if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
saveLastPosition();
@@ -96,9 +97,10 @@ void BasicOutput::keyPressEvent(QKeyEven
} else if (e->key() == Qt::Key_Backspace) {
QTextCursor t(textCursor());
t.movePosition(QTextCursor::PreviousCharacter);
- if (t.position() >= inputPosition)
+ if (t.position() >= inputPosition) {
QTextEdit::keyPressEvent(e);
- saveLastPosition();
+ }
+ saveLastPosition();
} else {
QTextEdit::keyPressEvent(e);
}
@@ -107,13 +109,13 @@ void BasicOutput::keyPressEvent(QKeyEven
void BasicOutput::keyReleaseEvent(QKeyEvent *e) {
- e->accept();
- if (!gettingInput) {
+ e->accept();
+ if (!gettingInput) {
mymutex->lock();
basicKeyboard->keyReleased(e);
QTextEdit::keyReleaseEvent(e);
- mymutex->unlock();
- }
+ mymutex->unlock();
+ }
}
void BasicOutput::focusOutEvent(QFocusEvent* ){
@@ -122,11 +124,11 @@ void BasicOutput::focusOutEvent(QFocusEv
}
bool BasicOutput::initActions(QMenu * vMenu, QToolBar * vToolBar) {
- if ((NULL == vMenu) || (NULL == vToolBar)) {
- return false;
- }
+ if ((NULL == vMenu) || (NULL == vToolBar)) {
+ return false;
+ }
- vToolBar->setObjectName("outtoolbar");
+ vToolBar->setObjectName("outtoolbar");
copyAct = vMenu->addAction(QObject::tr("Copy"));
@@ -143,22 +145,22 @@ bool BasicOutput::initActions(QMenu * vM
clearAct = vMenu->addAction(QObject::tr("Clear"));
clearAct->setEnabled(false);
- vToolBar->addAction(copyAct);
- vToolBar->addAction(pasteAct);
+ vToolBar->addAction(copyAct);
+ vToolBar->addAction(pasteAct);
vToolBar->addAction(printAct);
vToolBar->addAction(clearAct);
- QObject::connect(copyAct, SIGNAL(triggered()), this, SLOT(copy()));
- QObject::connect(pasteAct, SIGNAL(triggered()), this, SLOT(paste()));
- QObject::connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));
+ QObject::connect(copyAct, SIGNAL(triggered()), this, SLOT(copy()));
+ QObject::connect(pasteAct, SIGNAL(triggered()), this, SLOT(paste()));
+ QObject::connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));
QObject::connect(this, SIGNAL(copyAvailable(bool)), copyAct, SLOT(setEnabled(bool)));
QObject::connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(updatePasteButton()));
QObject::connect(clearAct, SIGNAL(triggered()), this, SLOT(slotClear()));
- m_usesToolBar = true;
- m_usesMenu = true;
+ m_usesToolBar = true;
+ m_usesMenu = true;
- return true;
+ return true;
}
void BasicOutput::slotPrint() {
@@ -171,7 +173,7 @@ void BasicOutput::slotPrint() {
dialog->setWindowTitle(QObject::tr("Print Text Output"));
if (dialog->exec() == QDialog::Accepted) {
- if ((printer.printerState() != QPrinter::Error) && (printer.printerState() != QPrinter::Aborted)) {
+ if ((printer.printerState() != QPrinter::Error) && (printer.printerState() != QPrinter::Aborted)) {
document->print(&printer);
} else {
QMessageBox::warning(this, QObject::tr("Print Error"), QObject::tr("Unable to carry out printing.\nPlease check your printer settings."));
@@ -181,42 +183,42 @@ void BasicOutput::slotPrint() {
}
void BasicOutput::paintEvent(QPaintEvent* event) {
- // paint a visible cursor at the text cursor
- QTextEdit::paintEvent(event);
- QRect cursor = cursorRect();
- cursor.setWidth(2);
- QPainter p(viewport());
- p.fillRect(cursor, Qt::SolidPattern);
+ // paint a visible cursor at the text cursor
+ QTextEdit::paintEvent(event);
+ QRect cursor = cursorRect();
+ cursor.setWidth(2);
+ QPainter p(viewport());
+ p.fillRect(cursor, Qt::SolidPattern);
}
// Ensure that drag and drop is allowed only in permitted area when BASIC-256 wait for input
void BasicOutput::dragEnterEvent(QDragEnterEvent *e){
- if (e->mimeData()->hasFormat("text/plain") && gettingInput && !isReadOnly() )
- e->acceptProposedAction();
+ if (e->mimeData()->hasFormat("text/plain") && gettingInput && !isReadOnly() )
+ e->acceptProposedAction();
}
void BasicOutput::dragMoveEvent (QDragMoveEvent *event){
- QTextCursor t = cursorForPosition(event->pos());
- if (t.position() >= inputPosition){
- event->acceptProposedAction();
- QDragMoveEvent move(event->pos(),event->dropAction(), event->mimeData(), event->mouseButtons(),
- event->keyboardModifiers(), event->type());
- QTextEdit::dragMoveEvent(&move); // Call the parent function (show cursor and keep selection)
- } else {
- event->ignore();
- }
+ QTextCursor t = cursorForPosition(event->pos());
+ if (t.position() >= inputPosition){
+ event->acceptProposedAction();
+ QDragMoveEvent move(event->pos(), event->dropAction(), event->mimeData(), event->mouseButtons(),
+ event->keyboardModifiers(), event->type());
+ QTextEdit::dragMoveEvent(&move); // Call the parent function (show cursor and keep selection)
+ } else {
+ event->ignore();
+ }
}
//Ensure that drang and drop operation or paste operation will add only first line of the copied text.
void BasicOutput::insertFromMimeData(const QMimeData* source)
{
- if (source->hasText()) {
- QString s = source->text();
- QStringList l = s.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
- textCursor().insertText(l.at(0));
- setFocus();
- }
+ if (source->hasText()) {
+ QString s = source->text();
+ QStringList l = s.split(QRegularExpression("[\\r\\n]"), Qt::SkipEmptyParts);
+ textCursor().insertText(l.at(0));
+ setFocus();
+ }
}
void BasicOutput::updatePasteButton(){
@@ -230,119 +232,119 @@ void BasicOutput::slotClear(){
}
void BasicOutput::slotWrap(bool checked) {
- if (checked) {
- setLineWrapMode(QTextEdit::WidgetWidth);
- } else {
- setLineWrapMode(QTextEdit::NoWrap);
- }
+ if (checked) {
+ setLineWrapMode(QTextEdit::WidgetWidth);
+ } else {
+ setLineWrapMode(QTextEdit::NoWrap);
+ }
}
void BasicOutput::outputText(QString text) {
- outputText(text, Qt::black);
+ outputText(text, Qt::black);
}
void BasicOutput::outputText(QString text, QColor color) {
- this->setTextColor(color); //back to black color
- restoreLastPosition();
- this->insertPlainText(text);
- this->ensureCursorVisible();
- saveLastPosition();
+ this->setTextColor(color); //back to black color
+ restoreLastPosition();
+ this->insertPlainText(text);
+ this->ensureCursorVisible();
+ saveLastPosition();
}
int BasicOutput::getCurrentPosition() {
- QTextCursor t(textCursor());
- return t.position();
+ QTextCursor t(textCursor());
+ return t.position();
}
void BasicOutput::saveLastPosition() {
- lastPosition = getCurrentPosition();
+ lastPosition = getCurrentPosition();
}
void BasicOutput::restoreLastPosition() {
- moveToPosition(lastPosition);
+ moveToPosition(lastPosition);
}
void BasicOutput::moveToPosition(int pos) {
- // move to an absolute character number (position) in the document
- QTextCursor t(textCursor());
- t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
- t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, pos);
- setTextCursor(t);
+ // move to an absolute character number (position) in the document
+ QTextCursor t(textCursor());
+ t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
+ t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, pos);
+ setTextCursor(t);
}
void BasicOutput::outputTextAt(int col, int row, QString s) {
- //fprintf(stderr, "moveToPosition = col %i row %i\n", col, row);
+ //fprintf(stderr, "moveToPosition = col %i row %i\n", col, row);
- QTextCursor t(textCursor());
- t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
+ QTextCursor t(textCursor());
+ t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
- //fprintf(stderr, "moveToPosition start=%i\n", t.position());
+ //fprintf(stderr, "moveToPosition start=%i\n", t.position());
- // move to the begining of the sprecified line or append lines
- int lines = toPlainText().count("\n");
- //fprintf(stderr, "moveToPosition lines=%i\n", lines);
- if (row>lines) {
- // go to end and append
- for (; lines < row; lines++) {
- t.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
- this->setTextCursor(t);
- insertPlainText("\n");
- //fprintf(stderr, "moveToPosition add line\n", lines);
- }
- } else {
- // go down to the row
- for (int i=0; i < row; i++) {
- t.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor);
- //fprintf(stderr, "moveToPosition down line\n", lines);
- }
- this->setTextCursor(t);
- }
- //fprintf(stderr, "moveToPosition after position=%i\n", t.position());
-
- // move to the specified character on the current line or append
- t.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
- int lineStart = t.position();
- t.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor);
- int lineEnd = t.position();
- //fprintf(stderr, "moveToPosition = ls %i le %i\n", lineStart, lineEnd);
-
-
- if (col <= lineEnd-lineStart) {
- // line is long enough to start - replace mode
- t.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
- t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, col);
- this->setTextCursor(t);
-
- // replace text at cursor
- int startText = t.position();
- t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, s.length());
- int endLength = t.position();
- t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
- t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, startText);
- t.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor);
- int endLine = t.position();
-
- int replaceLen= (endLine<endLength?endLine:endLength) - startText;
- //fprintf(stderr, "moveToPosition = replace s %i len %i line %i replaceLen %i\n", startText, endLength, endLine, replaceLen);
-
- t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
- t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, startText);
- t.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, replaceLen);
- this->setTextCursor(t);
- this->insertPlainText(s);
-
- } else {
- // line is not long enough - insert spaces and insert
- t.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor);
- this->setTextCursor(t);
- for (int i=lineEnd-lineStart; i<col; i++) {
- insertPlainText(" ");
- }
- this->insertPlainText(s);
- }
+ // move to the begining of the sprecified line or append lines
+ int lines = toPlainText().count("\n");
+ //fprintf(stderr, "moveToPosition lines=%i\n", lines);
+ if (row>lines) {
+ // go to end and append
+ for (; lines < row; lines++) {
+ t.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
+ this->setTextCursor(t);
+ insertPlainText("\n");
+ //fprintf(stderr, "moveToPosition add line\n", lines);
+ }
+ } else {
+ // go down to the row
+ for (int i=0; i < row; i++) {
+ t.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor);
+ //fprintf(stderr, "moveToPosition down line\n", lines);
+ }
+ this->setTextCursor(t);
+ }
+ //fprintf(stderr, "moveToPosition after position=%i\n", t.position());
+
+ // move to the specified character on the current line or append
+ t.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
+ int lineStart = t.position();
+ t.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor);
+ int lineEnd = t.position();
+ //fprintf(stderr, "moveToPosition = ls %i le %i\n", lineStart, lineEnd);
+
+
+ if (col <= lineEnd-lineStart) {
+ // line is long enough to start - replace mode
+ t.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
+ t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, col);
+ this->setTextCursor(t);
+
+ // replace text at cursor
+ int startText = t.position();
+ t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, s.length());
+ int endLength = t.position();
+ t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
+ t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, startText);
+ t.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor);
+ int endLine = t.position();
+
+ int replaceLen= (endLine<endLength?endLine:endLength) - startText;
+ //fprintf(stderr, "moveToPosition = replace s %i len %i line %i replaceLen %i\n", startText, endLength, endLine, replaceLen);
+
+ t.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
+ t.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, startText);
+ t.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, replaceLen);
+ this->setTextCursor(t);
+ this->insertPlainText(s);
+
+ } else {
+ // line is not long enough - insert spaces and insert
+ t.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor);
+ this->setTextCursor(t);
+ for (int i=lineEnd-lineStart; i<col; i++) {
+ insertPlainText(" ");
+ }
+ this->insertPlainText(s);
+ }
- saveLastPosition();
- //fprintf(stderr, "moveToPosition = -----------------------------------\n");
+ saveLastPosition();
+ //fprintf(stderr, "moveToPosition = -----------------------------------\n");
}
--- basic256-2.0.99.10.orig/COMPILING.txt
+++ basic256-2.0.99.10/COMPILING.txt
@@ -17,7 +17,7 @@ Dependencies:
###########################################################
-WINDOWS (QT5.15)
+WINDOWS (QT 6.7.0)
###########################################################
Dependencies:
@@ -25,7 +25,8 @@ Dependencies:
** Available from: http://qt.io - use the online installer
** BE SURE to choose the mingw compiler from tools it will be the correct version
for the QT binary support files
- ** add paths C:\Qt\5.15\mingw81_32\bin;C:\Qt\Tools\mingw810_32\bin; to your system environment variable
+ ** add paths C:\Qt\5.15\mingw1120_64\bin;C:\Qt\Tools\mingw1120_64\bin; to your system environment variable
+ ** copy mingw32-make.exe to make.exe in folder C:\Qt\Tools\mingw1120_64\bin
* MSYS developer tools and libraries
** Available from:
--- /dev/null
+++ basic256-2.0.99.10/COMPILING_Ubuntu_24_04.md
@@ -0,0 +1,15 @@
+# Compiling basic256 - Ubuntu 24.04 LTS
+
+## 2024-10-31 j.m.reneau
+
+sudo apt install subversion
+
+svn checkout --username=YOURUSER svn+ssh://renejm@svn.code.sf.net/p/kidbasic/code/trunk basic256
+
+sudo apt install bison flex qt5-qmake qtbase5-dev libqt5serialport5-dev libqt5texttospeech5-dev qtmultimedia5-dev
+
+qmake BASIC256.pro -config debug
+
+make
+
+./basic256
\ No newline at end of file
--- /dev/null
+++ basic256-2.0.99.10/COMPILING_WIN11_QT6.md
@@ -0,0 +1,33 @@
+# Windows 11 - QT6
+## 2024-11-02
+
+## Installing
+
+Download the QT online installer from qt.io
+
+Perform a custom install and install:
+* QT > QT 6.8.0 including all additional libraries
+* QT > Developer and Designer Tools > LLVM-MinGW 17.xxx
+* QT > Developer and Designer Tools > MinGW 13.xx
+* QT > Developer and Designer Tools > CMake 3.xx
+
+Install flex and bison from
+https://sourceforge.net/projects/winflexbison/files/latest/download
+* in the folder c:\qt\Tools\win_flex_bison
+* rename win_flex.exe to flex.exe
+* rename win_bison.exe to bison.exe
+
+In the folder C:\Qt\Tools\mingw1310_64\bin
+* rename mingw32_make.exe to make.exe
+
+Make sure that the following have been added to your path system environment variable:
+* C:\Qt\6.8.0\mingw_64\bin
+* C:\Qt\Tools\mingw1310_64\bin
+* C:\Qt\Tools\win_flex_bison
+
+## Compiling - Debug
+
+From cmd in the basic256 folder:
+* qmake basic256.pro -config debug
+* make
+
--- basic256-2.0.99.10.orig/CONTRIBUTORS
+++ basic256-2.0.99.10/CONTRIBUTORS
@@ -1,4 +1,4 @@
-
+With much thanks.
Developers
-----------
--- basic256-2.0.99.10.orig/CompileErrors.h
+++ basic256-2.0.99.10/CompileErrors.h
@@ -62,7 +62,8 @@
#define COMPERR_INCLUDENOTALONE 45
#define COMPERR_INCLUDENOFILE 46
#define COMPERR_ONERRORCALL 47
-#define COMPERR_NUMBERTOOLARGE 48
+#define COMPERR_INTEGERTOOLARGE 48
+#define COMPERR_FLOATTOOLARGE 49
--- basic256-2.0.99.10.orig/Convert.cpp
+++ basic256-2.0.99.10/Convert.cpp
@@ -16,8 +16,9 @@ Convert::Convert(QLocale *applocale) {
// build international safe regular expression for numbers
locale = applocale;
- replaceDecimalPoint = replaceDecimalPoint && locale->decimalPoint()!='.'; //use locale decimal point only if !="."
- decimalPoint = (replaceDecimalPoint?locale->decimalPoint():'.');
+ replaceDecimalPoint = replaceDecimalPoint && locale->decimalPoint()!="."; //use locale decimal point only if !="."
+ decimalPoint = locale->decimalPoint();
+ if (!replaceDecimalPoint) decimalPoint = ".";
isnumericexpression = QString("^[-+]?[0-9]*") + decimalPoint + QString("?[0-9]+([eE][-+]?[0-9]+)?$");
musicalnote.setPattern("^(do|re|mi|fa|sol|la|si|c|d|e|f|g|a|b|h|ni|pa|vu|ga|di|ke|zo)([-]?[0-9]+)?(#{1,2}|b{1,2})?$");
musicalnote.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
@@ -80,6 +81,15 @@ int Convert::getInt(DataElement *d) {
return (int) l;
}
+unsigned int Convert::getUInt(DataElement *d) {
+ long l=getLong(d);
+ if (l<0||l>UINT_MAX) {
+ e = ERROR_UNSIGNEDINTEGERRANGE;
+ l = 0;
+ }
+ return (unsigned int) l;
+}
+
long Convert::getLong(DataElement *d) {
long i=0;
if (d) {
@@ -211,7 +221,7 @@ QString Convert::getString(DataElement *
//check if adding of ".0" will exceed the number of digits to print numbers
if(((int)xp)==ddigits-1 && floattail){
s.setNum(d->floatval,'e',ddigits - 1);
- s.replace(QRegExp(QStringLiteral("0+e")), QStringLiteral("e"));
+ s.replace(QRegularExpression(QStringLiteral("0+e")), QStringLiteral("e"));
s.replace(QStringLiteral(".e"), QStringLiteral(".0e"));
if(replaceDecimalPoint){
s.replace('.', decimalPoint);
--- basic256-2.0.99.10.orig/Convert.h
+++ basic256-2.0.99.10/Convert.h
@@ -35,6 +35,7 @@ class Convert
bool isNumeric(DataElement*);
int getInt(DataElement*);
+ unsigned int getUInt(DataElement*);
long getLong(DataElement*);
double getFloat(DataElement*);
QString getString(DataElement*);
@@ -65,7 +66,7 @@ class Convert
int decimaldigits; // display n decinal digits 12 default - 8 to 15 valid
bool floattail; // display floats with a tail of ".0" if whole numbers
bool replaceDecimalPoint; // user can chose if INPUT and PRINT should use localized decimal point
- QChar decimalPoint;
+ QString decimalPoint;
static int e; // error number thrown - will be 0 if no error
--- basic256-2.0.99.10.orig/DataElement.cpp
+++ basic256-2.0.99.10/DataElement.cpp
@@ -25,6 +25,15 @@ DataElement::DataElement(QString s) {
}
DataElement::DataElement(int i) {
+ // 32 bit integer stored on stack as a 64 bit long
+ init();
+ type = T_INT;
+ intval = i;
+}
+
+
+DataElement::DataElement(unsigned int i) {
+ // 32 bit integer stored on stack as a 64 bit long
init();
type = T_INT;
intval = i;
--- basic256-2.0.99.10.orig/DataElement.h
+++ basic256-2.0.99.10/DataElement.h
@@ -56,6 +56,7 @@ class DataElement
DataElement(QString);
DataElement(double);
DataElement(long);
+ DataElement(unsigned int);
DataElement(int);
DataElement(DataElement *);
--- basic256-2.0.99.10.orig/EditSyntaxHighlighter.cpp
+++ basic256-2.0.99.10/EditSyntaxHighlighter.cpp
@@ -35,15 +35,17 @@ void EditSyntaxHighlighter::highlightBlo
VecHighlightRules::iterator sItEnd = m_standardRules.end();
while (sIt != sItEnd) {
rule = (*sIt);
- QRegExp expression(rule.pattern);
- int index = text.indexOf(expression);
+ QRegularExpression rx(rule.pattern);
+ QRegularExpressionMatch rxm = rx.match(text,0);
+ int index = rxm.capturedStart();
while (index >= 0) {
- int length = expression.matchedLength();
+ int length = rxm.capturedLength();
if (format(index).foreground().color() != m_quoteFmt.foreground().color()) {
// dont set the color if we are in quotes
setFormat(index, length, rule.format);
}
- index = text.indexOf(expression, index + length);
+ rxm = rx.match(text,index + length);
+ index = rxm.capturedStart();
}
++sIt;
}
@@ -374,7 +376,7 @@ void EditSyntaxHighlighter::initKeywords
;
for (QStringList::iterator it = keywordPatterns.begin(); it != keywordPatterns.end(); ++it) {
HighlightRule *rule = new HighlightRule;
- rule->pattern = QRegExp("\\b" + *it + "\\b", Qt::CaseInsensitive);
+ rule->pattern = QRegularExpression("\\b" + *it + "\\b", QRegularExpression::CaseInsensitiveOption);
rule->format = m_keywordFmt;
m_standardRules.append(*rule);
}
@@ -553,7 +555,7 @@ void EditSyntaxHighlighter::initConstant
;
for (QStringList::iterator it = constantPatterns.begin(); it != constantPatterns.end(); ++it ) {
HighlightRule *rule = new HighlightRule;
- rule->pattern = QRegExp("\\b" + *it + "\\b", Qt::CaseInsensitive);
+ rule->pattern = QRegularExpression("\\b" + *it + "\\b", QRegularExpression::CaseInsensitiveOption);
rule->format = m_constantFmt;
m_standardRules.append(*rule);
}
@@ -563,7 +565,7 @@ void EditSyntaxHighlighter::initQuotes()
m_quoteFmt.setForeground(Qt::magenta);
HighlightRule *rule = new HighlightRule;
- rule->pattern = QRegExp("(\"[^\"]*\")|(\'[^\']*\')");
+ rule->pattern = QRegularExpression("(\"[^\"]*\")|(\'[^\']*\')");
rule->format = m_quoteFmt;
m_standardRules.append(*rule);
}
@@ -572,7 +574,7 @@ void EditSyntaxHighlighter::initLabels()
m_labelFmt.setForeground(Qt::blue);
HighlightRule *rule = new HighlightRule;
- rule->pattern = QRegExp("(?:^\\s*)([a-z0-9]+):", Qt::CaseInsensitive);
+ rule->pattern = QRegularExpression("(?:^\\s*)([a-z0-9]+):", QRegularExpression::CaseInsensitiveOption);
rule->format = m_labelFmt;
m_standardRules.append(*rule);
}
@@ -581,7 +583,7 @@ void EditSyntaxHighlighter::initNumbers(
m_numberFmt.setForeground(Qt::darkMagenta);
HighlightRule *rule = new HighlightRule;
- rule->pattern = QRegExp("(\\b([0-9]*\\.?[0-9]+(e[-+]?[0-9]+)?)\\b)|(\\b0x[0-9a-f]+\\b)|(\\b0b[0-1]+\\b)|(\\b0o[0-7]+\\b)", Qt::CaseInsensitive);
+ rule->pattern = QRegularExpression("(\\b([0-9]*\\.?[0-9]+(e[-+]?[0-9]+)?)\\b)|(\\b0x[0-9a-f]+\\b)|(\\b0b[0-1]+\\b)|(\\b0o[0-7]+\\b)", QRegularExpression::CaseInsensitiveOption);
rule->format = m_numberFmt;
m_standardRules.append(*rule);
}
@@ -592,7 +594,7 @@ void EditSyntaxHighlighter::initComments
HighlightRule *rule;
rule = new HighlightRule;
- rule->pattern = QRegExp("(\\bREM\\b.*$)|(#.*$)", Qt::CaseInsensitive);
+ rule->pattern = QRegularExpression("(\\bREM\\b.*$)|(#.*$)", QRegularExpression::CaseInsensitiveOption);
rule->format = m_commentFmt;
m_standardRules.append(*rule);
}
--- basic256-2.0.99.10.orig/EditSyntaxHighlighter.h
+++ basic256-2.0.99.10/EditSyntaxHighlighter.h
@@ -19,6 +19,7 @@
#include <QSyntaxHighlighter>
#include <QTextCharFormat>
+#include <QRegularExpression>
class QTextDocument;
@@ -35,7 +36,7 @@ protected:
private:
struct HighlightRule
{
- QRegExp pattern;
+ QRegularExpression pattern;
QTextCharFormat format;
};
--- basic256-2.0.99.10.orig/Error.cpp
+++ basic256-2.0.99.10/Error.cpp
@@ -94,6 +94,10 @@ void Error::q(int errornumber, int varia
if (typeconverror==SETTINGSERRORNONE) return;
if (typeconverror==SETTINGSERRORWARN) errornumber = WARNING_INTEGERRANGE;
}
+ if (errornumber==ERROR_UNSIGNEDINTEGERRANGE) {
+ if (typeconverror==SETTINGSERRORNONE) return;
+ if (typeconverror==SETTINGSERRORWARN) errornumber = WARNING_UNSIGNEDINTEGERRANGE;
+ }
if (errornumber==ERROR_STRING2NOTE) {
if (typeconverror==SETTINGSERRORNONE) return;
if (typeconverror==SETTINGSERRORWARN) errornumber = WARNING_STRING2NOTE;
@@ -355,6 +359,9 @@ QString Error::getErrorMessage(char **sy
case ERROR_INTEGERRANGE:
errormessage = tr("Number exceeds integer range (") + QString::number(INT_MIN) + tr(" to ") + QString::number(INT_MAX) + tr(")");
break;
+ case ERROR_UNSIGNEDINTEGERRANGE:
+ errormessage = tr("Number exceeds unsigned integer range (") + QString::number(0) + tr(" to ") + QString::number(UINT_MAX) + tr(")");
+ break;
case ERROR_UNSERIALIZEFORMAT:
errormessage = tr("Unable to UnSerialize string");
break;
@@ -507,6 +514,9 @@ QString Error::getErrorMessage(char **sy
case WARNING_INTEGERRANGE:
errormessage = tr("Number exceeds integer range (") + QString::number(INT_MIN) + tr(" to ") + QString::number(INT_MAX) + tr("), zero used");
break;
+ case WARNING_UNSIGNEDINTEGERRANGE:
+ errormessage = tr("Number exceeds unsigned integer range (") + QString::number(0) + tr(" to ") + QString::number(UINT_MAX) + tr("), zero used");
+ break;
case WARNING_SOUNDNOTSEEKABLE:
errormessage = tr("Media file is not seekable");
break;
--- basic256-2.0.99.10.orig/ErrorCodes.h
+++ basic256-2.0.99.10/ErrorCodes.h
@@ -130,6 +130,7 @@
#define ERROR_MAPKEY 126
#define ERROR_RMDIR 127
#define ERROR_MKDIR 128
+#define ERROR_UNSIGNEDINTEGERRANGE 129
@@ -151,6 +152,7 @@
#define WARNING_VARNOTASSIGNED WARNING_START + ERROR_VARNOTASSIGNED
#define WARNING_LONGRANGE WARNING_START + ERROR_LONGRANGE
#define WARNING_INTEGERRANGE WARNING_START + ERROR_INTEGERRANGE
+#define WARNING_UNSIGNEDINTEGERRANGE WARNING_START + ERROR_UNSIGNEDINTEGERRANGE
#define WARNING_SOUNDNOTSEEKABLE WARNING_START + ERROR_SOUNDNOTSEEKABLE
#define WARNING_SOUNDLENGTH WARNING_START + ERROR_SOUNDLENGTH
#define WARNING_WAVOBSOLETE WARNING_START + ERROR_WAVOBSOLETE
--- basic256-2.0.99.10.orig/Interpreter.cpp
+++ basic256-2.0.99.10/Interpreter.cpp
@@ -394,6 +394,7 @@ QString Interpreter::opname(int op) {
case OP_PUSHFLOAT : return QString("OP_PUSHFLOAT");
case OP_PUSHINT : return QString("OP_PUSHINT");
case OP_PUSHLABEL : return QString("OP_PUSHLABEL");
+ case OP_PUSHLONG : return QString("OP_PUSHLONG");
case OP_PUSHSTRING : return QString("OP_PUSHSTRING");
case OP_PUTSLICE : return QString("OP_PUTSLICE");
case OP_RADIANS : return QString("OP_RADIANS");
@@ -676,7 +677,7 @@ int Interpreter::compileProgram(char *co
// because in debugMode it already call goToLine(1) at start
for(int i=0; i<numparsewarnings; i++) {
QString msg = tr("COMPILE WARNING");
- if (parsewarningtablelexingfilenumber!=0) {
+ if (parsewarningtablelexingfilenumber[i]!=0) {
msg += tr(" in included file '") + QString(include_filenames[parsewarningtablelexingfilenumber[i]]) + QStringLiteral("'");
} else if(gotowarning){
emit(goToLine(parsewarningtablelinenumber[i]));
@@ -837,10 +838,13 @@ int Interpreter::compileProgram(char *co
case COMPERR_ONERRORCALL:
msg += tr("Cannot pass arguments to a SUBROUTINE used by ONERROR statement");
break;
- case COMPERR_NUMBERTOOLARGE:
- msg += tr("Number too large");
+ case COMPERR_INTEGERTOOLARGE:
+ msg += tr("Integer number too large");
break;
-
+ case COMPERR_FLOATTOOLARGE:
+ msg += tr("Floating point number too large");
+ break;
+
default:
if(column==0) {
msg += tr("Syntax error around beginning line");
@@ -1441,15 +1445,16 @@ Interpreter::execByteCode() {
fprintf(stderr,"%08x %s ",(unsigned int) (op-wordCode), opname(*op).toUtf8().data());
if(optype(*op)==OPTYPE_INT) {
if ((*op)==OP_CURRLINE) {
- int includeFileNumber = (long) *(op+1) >> 24;
- int currentLine = (long) *(op+1) & 0xffffff;
- fprintf(stderr, "%d %d", includeFileNumber, currentLine);
+ int includeFileNumber = (unsigned int) *(op+1) >> 24;
+ int currentLine = (unsigned int) *(op+1) & 0xffffff;
+ fprintf(stderr, "%u u", includeFileNumber, currentLine);
} else {
- fprintf(stderr, "%ld", (long) *(op+1));
+ fprintf(stderr, "%d", (int) *(op+1));
}
}
if(optype(*op)==OPTYPE_FLOAT) fprintf(stderr, "%f", (float) *(op+1));
if(optype(*op)==OPTYPE_STRING) fprintf(stderr, "'%s'", (char *) (op+1));
+ if(optype(*op)==OPTYPE_LONG) fprintf(stderr, "'%ld'", (long) *(op+1));
if(optype(*op)==OPTYPE_LABEL){
int v = *(op+1);
fprintf(stderr, "lbl %s", ((v>=0&&v<numsyms)?symtable[v]:"__unknown__") );
@@ -2107,6 +2112,24 @@ fprintf(stderr,"in foreach map %d\n", d-
}
break;
+ case OPTYPE_LONG: {
+ //
+ // OPCODES with an long integer following in the wordCcode go in this switch
+ // double d is the number extracted from the wordCode
+ //
+ long *l = (long *) op;
+ op += bytesToFullWords(sizeof(long));
+ switch(opcode) {
+
+ case OP_PUSHLONG: {
+ stack->pushLong(*l);
+ }
+ break;
+
+ }
+ }
+ break;
+
case OPTYPE_STRING: {
//
// OPCODES with a string in the wordCcode go in this switch
@@ -2917,35 +2940,36 @@ fprintf(stderr,"in foreach map %d\n", d-
case OP_MIDX: {
// regex section string (MID regeX)
- // midx (expr, qtemp, start)
- // start - start position. String indices begin at 1. If negative start is given,
+ // midx (expr, tempqstr, start)
+ // start - start position. String indices begin at 1. If negative start is given
// then position is starting from the end of the string,
// where -1 is the last character position, -2 the second character from the end... and so on
int start = stack->popInt();
- QRegExp expr = QRegExp(stack->popQString());
- expr.setMinimal(regexMinimal);
- QString qtemp = stack->popQString();
+ QRegularExpression expr = QRegularExpression(stack->popQString(),
+ regexMinimal?QRegularExpression::InvertedGreedinessOption:QRegularExpression::NoPatternOption);
+ QString tempqstr = stack->popQString();
if(start == 0) {
error->q(ERROR_STRSTART);
stack->pushQString(QString(""));
} else {
- int pos;
- if (start==1) {
- pos = expr.indexIn(qtemp);
- } else if (start>1){
- pos = expr.indexIn(qtemp.mid(start-1));
- }else{
- pos = expr.indexIn(qtemp.mid(qtemp.length()+start));
+ // recalculate start to be zero based
+ if(start == 0) {
+ error->q(ERROR_STRSTART);
+ } else if (start>0){
+ start = start - 1;
+ } else {
+ start = tempqstr.length()+start;
+ if (start<0) start = 0;
}
-
- if (pos==-1) {
+ //
+ QRegularExpressionMatch match = expr.match(tempqstr, start);
+ if (match.hasMatch()) {
+ stack->pushQString(match.captured(1));
+ } else {
// did not find it - return ""
stack->pushQString(QString(""));
- } else {
- QStringList stuff = expr.capturedTexts();
- stack->pushQString(stuff[0]);
}
}
}
@@ -3067,22 +3091,29 @@ fprintf(stderr,"in foreach map %d\n", d-
// then position is starting from the end of the string,
// where -1 is the last character position, -2 the second character from the end... and so on
int start = stack->popInt();
- QRegExp expr = QRegExp(stack->popQString());
- expr.setMinimal(regexMinimal);
- QString qtemp = stack->popQString();
+ QRegularExpression expr = QRegularExpression(stack->popQString(),
+ regexMinimal?QRegularExpression::InvertedGreedinessOption:QRegularExpression::NoPatternOption);
+ QString tempqstr = stack->popQString();
- int pos=0;
+ // recalculate start to be zero based
if(start == 0) {
error->q(ERROR_STRSTART);
- } else if (start>0){
- pos = expr.indexIn(qtemp,start-1)+1;
- }else{
- int p = qtemp.length()+start;
- if(p<0)
- p=0;
- pos = expr.indexIn(qtemp, p)+1;
+ } else if (start>0){
+ start = start - 1;
+ } else {
+ start = tempqstr.length()+start;
+ if (start<0) start = 0;
}
- stack->pushInt(pos);
+ //
+
+ int pos=0; // not found
+
+ QRegularExpressionMatch match = expr.match(tempqstr, start);
+ if (match.hasMatch()) {
+ pos = match.capturedStart() + 1;
+ }
+
+ stack->pushInt(pos);
}
break;
@@ -4050,7 +4081,7 @@ fprintf(stderr,"in foreach map %d\n", d-
error->q(ERROR_RGB);
stack->pushLong(0);
} else {
- stack->pushInt( (int) QColor(rval,gval,bval,aval).rgba());
+ stack->pushUInt( (unsigned int) QColor(rval,gval,bval,aval).rgba());
}
}
break;
@@ -4060,16 +4091,16 @@ fprintf(stderr,"in foreach map %d\n", d-
int x = stack->popInt();
if(drawingOnScreen || drawto.isEmpty()){
QRgb rgb = graphwin->image->pixel(x,y);
- stack->pushInt((int) rgb);
+ stack->pushUInt((unsigned int) rgb);
}else{
QRgb rgb = images[drawto]->pixel(x,y);
- stack->pushInt((int) rgb);
+ stack->pushUInt((unsigned int) rgb);
}
}
break;
case OP_GETCOLOR: {
- stack->pushInt((int) drawingpen.color().rgba());
+ stack->pushUInt((unsigned int) drawingpen.color().rgba());
}
break;
@@ -4108,7 +4139,7 @@ fprintf(stderr,"in foreach map %d\n", d-
int tw, th;
for(th=0; th<h; th++) {
for(tw=0; tw<w; tw++) {
- DataElement* temp = new DataElement((int) r[counter]);
+ DataElement* temp = new DataElement((unsigned int) r[counter]);
d->arraySetData(tw,th,temp);
delete temp;
counter++;
@@ -4138,7 +4169,7 @@ fprintf(stderr,"in foreach map %d\n", d-
int counter = 0;
for (th=0;th<h;th++) {
for (tw=0; tw<w; tw++) {
- r[counter++] = (QRgb) convert->getInt(d->arrayGetData(tw,th)); // DONT RELEASE
+ r[counter++] = (QRgb) convert->getUInt(d->arrayGetData(tw,th)); // DONT RELEASE
}
}
//update painter only if needed (faster)
@@ -4604,25 +4635,24 @@ fprintf(stderr,"in foreach map %d\n", d-
break;
case OP_CLG: {
- int clearcolor = stack->popInt();
- QColor c = QColor::fromRgba((QRgb) clearcolor);
-
+ QColor c = stack->popQColor();
+
if (drawingOnScreen){
graphwin->image->fill(c);
if (!fastgraphics) waitForGraphics();
}else if(printing){
- if(printdocument->pageRect()==printdocument->paperRect()){
+ if(printdocument->pageRect(QPrinter::DevicePixel)==printdocument->paperRect(QPrinter::DevicePixel)){
//printer is in full page mode already
- painter->fillRect(printdocument->paperRect(),c);
+ painter->fillRect(printdocument->paperRect(QPrinter::DevicePixel),c);
}else{
//a good solution is to end painter and begin after setFullPage(true)
//this will reset origins for painter to top-left of the page
//but swiching back setFullPage(false) and starting again painter (begin) to page
//clear the page entirely.
- QRect r = printdocument->pageRect();
+ QRectF r = printdocument->pageRect(QPrinter::DevicePixel);
printdocument->setFullPage(true);
painter->translate(-r.left(),-r.top());
- painter->fillRect(printdocument->paperRect(),c);
+ painter->fillRect(printdocument->paperRect(QPrinter::DevicePixel),c);
printdocument->setFullPage(false);
painter->translate(r.topLeft());
}
@@ -5933,6 +5963,8 @@ fprintf(stderr,"in foreach map %d\n", d-
}
# else
error->q(ERROR_NOTIMPLEMENTED);
+ (void) data;
+ (void) port;
#endif
}
break;
@@ -5961,6 +5993,7 @@ fprintf(stderr,"in foreach map %d\n", d-
}
#else
error->q(ERROR_NOTIMPLEMENTED);
+ (void) port;
#endif
stack->pushInt(data);
}
@@ -6122,8 +6155,8 @@ fprintf(stderr,"in foreach map %d\n", d-
// regex replace function
QString qto = stack->popQString();
- QRegExp expr = QRegExp(stack->popQString());
- expr.setMinimal(regexMinimal);
+ QRegularExpression expr = QRegularExpression(stack->popQString(),
+ regexMinimal?QRegularExpression::InvertedGreedinessOption:QRegularExpression::NoPatternOption);
QString qhaystack = stack->popQString();
stack->pushQString(qhaystack.replace(expr, qto));
@@ -6146,8 +6179,8 @@ fprintf(stderr,"in foreach map %d\n", d-
case OP_COUNTX: {
// regex count function
- QRegExp expr = QRegExp(stack->popQString());
- expr.setMinimal(regexMinimal);
+ QRegularExpression expr = QRegularExpression(stack->popQString(),
+ regexMinimal?QRegularExpression::InvertedGreedinessOption:QRegularExpression::NoPatternOption);
QString qhaystack = stack->popQString();
stack->pushInt((int) (qhaystack.count(expr)));
@@ -6421,7 +6454,7 @@ fprintf(stderr,"in foreach map %d\n", d-
break;
case OP_GETBRUSHCOLOR: {
- stack->pushInt((int) drawingbrush.color().rgba());
+ stack->pushUInt((unsigned int) drawingbrush.color().rgba());
}
break;
@@ -6522,8 +6555,8 @@ fprintf(stderr,"in foreach map %d\n", d-
if(printdocument->isValid()){
printdocument->setCreator(QString(SETTINGSAPP));
printdocument->setDocName(editwin->title);
- printdocument->setPaperSize((QPrinter::PaperSize) settingsPrinterPaper);
- printdocument->setOrientation((QPrinter::Orientation) settingsPrinterOrient);
+ printdocument->setPageSize(QPageSize((QPageSize::PageSizeId ) settingsPrinterPaper));
+ printdocument->setPageOrientation((QPageLayout::Orientation) settingsPrinterOrient);
if (!setPainterTo(printdocument)) {
error->q(ERROR_PRINTEROPEN);
setGraph(drawto); //if drawing on printer fails, then fall back to graph area
@@ -6628,6 +6661,10 @@ fprintf(stderr,"in foreach map %d\n", d-
emit(outputReady(QString("%1 %2 \"%3\"\n").arg(offset,8,16,QChar('0')).arg(opname(currentop),-20).arg((char*) o)));
int len = bytesToFullWords(strlen((char*) o) + 1);
o += len;
+ } else if (optype(currentop) == OPTYPE_LONG) {
+ // op has a single long integer arg
+ emit(outputReady(QString("%1 %2 %3\n").arg(offset,8,16,QChar('0')).arg(opname(currentop),-20).arg((long) *o)));
+ o += bytesToFullWords(sizeof(long));
}
waitCond->wait(mymutex);
mymutex->unlock();
@@ -6890,17 +6927,17 @@ fprintf(stderr,"in foreach map %d\n", d-
QStringList list;
if(opcode==OP_EXPLODE) {
- list = qhaystack.split(qneedle, QString::KeepEmptyParts , casesens);
+ list = qhaystack.split(qneedle, Qt::KeepEmptyParts , casesens);
} else {
- QRegExp expr = QRegExp(qneedle);
- expr.setMinimal(regexMinimal);
- if (expr.captureCount()>0) {
+ QRegularExpression expr = QRegularExpression(qneedle,
+ regexMinimal?QRegularExpression::InvertedGreedinessOption:QRegularExpression::NoPatternOption);
+ if (expr.captureCount()>0) {
// if we have captures in our regex then return them
- expr.indexIn(qhaystack);
- list = expr.capturedTexts();
+ QRegularExpressionMatch match = expr.match(qhaystack);
+ list = match.capturedTexts();
} else {
// if it is a simple regex without captures then split
- list = qhaystack.split(expr, QString::KeepEmptyParts);
+ list = qhaystack.split(expr, Qt::KeepEmptyParts);
}
}
@@ -7016,13 +7053,13 @@ fprintf(stderr,"in foreach map %d\n", d-
case OP_IMAGENEW: {
- int c = stack->popInt();
+ QColor c = stack->popQColor();
int h = stack->popInt();
int w = stack->popInt();
lastImageId++;
QString id = QString("image:") + QString::number(lastImageId);
images[id] = new QImage(w, h, QImage::Format_ARGB32);
- images[id]->fill(QColor::fromRgba((QRgb) c));
+ images[id]->fill(c);
stack->pushQString(id);
}
break;
--- basic256-2.0.99.10.orig/Interpreter.h
+++ basic256-2.0.99.10/Interpreter.h
@@ -43,13 +43,13 @@
#include <QProcess>
-#include <QtPrintSupport/QPrinter>
-#include <QtPrintSupport/QPrinterInfo>
+#include <QPrinter>
+#include <QPrinterInfo>
-#include <QtSql/QSqlDatabase>
-#include <QtSql/QSqlQuery>
-#include <QtSql/QSqlRecord>
-#include <QtSql/QSqlError>
+#include <QSqlDatabase>
+#include <QSqlQuery>
+#include <QSqlRecord>
+#include <QSqlError>
#ifndef ANDROID
// includes for all ports EXCEPT android
@@ -292,10 +292,10 @@ class Interpreter : public QThread
int netsockfd[NUMSOCKETS];
DIR *directorypointer; // used by DIR function
- QTime runtimer; // used by MSEC function
+ QElapsedTimer runtimer; // used by MSEC function
//SoundSystem *sound;
int includeFileNumber;
- bool regexMinimal; // flag to tell QRegExp to be greedy (false) or minimal (true)
+ bool regexMinimal; // flag to tell QRegularExpression to be greedy (false) or minimal (true)
bool printing;
QPrinter *printdocument;
--- basic256-2.0.99.10.orig/LEX/basicParse.l
+++ basic256-2.0.99.10/LEX/basicParse.l
@@ -92,7 +92,7 @@ void unputcolon();
%x INCLUDE
%x INCLUDE_FILE
-constinteger ([0-9]{1,9}|1[0-9]{9}|2(0[0-9]{8}|1([0-3][0-9]{7}|4([0-6][0-9]{6}|7([0-3][0-9]{5}|4([0-7][0-9]{4}|8([0-2][0-9]{3}|3([0-5][0-9]{2}|6([0-3][0-9]|4[0-7])))))))))
+constinteger [0-9]+
constdecimal [0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?
constbinary 0[bB][01]+
consthex 0[xX][0-9a-fA-F]+
@@ -595,8 +595,17 @@ zfill [Zz][Ff][Ii][Ll][Ll]
{constfalse} { count(); return B256BOOLFALSE; }
{consttrue} { count(); return B256BOOLTRUE; }
-{constinteger} { count(); yylval.number = atoi(yytext); return B256INTEGER; }
-{constdecimal} { count(); yylval.floatnum = atof(yytext); return B256FLOAT; }
+{constinteger} {
+ count();
+ yylval.longnum = atol(yytext);
+ //printf("constinteger %s %li\n", yytext, yylval.longnum);
+ return B256INTEGER;
+ }
+{constdecimal} {
+ count();
+ yylval.floatnum = atof(yytext);
+ return B256FLOAT;
+ }
{constbinary} {
count();
yylval.string = strdup(yytext + 2);
@@ -1244,7 +1253,7 @@ mod { count(); return B256MOD; }
while (*c != ':') c++;
*c = 0x0;
//
- yylval.number = getSymbol(temp); // get existing or create new
+ yylval.intnum = getSymbol(temp); // get existing or create new
free(temp);
//
return B256LABEL;
@@ -1252,7 +1261,7 @@ mod { count(); return B256MOD; }
{variable} {
count();
- yylval.number = getSymbol(yytext);
+ yylval.intnum = getSymbol(yytext);
return B256VARIABLE;
}
--- basic256-2.0.99.10.orig/LEX/basicParse.y
+++ basic256-2.0.99.10/LEX/basicParse.y
@@ -141,30 +141,37 @@
return((size + sizeof(int) - 1) / sizeof(int));
}
+ void addInt(int data) {
+ checkWordMem(1);
+ wordCode[wordOffset] = data;
+ wordOffset++;
+ }
+
void addOp(int op) {
- checkWordMem(1);
- wordCode[wordOffset] = op;
- wordOffset++;
+ addInt(op);
//printf("line=%i addOp op=%i\n",linenumber, op);
}
- void addData(int data) {
- checkWordMem(1);
- wordCode[wordOffset] = data;
- wordOffset++;
- }
-
- void addIntOp(int op, int data) {
+ void addIntOp(int op, long data) {
addOp(op);
- addData(data);
+ addInt(data);
}
- void addIntIntOp(int op, int data, int data2) {
+ void addIntIntOp(int op, long data, long data2) {
addOp(op);
- addData(data);
- addData(data2);
+ addInt(data);
+ addInt(data2);
}
+ void addLongOp(int op, long data) {
+ addOp(op);
+ unsigned int wlen = bytesToFullWords(sizeof(long));
+ checkWordMem(wlen);
+ long *temp = (long *) (wordCode + wordOffset);
+ *temp = data;
+ wordOffset += wlen;
+ }
+
void addFloatOp(int op, double data) {
addOp(op);
unsigned int wlen = bytesToFullWords(sizeof(double));
@@ -860,20 +867,21 @@
%token B256YELLOW
%token B256ZFILL
-%union anytype {
- int number;
+%union {
+ int intnum;
+ long longnum;
double floatnum;
char *string;
}
-%token <number> B256INTEGER
+%token <longnum> B256INTEGER
%token <floatnum> B256FLOAT
%token <string> B256STRING
%token <string> B256HEXCONST
%token <string> B256BINCONST
%token <string> B256OCTCONST
-%token <number> B256VARIABLE
-%token <number> B256LABEL
+%token <intnum> B256VARIABLE
+%token <intnum> B256LABEL
%right ','
@@ -976,7 +984,7 @@ array_indexing:
'[' expr ',' expr ']'
| '[' expr ']' '[' expr ']'
| '[' expr ']' {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_STACKSWAP);
}
;
@@ -1034,8 +1042,8 @@ functionvariables:
// a mustached list of mustached lists (2 dimensional array)
listoflists:
'{' listinlist '}'{
- addIntOp(OP_PUSHINT, numberoflists); // number of lists (y dim)
- addIntOp(OP_PUSHINT, listlenmax); // maximum number of expressions (x dim)
+ addLongOp(OP_PUSHLONG, numberoflists); // number of lists (y dim)
+ addLongOp(OP_PUSHLONG, listlenmax); // maximum number of expressions (x dim)
#ifdef DEBUG
fprintf(stderr, "listlenmax %d\n", listlenmax);
#endif
@@ -1046,7 +1054,7 @@ listoflists:
// child of list of lists representing a single row of values
listinlist:
listitems {
- addIntOp(OP_PUSHINT, listlen);
+ addLongOp(OP_PUSHLONG, listlen);
if (listlen>listlenmax) listlenmax=listlen;
listlen = 0;
numberoflists = 1;
@@ -1059,7 +1067,7 @@ listinlist:
// a one dimensional array
listofitems:
'{' listitems '}' {
- addIntOp(OP_PUSHINT, listlen);
+ addLongOp(OP_PUSHLONG, listlen);
if (listlen>listlenmax) listlenmax=listlen;
listlen = 0;
}
@@ -1075,7 +1083,7 @@ listitems:
// a one dimensional array
listofmapitems:
'{' mapitems '}' {
- addIntOp(OP_PUSHINT, listlen);
+ addLongOp(OP_PUSHLONG, listlen);
if (listlen>listlenmax) listlenmax=listlen;
listlen = 0;
numberoflists = 0;
@@ -1217,13 +1225,13 @@ expr_multi:
expr_function:
variable '(' callexprlist ')' {
// function call with arguments
- addIntOp(OP_PUSHINT, listlen); //push number of arguments passed to compare with FUNCTION definition
+ addLongOp(OP_PUSHLONG, listlen); //push number of arguments passed to compare with FUNCTION definition
addIntOp(OP_CALLFUNCTION, varnumber[--nvarnumber]);
addIntOp(OP_CURRLINE, filenumber * 0x1000000 + linenumber);
}
| variable '(' ')' {
// function call without arguments
- addIntOp(OP_PUSHINT, 0); //push number of arguments passed to compare with FUNCTION definition
+ addLongOp(OP_PUSHLONG, 0); //push number of arguments passed to compare with FUNCTION definition
addIntOp(OP_CALLFUNCTION, varnumber[--nvarnumber]);
addIntOp(OP_CURRLINE, filenumber * 0x1000000 + linenumber);
}
@@ -1236,46 +1244,46 @@ expr_function:
### Constants ###
########################################### */
expr_constants:
- B256BLACK args_none { addIntOp(OP_PUSHINT, 0xff000000); }
- | B256BLUE args_none { addIntOp(OP_PUSHINT, 0xff0000ff); }
- | B256BOOLFALSE args_none { addIntOp(OP_PUSHINT, 0); }
- | B256BOOLTRUE args_none { addIntOp(OP_PUSHINT, 1); }
- | B256CLEAR args_none { addIntOp(OP_PUSHINT, 0x00); }
- | B256CYAN args_none { addIntOp(OP_PUSHINT, 0xff00ffff); }
- | B256DARKBLUE args_none { addIntOp(OP_PUSHINT, 0xff000080); }
- | B256DARKCYAN args_none { addIntOp(OP_PUSHINT, 0xff008080); }
- | B256DARKGREEN args_none { addIntOp(OP_PUSHINT, 0xff008000); }
- | B256DARKGREY args_none { addIntOp(OP_PUSHINT, 0xff808080); }
- | B256DARKORANGE args_none { addIntOp(OP_PUSHINT, 0xffb03d00); }
- | B256DARKPURPLE args_none { addIntOp(OP_PUSHINT, 0xff800080); }
- | B256DARKRED args_none { addIntOp(OP_PUSHINT, 0xff800000); }
- | B256DARKYELLOW args_none { addIntOp(OP_PUSHINT, 0xff808000); }
- | B256GREEN args_none { addIntOp(OP_PUSHINT, 0xff00ff00); }
- | B256GREY args_none { addIntOp(OP_PUSHINT, 0xffa4a4a4); }
- | B256MOUSEBUTTON_CENTER args_none { addIntOp(OP_PUSHINT, MOUSEBUTTON_CENTER); }
- | B256MOUSEBUTTON_DOUBLECLICK args_none { addIntOp(OP_PUSHINT, MOUSEBUTTON_DOUBLECLICK); }
- | B256MOUSEBUTTON_LEFT args_none { addIntOp(OP_PUSHINT, MOUSEBUTTON_LEFT); }
- | B256MOUSEBUTTON_NONE args_none { addIntOp(OP_PUSHINT, MOUSEBUTTON_NONE); }
- | B256MOUSEBUTTON_RIGHT args_none { addIntOp(OP_PUSHINT, MOUSEBUTTON_RIGHT); }
- | B256ORANGE args_none { addIntOp(OP_PUSHINT, 0xffff6600); }
- | B256OSTYPE_ANDROID args_none { addIntOp(OP_PUSHINT, OSTYPE_ANDROID); }
- | B256OSTYPE_LINUX args_none { addIntOp(OP_PUSHINT, OSTYPE_LINUX); }
- | B256OSTYPE_MACINTOSH args_none { addIntOp(OP_PUSHINT, OSTYPE_MACINTOSH); }
- | B256OSTYPE_WINDOWS args_none { addIntOp(OP_PUSHINT, OSTYPE_WINDOWS); }
- | B256PURPLE args_none { addIntOp(OP_PUSHINT, 0xffff00ff); }
- | B256RED args_none { addIntOp(OP_PUSHINT, 0xffff0000); }
- | B256SLICE_ALL args_none { addIntOp(OP_PUSHINT, SLICE_ALL); }
- | B256SLICE_PAINT args_none { addIntOp(OP_PUSHINT, SLICE_PAINT); }
- | B256SLICE_SPRITE args_none { addIntOp(OP_PUSHINT, SLICE_SPRITE); }
- | B256TYPE_ARRAY args_none { addIntOp(OP_PUSHINT, T_ARRAY); }
- | B256TYPE_FLOAT args_none { addIntOp(OP_PUSHINT, T_FLOAT); }
- | B256TYPE_INT args_none { addIntOp(OP_PUSHINT, T_INT); }
- | B256TYPE_MAP args_none { addIntOp(OP_PUSHINT, T_MAP); }
- | B256TYPE_REF args_none { addIntOp(OP_PUSHINT, T_REF); }
- | B256TYPE_STRING args_none { addIntOp(OP_PUSHINT, T_STRING); }
- | B256TYPE_UNASSIGNED args_none { addIntOp(OP_PUSHINT, T_UNASSIGNED); }
- | B256WHITE args_none { addIntOp(OP_PUSHINT, 0xffffffff); }
- | B256YELLOW args_none { addIntOp(OP_PUSHINT, 0xffffff00); }
+ B256BLACK args_none { addLongOp(OP_PUSHLONG, 0xff000000L); }
+ | B256BLUE args_none { addLongOp(OP_PUSHLONG, 0xff0000ffL); }
+ | B256BOOLFALSE args_none { addLongOp(OP_PUSHLONG, 0); }
+ | B256BOOLTRUE args_none { addLongOp(OP_PUSHLONG, 1); }
+ | B256CLEAR args_none { addLongOp(OP_PUSHLONG, 0x00); }
+ | B256CYAN args_none { addLongOp(OP_PUSHLONG, 0xff00ffffL); }
+ | B256DARKBLUE args_none { addLongOp(OP_PUSHLONG, 0xff000080L); }
+ | B256DARKCYAN args_none { addLongOp(OP_PUSHLONG, 0xff008080L); }
+ | B256DARKGREEN args_none { addLongOp(OP_PUSHLONG, 0xff008000L); }
+ | B256DARKGREY args_none { addLongOp(OP_PUSHLONG, 0xff808080L); }
+ | B256DARKORANGE args_none { addLongOp(OP_PUSHLONG, 0xffb03d00L); }
+ | B256DARKPURPLE args_none { addLongOp(OP_PUSHLONG, 0xff800080L); }
+ | B256DARKRED args_none { addLongOp(OP_PUSHLONG, 0xff800000L); }
+ | B256DARKYELLOW args_none { addLongOp(OP_PUSHLONG, 0xff808000L); }
+ | B256GREEN args_none { addLongOp(OP_PUSHLONG, 0xff00ff00L); }
+ | B256GREY args_none { addLongOp(OP_PUSHLONG, 0xffa4a4a4L); }
+ | B256MOUSEBUTTON_CENTER args_none { addLongOp(OP_PUSHLONG, MOUSEBUTTON_CENTER); }
+ | B256MOUSEBUTTON_DOUBLECLICK args_none { addLongOp(OP_PUSHLONG, MOUSEBUTTON_DOUBLECLICK); }
+ | B256MOUSEBUTTON_LEFT args_none { addLongOp(OP_PUSHLONG, MOUSEBUTTON_LEFT); }
+ | B256MOUSEBUTTON_NONE args_none { addLongOp(OP_PUSHLONG, MOUSEBUTTON_NONE); }
+ | B256MOUSEBUTTON_RIGHT args_none { addLongOp(OP_PUSHLONG, MOUSEBUTTON_RIGHT); }
+ | B256ORANGE args_none { addLongOp(OP_PUSHLONG, 0xffff6600L); }
+ | B256OSTYPE_ANDROID args_none { addLongOp(OP_PUSHLONG, OSTYPE_ANDROID); }
+ | B256OSTYPE_LINUX args_none { addLongOp(OP_PUSHLONG, OSTYPE_LINUX); }
+ | B256OSTYPE_MACINTOSH args_none { addLongOp(OP_PUSHLONG, OSTYPE_MACINTOSH); }
+ | B256OSTYPE_WINDOWS args_none { addLongOp(OP_PUSHLONG, OSTYPE_WINDOWS); }
+ | B256PURPLE args_none { addLongOp(OP_PUSHLONG, 0xffff00ffL); }
+ | B256RED args_none { addLongOp(OP_PUSHLONG, 0xffff0000L); }
+ | B256SLICE_ALL args_none { addLongOp(OP_PUSHLONG, SLICE_ALL); }
+ | B256SLICE_PAINT args_none { addLongOp(OP_PUSHLONG, SLICE_PAINT); }
+ | B256SLICE_SPRITE args_none { addLongOp(OP_PUSHLONG, SLICE_SPRITE); }
+ | B256TYPE_ARRAY args_none { addLongOp(OP_PUSHLONG, T_ARRAY); }
+ | B256TYPE_FLOAT args_none { addLongOp(OP_PUSHLONG, T_FLOAT); }
+ | B256TYPE_INT args_none { addLongOp(OP_PUSHLONG, T_INT); }
+ | B256TYPE_MAP args_none { addLongOp(OP_PUSHLONG, T_MAP); }
+ | B256TYPE_REF args_none { addLongOp(OP_PUSHLONG, T_REF); }
+ | B256TYPE_STRING args_none { addLongOp(OP_PUSHLONG, T_STRING); }
+ | B256TYPE_UNASSIGNED args_none { addLongOp(OP_PUSHLONG, T_UNASSIGNED); }
+ | B256WHITE args_none { addLongOp(OP_PUSHLONG, 0xffffffffL); }
+ | B256YELLOW args_none { addLongOp(OP_PUSHLONG, 0xffffff00L); }
@@ -1284,385 +1292,385 @@ expr_constants:
########################################### */
expr_errors:
B256ERROR_ARGUMENTCOUNT args_none {
- addIntOp(OP_PUSHINT, ERROR_ARGUMENTCOUNT);
+ addLongOp(OP_PUSHLONG, ERROR_ARGUMENTCOUNT);
}
| B256ERROR_ARRAYELEMENT args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYELEMENT);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYELEMENT);
}
| B256ERROR_ARRAYEVEN args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYEVEN);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYEVEN);
}
| B256ERROR_ARRAYEXPR args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYEXPR);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYEXPR);
}
| B256ERROR_ARRAYINDEX args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYINDEX);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYINDEX);
}
| B256ERROR_ARRAYINDEXMISSING args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYINDEXMISSING);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYINDEXMISSING);
}
| B256ERROR_ARRAYLENGTH2D args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYLENGTH2D);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYLENGTH2D);
}
| B256ERROR_ARRAYNITEMS args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYNITEMS);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYNITEMS);
}
| B256ERROR_ARRAYSIZELARGE args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYSIZELARGE);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYSIZELARGE);
}
| B256ERROR_ARRAYSIZESMALL args_none {
- addIntOp(OP_PUSHINT, ERROR_ARRAYSIZESMALL);
+ addLongOp(OP_PUSHLONG, ERROR_ARRAYSIZESMALL);
}
| B256ERROR_ASINACOSRANGE args_none {
- addIntOp(OP_PUSHINT, ERROR_ASINACOSRANGE);
+ addLongOp(OP_PUSHLONG, ERROR_ASINACOSRANGE);
}
| B256ERROR_BOOLEANCONV args_none {
- addIntOp(OP_PUSHINT, ERROR_BOOLEANCONV);
+ addLongOp(OP_PUSHLONG, ERROR_BOOLEANCONV);
}
| B256ERROR_DBCOLNO args_none {
- addIntOp(OP_PUSHINT, ERROR_DBCOLNO);
+ addLongOp(OP_PUSHLONG, ERROR_DBCOLNO);
}
| B256ERROR_DBCONNNUMBER args_none {
- addIntOp(OP_PUSHINT, ERROR_DBCONNNUMBER);
+ addLongOp(OP_PUSHLONG, ERROR_DBCONNNUMBER);
}
| B256ERROR_DBNOTOPEN args_none {
- addIntOp(OP_PUSHINT, ERROR_DBNOTOPEN);
+ addLongOp(OP_PUSHLONG, ERROR_DBNOTOPEN);
}
| B256ERROR_DBNOTSET args_none {
- addIntOp(OP_PUSHINT, ERROR_DBNOTSET);
+ addLongOp(OP_PUSHLONG, ERROR_DBNOTSET);
}
| B256ERROR_DBNOTSETROW args_none {
- addIntOp(OP_PUSHINT, ERROR_DBNOTSETROW);
+ addLongOp(OP_PUSHLONG, ERROR_DBNOTSETROW);
}
| B256ERROR_DBOPEN args_none {
- addIntOp(OP_PUSHINT, ERROR_DBOPEN);
+ addLongOp(OP_PUSHLONG, ERROR_DBOPEN);
}
| B256ERROR_DBQUERY args_none {
- addIntOp(OP_PUSHINT, ERROR_DBQUERY);
+ addLongOp(OP_PUSHLONG, ERROR_DBQUERY);
}
| B256ERROR_DBSETNUMBER args_none {
- addIntOp(OP_PUSHINT, ERROR_DBSETNUMBER);
+ addLongOp(OP_PUSHLONG, ERROR_DBSETNUMBER);
}
| B256ERROR_DIVZERO args_none {
- addIntOp(OP_PUSHINT, ERROR_DIVZERO);
+ addLongOp(OP_PUSHLONG, ERROR_DIVZERO);
}
| B256ERROR_DOWNLOAD args_none {
- addIntOp(OP_PUSHINT, ERROR_DOWNLOAD);
+ addLongOp(OP_PUSHLONG, ERROR_DOWNLOAD);
}
| B256ERROR_ENVELOPEMAX args_none {
- addIntOp(OP_PUSHINT, ERROR_ENVELOPEMAX);
+ addLongOp(OP_PUSHLONG, ERROR_ENVELOPEMAX);
}
| B256ERROR_ENVELOPEODD args_none {
- addIntOp(OP_PUSHINT, ERROR_ENVELOPEODD);
+ addLongOp(OP_PUSHLONG, ERROR_ENVELOPEODD);
}
| B256ERROR_EXPECTEDARRAY args_none {
- addIntOp(OP_PUSHINT, ERROR_EXPECTEDARRAY);
+ addLongOp(OP_PUSHLONG, ERROR_EXPECTEDARRAY);
}
| B256ERROR_EXPECTEDSOUND args_none {
- addIntOp(OP_PUSHINT, ERROR_EXPECTEDSOUND);
+ addLongOp(OP_PUSHLONG, ERROR_EXPECTEDSOUND);
}
| B256ERROR_FILENOTOPEN args_none {
- addIntOp(OP_PUSHINT, ERROR_FILENOTOPEN);
+ addLongOp(OP_PUSHLONG, ERROR_FILENOTOPEN);
}
| B256ERROR_FILENUMBER args_none {
- addIntOp(OP_PUSHINT, ERROR_FILENUMBER);
+ addLongOp(OP_PUSHLONG, ERROR_FILENUMBER);
}
| B256ERROR_FILEOPEN args_none {
- addIntOp(OP_PUSHINT, ERROR_FILEOPEN);
+ addLongOp(OP_PUSHLONG, ERROR_FILEOPEN);
}
| B256ERROR_FILEOPERATION args_none {
- addIntOp(OP_PUSHINT, ERROR_FILEOPERATION);
+ addLongOp(OP_PUSHLONG, ERROR_FILEOPERATION);
}
| B256ERROR_FILERESET args_none {
- addIntOp(OP_PUSHINT, ERROR_FILERESET);
+ addLongOp(OP_PUSHLONG, ERROR_FILERESET);
}
| B256ERROR_FILEWRITE args_none {
- addIntOp(OP_PUSHINT, ERROR_FILEWRITE);
+ addLongOp(OP_PUSHLONG, ERROR_FILEWRITE);
}
| B256ERROR_FOLDER args_none {
- addIntOp(OP_PUSHINT, ERROR_FOLDER);
+ addLongOp(OP_PUSHLONG, ERROR_FOLDER);
}
| B256ERROR_FREEDB args_none {
- addIntOp(OP_PUSHINT, ERROR_FREEDB);
+ addLongOp(OP_PUSHLONG, ERROR_FREEDB);
}
| B256ERROR_FREEDBSET args_none {
- addIntOp(OP_PUSHINT, ERROR_FREEDBSET);
+ addLongOp(OP_PUSHLONG, ERROR_FREEDBSET);
}
| B256ERROR_FREEFILE args_none {
- addIntOp(OP_PUSHINT, ERROR_FREEFILE);
+ addLongOp(OP_PUSHLONG, ERROR_FREEFILE);
}
| B256ERROR_FREENET args_none {
- addIntOp(OP_PUSHINT, ERROR_FREENET);
+ addLongOp(OP_PUSHLONG, ERROR_FREENET);
}
| B256ERROR_HARMONICLIST args_none {
- addIntOp(OP_PUSHINT, ERROR_HARMONICLIST);
+ addLongOp(OP_PUSHLONG, ERROR_HARMONICLIST);
}
| B256ERROR_HARMONICNUMBER args_none {
- addIntOp(OP_PUSHINT, ERROR_HARMONICNUMBER);
+ addLongOp(OP_PUSHLONG, ERROR_HARMONICNUMBER);
}
| B256ERROR_IMAGEFILE args_none {
- addIntOp(OP_PUSHINT, ERROR_IMAGEFILE);
+ addLongOp(OP_PUSHLONG, ERROR_IMAGEFILE);
}
| B256ERROR_IMAGERESOURCE args_none {
- addIntOp(OP_PUSHINT, ERROR_IMAGERESOURCE);
+ addLongOp(OP_PUSHLONG, ERROR_IMAGERESOURCE);
}
| B256ERROR_IMAGESAVETYPE args_none {
- addIntOp(OP_PUSHINT, ERROR_IMAGESAVETYPE);
+ addLongOp(OP_PUSHLONG, ERROR_IMAGESAVETYPE);
}
| B256ERROR_IMAGESCALE args_none {
- addIntOp(OP_PUSHINT, ERROR_IMAGESCALE);
+ addLongOp(OP_PUSHLONG, ERROR_IMAGESCALE);
}
| B256ERROR_INFINITY args_none {
- addIntOp(OP_PUSHINT, ERROR_INFINITY);
+ addLongOp(OP_PUSHLONG, ERROR_INFINITY);
}
| B256ERROR_INTEGERRANGE args_none {
- addIntOp(OP_PUSHINT, ERROR_INTEGERRANGE);
+ addLongOp(OP_PUSHLONG, ERROR_INTEGERRANGE);
}
| B256ERROR_INVALIDKEYNAME args_none {
- addIntOp(OP_PUSHINT, ERROR_INVALIDKEYNAME);
+ addLongOp(OP_PUSHLONG, ERROR_INVALIDKEYNAME);
}
| B256ERROR_INVALIDPROGNAME args_none {
- addIntOp(OP_PUSHINT, ERROR_INVALIDPROGNAME);
+ addLongOp(OP_PUSHLONG, ERROR_INVALIDPROGNAME);
}
| B256ERROR_INVALIDRESOURCE args_none {
- addIntOp(OP_PUSHINT, ERROR_INVALIDRESOURCE);
+ addLongOp(OP_PUSHLONG, ERROR_INVALIDRESOURCE);
}
| B256ERROR_LOGRANGE args_none {
- addIntOp(OP_PUSHINT, ERROR_LOGRANGE);
+ addLongOp(OP_PUSHLONG, ERROR_LOGRANGE);
}
| B256ERROR_LONGRANGE args_none {
- addIntOp(OP_PUSHINT, ERROR_LONGRANGE);
+ addLongOp(OP_PUSHLONG, ERROR_LONGRANGE);
}
| B256ERROR_MAXRECURSE args_none {
- addIntOp(OP_PUSHINT, ERROR_MAXRECURSE);
+ addLongOp(OP_PUSHLONG, ERROR_MAXRECURSE);
}
| B256ERROR_NETACCEPT args_none {
- addIntOp(OP_PUSHINT, ERROR_NETACCEPT);
+ addLongOp(OP_PUSHLONG, ERROR_NETACCEPT);
}
| B256ERROR_NETBIND args_none {
- addIntOp(OP_PUSHINT, ERROR_NETBIND);
+ addLongOp(OP_PUSHLONG, ERROR_NETBIND);
}
| B256ERROR_NETCONN args_none {
- addIntOp(OP_PUSHINT, ERROR_NETCONN);
+ addLongOp(OP_PUSHLONG, ERROR_NETCONN);
}
| B256ERROR_NETHOST args_none {
- addIntOp(OP_PUSHINT, ERROR_NETHOST);
+ addLongOp(OP_PUSHLONG, ERROR_NETHOST);
}
| B256ERROR_NETNONE args_none {
- addIntOp(OP_PUSHINT, ERROR_NETNONE);
+ addLongOp(OP_PUSHLONG, ERROR_NETNONE);
}
| B256ERROR_NETREAD args_none {
- addIntOp(OP_PUSHINT, ERROR_NETREAD);
+ addLongOp(OP_PUSHLONG, ERROR_NETREAD);
}
| B256ERROR_NETSOCK args_none {
- addIntOp(OP_PUSHINT, ERROR_NETSOCK);
+ addLongOp(OP_PUSHLONG, ERROR_NETSOCK);
}
| B256ERROR_NETSOCKNUMBER args_none {
- addIntOp(OP_PUSHINT, ERROR_NETSOCKNUMBER);
+ addLongOp(OP_PUSHLONG, ERROR_NETSOCKNUMBER);
}
| B256ERROR_NETSOCKOPT args_none {
- addIntOp(OP_PUSHINT, ERROR_NETSOCKOPT);
+ addLongOp(OP_PUSHLONG, ERROR_NETSOCKOPT);
}
| B256ERROR_NETWRITE args_none {
- addIntOp(OP_PUSHINT, ERROR_NETWRITE);
+ addLongOp(OP_PUSHLONG, ERROR_NETWRITE);
}
| B256ERROR_NEXTNOFOR args_none {
- addIntOp(OP_PUSHINT, ERROR_NEXTNOFOR);
+ addLongOp(OP_PUSHLONG, ERROR_NEXTNOFOR);
}
| B256ERROR_NONE args_none {
- addIntOp(OP_PUSHINT, ERROR_NONE);
+ addLongOp(OP_PUSHLONG, ERROR_NONE);
}
| B256ERROR_NOSUCHFUNCTION args_none {
- addIntOp(OP_PUSHINT, ERROR_NOSUCHFUNCTION);
+ addLongOp(OP_PUSHLONG, ERROR_NOSUCHFUNCTION);
}
| B256ERROR_NOSUCHLABEL args_none {
- addIntOp(OP_PUSHINT, ERROR_NOSUCHLABEL);
+ addLongOp(OP_PUSHLONG, ERROR_NOSUCHLABEL);
}
| B256ERROR_NOSUCHSUBROUTINE args_none {
- addIntOp(OP_PUSHINT, ERROR_NOSUCHSUBROUTINE);
+ addLongOp(OP_PUSHLONG, ERROR_NOSUCHSUBROUTINE);
}
| B256ERROR_NOTARRAY args_none {
- addIntOp(OP_PUSHINT, ERROR_NOTARRAY);
+ addLongOp(OP_PUSHLONG, ERROR_NOTARRAY);
}
| B256ERROR_NOTIMPLEMENTED args_none {
- addIntOp(OP_PUSHINT, ERROR_NOTIMPLEMENTED);
+ addLongOp(OP_PUSHLONG, ERROR_NOTIMPLEMENTED);
}
| B256ERROR_NUMBERCONV args_none {
- addIntOp(OP_PUSHINT, ERROR_NUMBERCONV);
+ addLongOp(OP_PUSHLONG, ERROR_NUMBERCONV);
}
| B256ERROR_NUMBEREXPR args_none {
- addIntOp(OP_PUSHINT, ERROR_NUMBEREXPR);
+ addLongOp(OP_PUSHLONG, ERROR_NUMBEREXPR);
}
| B256ERROR_ONEDIMENSIONAL args_none {
- addIntOp(OP_PUSHINT, ERROR_ONEDIMENSIONAL);
+ addLongOp(OP_PUSHLONG, ERROR_ONEDIMENSIONAL);
}
| B256ERROR_ONERRORSUB args_none {
- addIntOp(OP_PUSHINT, ERROR_ONERRORSUB);
+ addLongOp(OP_PUSHLONG, ERROR_ONERRORSUB);
}
| B256ERROR_PENWIDTH args_none {
- addIntOp(OP_PUSHINT, ERROR_PENWIDTH);
+ addLongOp(OP_PUSHLONG, ERROR_PENWIDTH);
}
| B256ERROR_PERMISSION args_none {
- addIntOp(OP_PUSHINT, ERROR_PERMISSION);
+ addLongOp(OP_PUSHLONG, ERROR_PERMISSION);
}
| B256ERROR_POLYPOINTS args_none {
- addIntOp(OP_PUSHINT, ERROR_POLYPOINTS);
+ addLongOp(OP_PUSHLONG, ERROR_POLYPOINTS);
}
| B256ERROR_PRINTERNOTOFF args_none {
- addIntOp(OP_PUSHINT, ERROR_PRINTERNOTOFF);
+ addLongOp(OP_PUSHLONG, ERROR_PRINTERNOTOFF);
}
| B256ERROR_PRINTERNOTON args_none {
- addIntOp(OP_PUSHINT, ERROR_PRINTERNOTON);
+ addLongOp(OP_PUSHLONG, ERROR_PRINTERNOTON);
}
| B256ERROR_PRINTEROPEN args_none {
- addIntOp(OP_PUSHINT, ERROR_PRINTEROPEN);
+ addLongOp(OP_PUSHLONG, ERROR_PRINTEROPEN);
}
| B256ERROR_RADIX args_none {
- addIntOp(OP_PUSHINT, ERROR_RADIX);
+ addLongOp(OP_PUSHLONG, ERROR_RADIX);
}
| B256ERROR_RADIXSTRING args_none {
- addIntOp(OP_PUSHINT, ERROR_RADIXSTRING);
+ addLongOp(OP_PUSHLONG, ERROR_RADIXSTRING);
}
| B256ERROR_REFNOTASSIGNED args_none {
- addIntOp(OP_PUSHINT, ERROR_REFNOTASSIGNED);
+ addLongOp(OP_PUSHLONG, ERROR_REFNOTASSIGNED);
}
| B256ERROR_RGB args_none {
- addIntOp(OP_PUSHINT, ERROR_RGB);
+ addLongOp(OP_PUSHLONG, ERROR_RGB);
}
| B256ERROR_SERIALPARAMETER args_none {
- addIntOp(OP_PUSHINT, ERROR_SERIALPARAMETER);
+ addLongOp(OP_PUSHLONG, ERROR_SERIALPARAMETER);
}
| B256ERROR_SETTINGMAXKEYS args_none {
- addIntOp(OP_PUSHINT, ERROR_SETTINGMAXKEYS);
+ addLongOp(OP_PUSHLONG, ERROR_SETTINGMAXKEYS);
}
| B256ERROR_SETTINGMAXLEN args_none {
- addIntOp(OP_PUSHINT, ERROR_SETTINGMAXLEN);
+ addLongOp(OP_PUSHLONG, ERROR_SETTINGMAXLEN);
}
| B256ERROR_SETTINGSGETACCESS args_none {
- addIntOp(OP_PUSHINT, ERROR_SETTINGSGETACCESS);
+ addLongOp(OP_PUSHLONG, ERROR_SETTINGSGETACCESS);
}
| B256ERROR_SETTINGSSETACCESS args_none {
- addIntOp(OP_PUSHINT, ERROR_SETTINGSSETACCESS);
+ addLongOp(OP_PUSHLONG, ERROR_SETTINGSSETACCESS);
}
| B256ERROR_SLICESIZE args_none {
- addIntOp(OP_PUSHINT, ERROR_SLICESIZE);
+ addLongOp(OP_PUSHLONG, ERROR_SLICESIZE);
}
| B256ERROR_SOUNDERROR args_none {
- addIntOp(OP_PUSHINT, ERROR_SOUNDERROR);
+ addLongOp(OP_PUSHLONG, ERROR_SOUNDERROR);
}
| B256ERROR_SOUNDFILE args_none {
- addIntOp(OP_PUSHINT, ERROR_SOUNDFILE);
+ addLongOp(OP_PUSHLONG, ERROR_SOUNDFILE);
}
| B256ERROR_SOUNDFILEFORMAT args_none {
- addIntOp(OP_PUSHINT, ERROR_SOUNDFILEFORMAT);
+ addLongOp(OP_PUSHLONG, ERROR_SOUNDFILEFORMAT);
}
| B256ERROR_SOUNDLENGTH args_none {
- addIntOp(OP_PUSHINT, ERROR_SOUNDLENGTH);
+ addLongOp(OP_PUSHLONG, ERROR_SOUNDLENGTH);
}
| B256ERROR_SOUNDNOTSEEKABLE args_none {
- addIntOp(OP_PUSHINT, ERROR_SOUNDNOTSEEKABLE);
+ addLongOp(OP_PUSHLONG, ERROR_SOUNDNOTSEEKABLE);
}
| B256ERROR_SOUNDRESOURCE args_none {
- addIntOp(OP_PUSHINT, ERROR_SOUNDRESOURCE);
+ addLongOp(OP_PUSHLONG, ERROR_SOUNDRESOURCE);
}
| B256ERROR_SPRITENA args_none {
- addIntOp(OP_PUSHINT, ERROR_SPRITENA);
+ addLongOp(OP_PUSHLONG, ERROR_SPRITENA);
}
| B256ERROR_SPRITENUMBER args_none {
- addIntOp(OP_PUSHINT, ERROR_SPRITENUMBER);
+ addLongOp(OP_PUSHLONG, ERROR_SPRITENUMBER);
}
| B256ERROR_SPRITESLICE args_none {
- addIntOp(OP_PUSHINT, ERROR_SPRITESLICE);
+ addLongOp(OP_PUSHLONG, ERROR_SPRITESLICE);
}
| B256ERROR_SQRRANGE args_none {
- addIntOp(OP_PUSHINT, ERROR_SQRRANGE);
+ addLongOp(OP_PUSHLONG, ERROR_SQRRANGE);
}
| B256ERROR_STACKUNDERFLOW args_none {
- addIntOp(OP_PUSHINT, ERROR_STACKUNDERFLOW);
+ addLongOp(OP_PUSHLONG, ERROR_STACKUNDERFLOW);
}
| B256ERROR_STRING2NOTE args_none {
- addIntOp(OP_PUSHINT, ERROR_STRING2NOTE);
+ addLongOp(OP_PUSHLONG, ERROR_STRING2NOTE);
}
| B256ERROR_STRINGCONV args_none {
- addIntOp(OP_PUSHINT, ERROR_STRINGCONV);
+ addLongOp(OP_PUSHLONG, ERROR_STRINGCONV);
}
| B256ERROR_STRINGEXPR args_none {
- addIntOp(OP_PUSHINT, ERROR_STRINGEXPR);
+ addLongOp(OP_PUSHLONG, ERROR_STRINGEXPR);
}
| B256ERROR_STRINGMAXLEN args_none {
- addIntOp(OP_PUSHINT, ERROR_STRINGMAXLEN);
+ addLongOp(OP_PUSHLONG, ERROR_STRINGMAXLEN);
}
| B256ERROR_STRSTART args_none {
- addIntOp(OP_PUSHINT, ERROR_STRSTART);
+ addLongOp(OP_PUSHLONG, ERROR_STRSTART);
}
| B256ERROR_TOOMANYSOUNDS args_none {
- addIntOp(OP_PUSHINT, ERROR_TOOMANYSOUNDS);
+ addLongOp(OP_PUSHLONG, ERROR_TOOMANYSOUNDS);
}
| B256ERROR_UNEXPECTEDRETURN args_none {
- addIntOp(OP_PUSHINT, ERROR_UNEXPECTEDRETURN);
+ addLongOp(OP_PUSHLONG, ERROR_UNEXPECTEDRETURN);
}
| B256ERROR_UNSERIALIZEFORMAT args_none {
- addIntOp(OP_PUSHINT, ERROR_UNSERIALIZEFORMAT);
+ addLongOp(OP_PUSHLONG, ERROR_UNSERIALIZEFORMAT);
}
| B256ERROR_VARCIRCULAR args_none {
- addIntOp(OP_PUSHINT, ERROR_VARCIRCULAR);
+ addLongOp(OP_PUSHLONG, ERROR_VARCIRCULAR);
}
| B256ERROR_VARNOTASSIGNED args_none {
- addIntOp(OP_PUSHINT, ERROR_VARNOTASSIGNED);
+ addLongOp(OP_PUSHLONG, ERROR_VARNOTASSIGNED);
}
| B256ERROR_VARNULL args_none {
- addIntOp(OP_PUSHINT, ERROR_VARNULL);
+ addLongOp(OP_PUSHLONG, ERROR_VARNULL);
}
| B256ERROR_WAVEFORMLOGICAL args_none {
- addIntOp(OP_PUSHINT, ERROR_WAVEFORMLOGICAL);
+ addLongOp(OP_PUSHLONG, ERROR_WAVEFORMLOGICAL);
}
| B256ERROR_WAVOBSOLETE args_none {
- addIntOp(OP_PUSHINT, ERROR_WAVOBSOLETE);
+ addLongOp(OP_PUSHLONG, ERROR_WAVOBSOLETE);
}
| B256WARNING_ARRAYELEMENT args_none {
- addIntOp(OP_PUSHINT, WARNING_ARRAYELEMENT);
+ addLongOp(OP_PUSHLONG, WARNING_ARRAYELEMENT);
}
| B256WARNING_BOOLEANCONV args_none {
- addIntOp(OP_PUSHINT, WARNING_BOOLEANCONV);
+ addLongOp(OP_PUSHLONG, WARNING_BOOLEANCONV);
}
| B256WARNING_INTEGERRANGE args_none {
- addIntOp(OP_PUSHINT, WARNING_INTEGERRANGE);
+ addLongOp(OP_PUSHLONG, WARNING_INTEGERRANGE);
}
| B256WARNING_LONGRANGE args_none {
- addIntOp(OP_PUSHINT, WARNING_LONGRANGE);
+ addLongOp(OP_PUSHLONG, WARNING_LONGRANGE);
}
| B256WARNING_NUMBERCONV args_none {
- addIntOp(OP_PUSHINT, WARNING_NUMBERCONV);
+ addLongOp(OP_PUSHLONG, WARNING_NUMBERCONV);
}
| B256WARNING_REFNOTASSIGNED args_none {
- addIntOp(OP_PUSHINT, WARNING_REFNOTASSIGNED);
+ addLongOp(OP_PUSHLONG, WARNING_REFNOTASSIGNED);
}
| B256WARNING_SOUNDERROR args_none {
- addIntOp(OP_PUSHINT, WARNING_SOUNDERROR);
+ addLongOp(OP_PUSHLONG, WARNING_SOUNDERROR);
}
| B256WARNING_SOUNDFILEFORMAT args_none {
- addIntOp(OP_PUSHINT, WARNING_SOUNDFILEFORMAT);
+ addLongOp(OP_PUSHLONG, WARNING_SOUNDFILEFORMAT);
}
| B256WARNING_SOUNDLENGTH args_none {
- addIntOp(OP_PUSHINT, WARNING_SOUNDLENGTH);
+ addLongOp(OP_PUSHLONG, WARNING_SOUNDLENGTH);
}
| B256WARNING_SOUNDNOTSEEKABLE args_none {
- addIntOp(OP_PUSHINT, WARNING_SOUNDNOTSEEKABLE);
+ addLongOp(OP_PUSHLONG, WARNING_SOUNDNOTSEEKABLE);
}
| B256WARNING_START args_none {
- addIntOp(OP_PUSHINT, WARNING_START);
+ addLongOp(OP_PUSHLONG, WARNING_START);
}
| B256WARNING_STRING2NOTE args_none {
- addIntOp(OP_PUSHINT, WARNING_STRING2NOTE);
+ addLongOp(OP_PUSHLONG, WARNING_STRING2NOTE);
}
| B256WARNING_STRINGCONV args_none {
- addIntOp(OP_PUSHINT, WARNING_STRINGCONV);
+ addLongOp(OP_PUSHLONG, WARNING_STRINGCONV);
}
| B256WARNING_VARNOTASSIGNED args_none {
- addIntOp(OP_PUSHINT, WARNING_VARNOTASSIGNED);
+ addLongOp(OP_PUSHLONG, WARNING_VARNOTASSIGNED);
}
| B256WARNING_WAVOBSOLETE args_none {
- addIntOp(OP_PUSHINT, WARNING_WAVOBSOLETE);
+ addLongOp(OP_PUSHLONG, WARNING_WAVOBSOLETE);
}
;
@@ -1671,19 +1679,23 @@ expr_errors:
### numeric expressions ###
########################################### */
expr_numeric:
- B256INTEGER { addIntOp(OP_PUSHINT, $1); }
+ B256INTEGER {
+ addLongOp(OP_PUSHLONG, $1);
+ //printf("add op_pushlong %li\n", $1);
+ }
+
| B256FLOAT {
if(isfinite($1)){
addFloatOp(OP_PUSHFLOAT, $1);
}else{
- errorcode = COMPERR_NUMBERTOOLARGE;
+ errorcode = COMPERR_FLOATTOOLARGE;
return -1;
}
}
| '+' B256INTEGER %prec B256UNARY {
// accept/eat unary plus only for numbers
- addIntOp(OP_PUSHINT, $2);
+ addLongOp(OP_PUSHLONG, $2);
}
| '+' B256FLOAT %prec B256UNARY {
@@ -1691,7 +1703,7 @@ expr_numeric:
if(isfinite($2)){
addFloatOp(OP_PUSHFLOAT, $2);
}else{
- errorcode = COMPERR_NUMBERTOOLARGE;
+ errorcode = COMPERR_FLOATTOOLARGE;
return -1;
}
}
@@ -1710,7 +1722,7 @@ expr_numeric:
}
| expr '%' %prec B256UNARY {
/* expression% is actually a percentage */
- addIntOp(OP_PUSHINT, 100);
+ addLongOp(OP_PUSHLONG, 100);
addOp(OP_DIV);
}
| expr B256INTDIV expr {
@@ -1749,7 +1761,7 @@ expr_numeric:
addIntOp(OP_ARR_GET, v); // get current value
addOp(OP_STACKDUP); // duplicate (1 to save and 1 to increment)
addOp(OP_STACKSAVE); // save original
- addIntOp(OP_PUSHINT,1); // add 1
+ addLongOp(OP_PUSHLONG,1); // add 1
addOp(OP_ADD);
addIntOp(OP_ARR_SET, v); // assign new value
addOp(OP_STACKUNSAVE); // put original value on the stack
@@ -1761,7 +1773,7 @@ expr_numeric:
addIntOp(OP_ARR_GET, v); // get current value
addOp(OP_STACKDUP); // duplicate (1 to save and 1 to increment)
addOp(OP_STACKSAVE); // save original
- addIntOp(OP_PUSHINT,-1); // subtract 1
+ addLongOp(OP_PUSHLONG,-1); // subtract 1
addOp(OP_ADD);
addIntOp(OP_ARR_SET, v); // assign new value
addOp(OP_STACKUNSAVE); // put original value on the stack
@@ -1771,7 +1783,7 @@ expr_numeric:
int v = varnumber[--nvarnumber];
addOp(OP_STACKDUP2); // save indexes
addIntOp(OP_ARR_GET, v); // get current value
- addIntOp(OP_PUSHINT,1); // add 1
+ addLongOp(OP_PUSHLONG,1); // add 1
addOp(OP_ADD);
addOp(OP_STACKDUP); // duplicate (1 to set 1 to stack)
addOp(OP_STACKSAVE); // save 1 to stack
@@ -1783,7 +1795,7 @@ expr_numeric:
int v = varnumber[--nvarnumber];
addOp(OP_STACKDUP2); // save indexes
addIntOp(OP_ARR_GET, v); // get current value
- addIntOp(OP_PUSHINT,-1); // subtract 1
+ addLongOp(OP_PUSHLONG,-1); // subtract 1
addOp(OP_ADD);
addOp(OP_STACKDUP); // duplicate (1 to set 1 to stack)
addOp(OP_STACKSAVE); // save 1 to stack
@@ -1793,27 +1805,27 @@ expr_numeric:
| variable B256ADD1 {
addIntOp(OP_VAR_GET,varnumber[--nvarnumber]);
addIntOp(OP_VAR_GET,varnumber[nvarnumber]);
- addIntOp(OP_PUSHINT,1);
+ addLongOp(OP_PUSHLONG,1);
addOp(OP_ADD);
addIntOp(OP_VAR_SET,varnumber[nvarnumber]);
}
| variable B256SUB1 {
addIntOp(OP_VAR_GET,varnumber[--nvarnumber]);
addIntOp(OP_VAR_GET,varnumber[nvarnumber]);
- addIntOp(OP_PUSHINT,-1);
+ addLongOp(OP_PUSHLONG,-1);
addOp(OP_ADD);
addIntOp(OP_VAR_SET,varnumber[nvarnumber]);
}
| B256ADD1 variable {
addIntOp(OP_VAR_GET,varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT,1);
+ addLongOp(OP_PUSHLONG,1);
addOp(OP_ADD);
addIntOp(OP_VAR_SET,varnumber[nvarnumber]);
addIntOp(OP_VAR_GET,varnumber[nvarnumber]);
}
| B256SUB1 variable {
addIntOp(OP_VAR_GET,varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT,-1);
+ addLongOp(OP_PUSHLONG,-1);
addOp(OP_ADD);
addIntOp(OP_VAR_SET,varnumber[nvarnumber]);
addIntOp(OP_VAR_GET,varnumber[nvarnumber]);
@@ -1823,17 +1835,17 @@ expr_numeric:
| B256LENGTH '(' expr ')' { addOp(OP_LENGTH); }
| B256ASC '(' expr ')' { addOp(OP_ASC); }
| B256INSTR '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 1); // start
- addIntOp(OP_PUSHINT, 0); // case sens flag
+ addLongOp(OP_PUSHLONG, 1); // start
+ addLongOp(OP_PUSHLONG, 0); // case sens flag
addOp(OP_INSTR);
}
| B256INSTR '(' expr ',' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 0); // case sens flag
+ addLongOp(OP_PUSHLONG, 0); // case sens flag
addOp(OP_INSTR);
}
| B256INSTR '(' expr ',' expr ',' expr ',' expr')' { addOp(OP_INSTR); }
| B256INSTRX '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 1); //start
+ addLongOp(OP_PUSHLONG, 1); //start
addOp(OP_INSTRX);
}
| B256INSTRX '(' expr ',' expr ',' expr ')' { addOp(OP_INSTRX); }
@@ -1855,7 +1867,7 @@ expr_numeric:
| B256RAND args_none { addOp(OP_RAND); }
| B256PI args_none { addFloatOp(OP_PUSHFLOAT, 3.14159265358979323846); }
| B256BOOLEOF args_none {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_EOF);
}
| B256BOOLEOF '(' expr ')' { addOp(OP_EOF); }
@@ -1869,17 +1881,17 @@ expr_numeric:
| B256GRAPHWIDTH args_none { addOp(OP_GRAPHWIDTH); }
| B256GRAPHHEIGHT args_none { addOp(OP_GRAPHHEIGHT); }
| B256SIZE args_none {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_SIZE);
}
| B256SIZE '(' expr ')' { addOp(OP_SIZE); }
| B256KEYPRESSED args_none {
- addIntOp(OP_PUSHINT, 0x00);
+ addLongOp(OP_PUSHLONG, 0x00);
addOp(OP_KEYPRESSED);
}
| B256KEYPRESSED '(' expr ')' { addOp(OP_KEYPRESSED); }
| B256KEY args_none {
- addIntOp(OP_PUSHINT, 0x00);
+ addLongOp(OP_PUSHLONG, 0x00);
addOp(OP_KEY);
}
| B256KEY '(' expr ')' {
@@ -1893,7 +1905,7 @@ expr_numeric:
| B256CLICKB args_none { addOp(OP_CLICKB); }
| B256PIXEL '(' expr ',' expr ')' { addOp(OP_PIXEL); }
| B256RGB '(' expr ',' expr ',' expr ')' {
- addIntOp(OP_PUSHINT,255); // a
+ addLongOp(OP_PUSHLONG,255); // a
addOp(OP_RGB);
}
| B256RGB '(' expr ',' expr ',' expr ',' expr ')' {
@@ -1903,7 +1915,7 @@ expr_numeric:
| B256GETBRUSHCOLOR args_none { addOp(OP_GETBRUSHCOLOR); }
| B256GETPENWIDTH args_none { addOp(OP_GETPENWIDTH); }
| B256SPRITECOLLIDE '(' expr ',' expr ',' expr ')' { addOp(OP_SPRITECOLLIDE); }
- | B256SPRITECOLLIDE '(' expr ',' expr ')' { addIntOp(OP_PUSHINT, 0); addOp(OP_SPRITECOLLIDE); }
+ | B256SPRITECOLLIDE '(' expr ',' expr ')' { addLongOp(OP_PUSHLONG, 0); addOp(OP_SPRITECOLLIDE); }
| B256SPRITEX '(' expr ')' { addOp(OP_SPRITEX); }
| B256SPRITEY '(' expr ')' { addOp(OP_SPRITEY); }
| B256SPRITEH '(' expr ')' { addOp(OP_SPRITEH); }
@@ -1913,60 +1925,60 @@ expr_numeric:
| B256SPRITES '(' expr ')' { addOp(OP_SPRITES); }
| B256SPRITEO '(' expr ')' { addOp(OP_SPRITEO); }
| B256DBROW args_none {
- addIntOp(OP_PUSHINT,0); // default db number
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_DBROW);
}
| B256DBROW '(' expr ')' {
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_DBROW);
}
| B256DBROW '(' expr ',' expr')' {
addOp(OP_DBROW);
}
| B256DBINT '(' expr ')' {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBINT); }
| B256DBINT '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBINT); }
| B256DBINT '(' expr ',' expr ',' expr ')' {
addOp(OP_DBINT); }
| B256DBFLOAT '(' expr ')' {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBFLOAT); }
| B256DBFLOAT '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBFLOAT); }
| B256DBFLOAT '(' expr ',' expr ',' expr ')' {
addOp(OP_DBFLOAT); }
| B256DBNULL '(' expr ')' {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBNULL); }
| B256DBNULL '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBNULL); }
| B256DBNULL '(' expr ',' expr ',' expr ')' {
addOp(OP_DBNULL); }
| B256LASTERROR args_none { addOp(OP_LASTERROR); }
| B256LASTERRORLINE args_none { addOp(OP_LASTERRORLINE); }
- | B256NETDATA args_none { addIntOp(OP_PUSHINT, 0); addOp(OP_NETDATA); }
+ | B256NETDATA args_none { addLongOp(OP_PUSHLONG, 0); addOp(OP_NETDATA); }
| B256NETDATA '(' expr ')' { addOp(OP_NETDATA); }
| B256PORTIN '(' expr ')' { addOp(OP_PORTIN); }
| B256COUNT '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 0); // case sens flag
+ addLongOp(OP_PUSHLONG, 0); // case sens flag
addOp(OP_COUNT);
}
| B256COUNT '(' expr ',' expr ',' expr ')' { addOp(OP_COUNT); }
@@ -1977,67 +1989,67 @@ expr_numeric:
| B256TEXTWIDTH '(' expr ',' expr ')' { addOp(OP_TEXTBOXWIDTH); }
| B256TEXTHEIGHT args_none { addOp(OP_TEXTHEIGHT); }
| B256TEXTHEIGHT '(' expr ',' expr ')' { addOp(OP_TEXTBOXHEIGHT); }
- | B256READBYTE args_none { addIntOp(OP_PUSHINT, 0); addOp(OP_READBYTE); }
+ | B256READBYTE args_none { addLongOp(OP_PUSHLONG, 0); addOp(OP_READBYTE); }
| B256READBYTE '(' expr ')' { addOp(OP_READBYTE); }
| B256FREEDB args_none { addOp(OP_FREEDB); }
| B256FREEDBSET args_none {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_FREEDBSET);
}
| B256FREEDBSET '(' expr ')' { addOp(OP_FREEDBSET); }
| B256FREEFILE args_none { addOp(OP_FREEFILE); }
| B256FREENET args_none { addOp(OP_FREENET); }
- | B256VERSION args_none { addIntOp(OP_PUSHINT, VERSIONSIGNATURE); }
+ | B256VERSION args_none { addLongOp(OP_PUSHLONG, VERSIONSIGNATURE); }
| B256CONFIRM '(' expr ')' {
- addIntOp(OP_PUSHINT,-1); // no default
+ addLongOp(OP_PUSHLONG,-1); // no default
addOp(OP_CONFIRM);
}
| B256CONFIRM '(' expr ',' expr ')' {
addOp(OP_CONFIRM);
}
| B256FROMBINARY '(' expr ')' {
- addIntOp(OP_PUSHINT,2); // radix
+ addLongOp(OP_PUSHLONG,2); // radix
addOp(OP_FROMRADIX);
}
| B256FROMHEX '(' expr ')' {
- addIntOp(OP_PUSHINT,16); // radix
+ addLongOp(OP_PUSHLONG,16); // radix
addOp(OP_FROMRADIX);
}
| B256FROMOCTAL '(' expr ')' {
- addIntOp(OP_PUSHINT,8); // radix
+ addLongOp(OP_PUSHLONG,8); // radix
addOp(OP_FROMRADIX);
}
| B256FROMRADIX '(' expr ',' expr ')' {
addOp(OP_FROMRADIX);
}
| B256BINCONST {
- addIntOp(OP_PUSHINT,strtoul($1, NULL, 2));
+ addLongOp(OP_PUSHLONG,strtoul($1, NULL, 2));
if(errno==ERANGE){
- errorcode = COMPERR_NUMBERTOOLARGE;
+ errorcode = COMPERR_INTEGERTOOLARGE;
return -1;
}
//addStringOp(OP_PUSHSTRING, $1);
- //addIntOp(OP_PUSHINT,2); // radix
+ //addLongOp(OP_PUSHLONG,2); // radix
//addOp(OP_FROMRADIX);
}
| B256HEXCONST {
- addIntOp(OP_PUSHINT,strtoul($1, NULL, 16));
+ addLongOp(OP_PUSHLONG,strtoul($1, NULL, 16));
if(errno==ERANGE){
- errorcode = COMPERR_NUMBERTOOLARGE;
+ errorcode = COMPERR_INTEGERTOOLARGE;
return -1;
}
//addStringOp(OP_PUSHSTRING, $1);
- //addIntOp(OP_PUSHINT,16); // radix
+ //addLongOp(OP_PUSHLONG,16); // radix
//addOp(OP_FROMRADIX);
}
| B256OCTCONST {
- addIntOp(OP_PUSHINT,strtoul($1, NULL, 8));
+ addLongOp(OP_PUSHLONG,strtoul($1, NULL, 8));
if(errno==ERANGE){
- errorcode = COMPERR_NUMBERTOOLARGE;
+ errorcode = COMPERR_INTEGERTOOLARGE;
return -1;
}
//addStringOp(OP_PUSHSTRING, $1);
- //addIntOp(OP_PUSHINT,8); // radix
+ //addLongOp(OP_PUSHLONG,8); // radix
//addOp(OP_FROMRADIX);
}
| B256WAVLENGTH args_none { addOp(OP_WAVLENGTH); }
@@ -2052,8 +2064,8 @@ expr_numeric:
addOp(OP_SOUNDPLAYER);
}
| B256SOUNDPLAYER '(' args_ee ')' {
- addIntOp(OP_PUSHINT, 2); // 2 columns
- addIntOp(OP_PUSHINT, 1); // 1 row
+ addLongOp(OP_PUSHLONG, 2); // 2 columns
+ addLongOp(OP_PUSHLONG, 1); // 1 row
addOp(OP_LIST2ARRAY);
addOp(OP_SOUNDPLAYER);
}
@@ -2064,21 +2076,21 @@ expr_numeric:
addOp(OP_SOUNDPOSITION);
}
| B256SOUNDPOSITION args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDPOSITION);
}
| B256SOUNDSTATE '(' expr ')' {
addOp(OP_SOUNDSTATE);
}
| B256SOUNDSTATE args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDSTATE);
}
| B256SOUNDLENGTH '(' expr ')' {
addOp(OP_SOUNDLENGTH);
}
| B256SOUNDLENGTH args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDLENGTH);
}
| B256SOUNDSAMPLERATE args_none {
@@ -2094,7 +2106,7 @@ expr_numeric:
addOp(OP_IMAGEPIXEL);
}
| B256ROUND '(' expr ')' {
- addIntOp(OP_PUSHINT,0); // default decimal places
+ addLongOp(OP_PUSHLONG,0); // default decimal places
addOp(OP_ROUND);
}
| B256ROUND '(' args_ee ')' {
@@ -2129,30 +2141,30 @@ expr_string:
| B256UPPER '(' expr ')' { addOp(OP_UPPER); }
| B256LOWER '(' expr ')' { addOp(OP_LOWER); }
| B256MID '(' expr ',' expr ',' expr ')' { addOp(OP_MID); }
- | B256MIDX '(' expr ',' expr ')' { addIntOp(OP_PUSHINT, 1); addOp(OP_MIDX); }
+ | B256MIDX '(' expr ',' expr ')' { addLongOp(OP_PUSHLONG, 1); addOp(OP_MIDX); }
| B256MIDX '(' expr ',' expr ',' expr ')' { addOp(OP_MIDX); }
| B256LEFT '(' expr ',' expr ')' { addOp(OP_LEFT); }
| B256RIGHT '(' expr ',' expr ')' { addOp(OP_RIGHT); }
- | B256READ args_none { addIntOp(OP_PUSHINT, 0); addOp(OP_READ); }
+ | B256READ args_none { addLongOp(OP_PUSHLONG, 0); addOp(OP_READ); }
| B256READ '(' expr ')' { addOp(OP_READ); }
- | B256READLINE args_none { addIntOp(OP_PUSHINT, 0); addOp(OP_READLINE); }
+ | B256READLINE args_none { addLongOp(OP_PUSHLONG, 0); addOp(OP_READLINE); }
| B256READLINE '(' expr ')' { addOp(OP_READLINE); }
| B256CURRENTDIR args_none { addOp(OP_CURRENTDIR); }
| B256DBSTRING '(' expr ')' {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBSTRING); }
| B256DBSTRING '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBSTRING); }
| B256DBSTRING '(' expr ',' expr ',' expr ')' {
addOp(OP_DBSTRING); }
| B256LASTERRORMESSAGE args_none { addOp(OP_LASTERRORMESSAGE); }
| B256LASTERROREXTRA args_none { addOp(OP_LASTERROREXTRA); }
- | B256NETREAD args_none { addIntOp(OP_PUSHINT, 0); addOp(OP_NETREAD); }
+ | B256NETREAD args_none { addLongOp(OP_PUSHLONG, 0); addOp(OP_NETREAD); }
| B256NETREAD '(' expr ')' { addOp(OP_NETREAD); }
| B256NETADDRESS args_none { addOp(OP_NETADDRESS); }
| B256MD5 '(' expr ')' { addOp(OP_MD5); }
@@ -2162,7 +2174,7 @@ expr_string:
| B256DIR '(' expr ')' { addOp(OP_DIR); }
| B256DIR args_none { addStringOp(OP_PUSHSTRING, ""); addOp(OP_DIR); }
| B256REPLACE '(' expr ',' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 0); // case sens flag
+ addLongOp(OP_PUSHLONG, 0); // case sens flag
addOp(OP_REPLACE);
}
| B256REPLACE '(' expr ',' expr ',' expr ',' expr ')' { addOp(OP_REPLACE); }
@@ -2188,15 +2200,15 @@ expr_string:
| B256PROMPT '(' expr ',' expr ')' {
addOp(OP_PROMPT); }
| B256TOBINARY '(' expr ')' {
- addIntOp(OP_PUSHINT,2); // radix
+ addLongOp(OP_PUSHLONG,2); // radix
addOp(OP_TORADIX);
}
| B256TOHEX '(' expr ')' {
- addIntOp(OP_PUSHINT,16); // radix
+ addLongOp(OP_PUSHLONG,16); // radix
addOp(OP_TORADIX);
}
| B256TOOCTAL '(' expr ')' {
- addIntOp(OP_PUSHINT,8); // radix
+ addLongOp(OP_PUSHLONG,8); // radix
addOp(OP_TORADIX);
}
| B256TORADIX '(' expr ',' expr ')' {
@@ -2216,8 +2228,8 @@ expr_string:
addOp(OP_SOUNDLOAD);
}
| B256SOUNDLOAD '(' args_ee ')' {
- addIntOp(OP_PUSHINT, 2); // 2 columns
- addIntOp(OP_PUSHINT, 1); // 1 row
+ addLongOp(OP_PUSHLONG, 2); // 2 columns
+ addLongOp(OP_PUSHLONG, 1); // 1 row
addOp(OP_LIST2ARRAY);
addOp(OP_SOUNDLOAD);
}
@@ -2228,26 +2240,26 @@ expr_string:
addOp(OP_IMAGENEW);
}
| B256IMAGENEW '(' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 0x00);
+ addLongOp(OP_PUSHLONG, 0x00);
addOp(OP_IMAGENEW);
}
| B256IMAGELOAD '(' expr ')' {
addOp(OP_IMAGELOAD);
}
| B256IMAGECOPY '(' expr ',' expr ',' expr ',' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 5); //number of arguments
+ addLongOp(OP_PUSHLONG, 5); //number of arguments
addOp(OP_IMAGECOPY);
}
| B256IMAGECOPY '(' expr ',' expr ',' expr ',' expr ')' {
- addIntOp(OP_PUSHINT, 4); //number of arguments
+ addLongOp(OP_PUSHLONG, 4); //number of arguments
addOp(OP_IMAGECOPY);
}
| B256IMAGECOPY '(' expr ')' {
- addIntOp(OP_PUSHINT, 1); //number of arguments
+ addLongOp(OP_PUSHLONG, 1); //number of arguments
addOp(OP_IMAGECOPY);
}
| B256IMAGECOPY args_none {
- addIntOp(OP_PUSHINT, 0); //number of arguments
+ addLongOp(OP_PUSHLONG, 0); //number of arguments
addOp(OP_IMAGECOPY);
}
| B256LJUST '(' args_ee ')' {
@@ -2299,7 +2311,7 @@ expr_dataelement:
}
| B256EXPLODE args_ee {
- addIntOp(OP_PUSHINT, 0); // case sensitive flag
+ addLongOp(OP_PUSHLONG, 0); // case sensitive flag
addOp(OP_EXPLODE);
}
| B256EXPLODE args_eee {
@@ -2310,7 +2322,7 @@ expr_dataelement:
}
| B256GETSLICE args_eeee {
- addIntOp(OP_PUSHINT, SLICE_ALL); // get everything
+ addLongOp(OP_PUSHLONG, SLICE_ALL); // get everything
addOp(OP_GETSLICE);
}
| B256GETSLICE args_eeeee {
@@ -2819,20 +2831,20 @@ dimstmt: B256DIM array_element {
| B256DIM array_element B256FILL expr {
addOp(OP_STACKTOPTO2);
addIntOp(OP_DIM, varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT, 1); // fill all elements
+ addLongOp(OP_PUSHLONG, 1); // fill all elements
addIntOp(OP_ARRAYFILL, varnumber[nvarnumber]);
}
| B256DIM variable_a expr {
- addIntOp(OP_PUSHINT, 1);
+ addLongOp(OP_PUSHLONG, 1);
addOp(OP_STACKSWAP);
addIntOp(OP_DIM, varnumber[--nvarnumber]);
}
| B256DIM variable_a expr B256FILL expr {
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT, 1);
+ addLongOp(OP_PUSHLONG, 1);
addOp(OP_STACKSWAP);
addIntOp(OP_DIM, varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT, 1); // fill all elements
+ addLongOp(OP_PUSHLONG, 1); // fill all elements
addIntOp(OP_ARRAYFILL, varnumber[nvarnumber]);
}
| B256DIM variable_a args_ee {
@@ -2841,14 +2853,14 @@ dimstmt: B256DIM array_element {
| B256DIM variable_a args_ee B256FILL expr {
addOp(OP_STACKTOPTO2);
addIntOp(OP_DIM, varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT, 1); // fill all elements
+ addLongOp(OP_PUSHLONG, 1); // fill all elements
addIntOp(OP_ARRAYFILL, varnumber[nvarnumber]);
}
| B256DIM variable_a '=' expr {
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256DIM variable_a B256FILL expr {
- addIntOp(OP_PUSHINT, 1);
+ addLongOp(OP_PUSHLONG, 1);
addIntOp(OP_ARRAYFILL, varnumber[--nvarnumber]);
}
;
@@ -2859,20 +2871,20 @@ redimstmt: B256REDIM array_element {
| B256REDIM array_element B256FILL expr {
addOp(OP_STACKTOPTO2);
addIntOp(OP_REDIM, varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT, 0); // just fill unassigned
+ addLongOp(OP_PUSHLONG, 0); // just fill unassigned
addIntOp(OP_ARRAYFILL, varnumber[nvarnumber]);
}
| B256REDIM variable_a expr {
- addIntOp(OP_PUSHINT, 1);
+ addLongOp(OP_PUSHLONG, 1);
addOp(OP_STACKSWAP);
addIntOp(OP_REDIM, varnumber[--nvarnumber]);
}
| B256REDIM variable_a expr B256FILL expr {
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT, 1);
+ addLongOp(OP_PUSHLONG, 1);
addOp(OP_STACKSWAP);
addIntOp(OP_REDIM, varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT, 0); // just fill unassigned
+ addLongOp(OP_PUSHLONG, 0); // just fill unassigned
addIntOp(OP_ARRAYFILL, varnumber[nvarnumber]);
}
| B256REDIM variable_a args_ee {
@@ -2881,7 +2893,7 @@ redimstmt: B256REDIM array_element {
| B256REDIM variable_a args_ee B256FILL expr {
addOp(OP_STACKTOPTO2);
addIntOp(OP_REDIM, varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT, 0); // just fill unassigned
+ addLongOp(OP_PUSHLONG, 0); // just fill unassigned
addIntOp(OP_ARRAYFILL, varnumber[nvarnumber]);
}
;
@@ -2902,11 +2914,11 @@ clearstmt: B256CLS args_none {
}
| B256CLG args_none {
// push the color clear if there are no arguments
- addIntOp(OP_PUSHINT, 0x00);
- //addIntOp(OP_PUSHINT, 0x00);
- //addIntOp(OP_PUSHINT, 0x00);
- //addIntOp(OP_PUSHINT, 0x00);
- //addIntOp(OP_PUSHINT, 0x00);
+ addLongOp(OP_PUSHLONG, 0x00);
+ //addLongOp(OP_PUSHLONG, 0x00);
+ //addLongOp(OP_PUSHLONG, 0x00);
+ //addLongOp(OP_PUSHLONG, 0x00);
+ //addLongOp(OP_PUSHLONG, 0x00);
//addOp(OP_RGB);
addOp(OP_CLG);
}
@@ -2952,7 +2964,7 @@ arrayelementassign:
int v = varnumber[--nvarnumber];
addOp(OP_STACKDUP2); // save indexes
addIntOp(OP_ARR_GET, v); // get current value
- addIntOp(OP_PUSHINT,1); // add 1
+ addLongOp(OP_PUSHLONG,1); // add 1
addOp(OP_ADD);
addIntOp(OP_ARR_SET, v); // assign new value
}
@@ -2961,7 +2973,7 @@ arrayelementassign:
int v = varnumber[--nvarnumber];
addOp(OP_STACKDUP2); // save indexes
addIntOp(OP_ARR_GET, v); // get current value
- addIntOp(OP_PUSHINT,-1); // subtract 1
+ addLongOp(OP_PUSHLONG,-1); // subtract 1
addOp(OP_ADD);
addIntOp(OP_ARR_SET, v); // assign new value
}
@@ -3034,7 +3046,7 @@ arrayelementassign:
/* assign an entire array in one statement */
arrayassign:
variable_a B256FILL expr {
- addIntOp(OP_PUSHINT, 1); // fill all elements
+ addLongOp(OP_PUSHLONG, 1); // fill all elements
addIntOp(OP_ARRAYFILL, varnumber[--nvarnumber]);
}
;
@@ -3046,13 +3058,13 @@ assign:
}
| variable B256ADD1 {
addIntOp(OP_VAR_GET,varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT,1);
+ addLongOp(OP_PUSHLONG,1);
addOp(OP_ADD);
addIntOp(OP_VAR_SET,varnumber[nvarnumber]);
}
| variable B256SUB1 {
addIntOp(OP_VAR_GET,varnumber[--nvarnumber]);
- addIntOp(OP_PUSHINT,-1);
+ addLongOp(OP_PUSHLONG,-1);
addOp(OP_ADD);
addIntOp(OP_VAR_SET,varnumber[nvarnumber]);
}
@@ -3101,7 +3113,7 @@ forstmt: B256FOR variable '=' expr B256
int var = varnumber[--nvarnumber];
newIf(linenumber, IFTABLETYPEFOR, var);
// push default step 1 and exit address
- addIntOp(OP_PUSHINT, 1); //step
+ addLongOp(OP_PUSHLONG, 1); //step
addIntOp(OP_PUSHLABEL, getInternalSymbol(iftableid[numifs-1],INTERNALSYMBOLEXIT));
addIntOp(OP_FOR, var);
}
@@ -3200,12 +3212,12 @@ gosubstmt: B256GOSUB variable {
;
callstmt: B256CALL variable '(' ')' {
- addIntOp(OP_PUSHINT, 0); //push number of arguments passed to compare with SUBROUTINE definition
+ addLongOp(OP_PUSHLONG, 0); //push number of arguments passed to compare with SUBROUTINE definition
addIntOp(OP_CALLSUBROUTINE, varnumber[--nvarnumber]);
addIntOp(OP_CURRLINE, filenumber * 0x1000000 + linenumber);
}
| B256CALL variable '(' callexprlist ')' {
- addIntOp(OP_PUSHINT, listlen); //push number of arguments passed to compare with SUBROUTINE definition
+ addLongOp(OP_PUSHLONG, listlen); //push number of arguments passed to compare with SUBROUTINE definition
addIntOp(OP_CALLSUBROUTINE, varnumber[--nvarnumber]);
addIntOp(OP_CURRLINE, filenumber * 0x1000000 + linenumber);
}
@@ -3268,7 +3280,7 @@ colorstmt: B256SETCOLOR expr {
addOp(OP_SETCOLOR);
}
| B256SETCOLOR args_eee {
- addIntOp(OP_PUSHINT, 255);
+ addLongOp(OP_PUSHLONG, 255);
addOp(OP_RGB);
addOp(OP_STACKDUP);
addOp(OP_SETCOLOR);
@@ -3277,9 +3289,9 @@ colorstmt: B256SETCOLOR expr {
;
soundstmt: B256SOUND args_ee {
- addIntOp(OP_PUSHINT, 2); // 2 columns (this)
- addIntOp(OP_PUSHINT, 1); // 1 row
- addIntOp(OP_PUSHINT, 2); // 2 columns (max)
+ addLongOp(OP_PUSHLONG, 2); // 2 columns (this)
+ addLongOp(OP_PUSHLONG, 1); // 1 row
+ addLongOp(OP_PUSHLONG, 2); // 2 columns (max)
addOp(OP_LIST2ARRAY);
addOp(OP_SOUND);
}
@@ -3289,12 +3301,12 @@ soundstmt: B256SOUND args_ee {
;
soundplaystmt: B256SOUNDPLAY args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDPLAY);
}
| B256SOUNDPLAY args_ee {
- addIntOp(OP_PUSHINT, 2); // 2 columns
- addIntOp(OP_PUSHINT, 1); // 1 row
+ addLongOp(OP_PUSHLONG, 2); // 2 columns
+ addLongOp(OP_PUSHLONG, 1); // 1 row
addOp(OP_LIST2ARRAY);
addOp(OP_SOUNDPLAY);
}
@@ -3310,7 +3322,7 @@ soundpausestmt: B256SOUNDPAUSE expr {
addOp(OP_SOUNDPAUSE);
}
| B256SOUNDPAUSE args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDPAUSE);
}
;
@@ -3319,7 +3331,7 @@ soundplayeroffstmt: B256SOUNDPLAYEROFF
addOp(OP_SOUNDPLAYEROFF);
}
| B256SOUNDPLAYEROFF args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDPLAYEROFF);
}
;
@@ -3328,7 +3340,7 @@ soundstopstmt: B256SOUNDSTOP expr {
addOp(OP_SOUNDSTOP);
}
| B256SOUNDSTOP args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDSTOP);
}
;
@@ -3338,14 +3350,14 @@ soundwaitstmt:
addOp(OP_SOUNDWAIT);
}
| B256SOUNDWAIT args_none {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_SOUNDWAIT);
}
;
soundwaveformstmt:
B256SOUNDWAVEFORM expr {
- addIntOp(OP_PUSHINT,0);
+ addLongOp(OP_PUSHLONG,0);
addOp(OP_SOUNDWAVEFORM);
}
| B256SOUNDWAVEFORM args_ee {
@@ -3387,7 +3399,7 @@ soundfadestmt: B256SOUNDFADE args_eeee
| B256SOUNDFADE args_eee {
addOp(OP_STACKTOPTO2);
addOp(OP_STACKTOPTO2);
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_STACKSWAP);
addOp(OP_STACKSWAP2);
addOp(OP_SOUNDFADE);
@@ -3398,7 +3410,7 @@ soundseekstmt: B256SOUNDSEEK args_ee {
addOp(OP_SOUNDSEEK);
}
| B256SOUNDSEEK expr {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_STACKSWAP);
addOp(OP_SOUNDSEEK);
}
@@ -3408,7 +3420,7 @@ soundvolumestmt: B256SOUNDVOLUME args_e
addOp(OP_SOUNDVOLUME);
}
| B256SOUNDVOLUME expr {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_STACKSWAP);
addOp(OP_SOUNDVOLUME);
}
@@ -3418,7 +3430,7 @@ soundloopstmt: B256SOUNDLOOP args_ee {
addOp(OP_SOUNDLOOP);
}
| B256SOUNDLOOP expr {
- addIntOp(OP_PUSHINT, -1);
+ addLongOp(OP_PUSHLONG, -1);
addOp(OP_STACKSWAP);
addOp(OP_SOUNDLOOP);
}
@@ -3449,33 +3461,33 @@ ellipsestmt:
arcstmt:
B256ARC args_eeeee {
- addIntOp(OP_PUSHINT, 5); // with bounding circle
+ addLongOp(OP_PUSHLONG, 5); // with bounding circle
addOp(OP_ARC);
}
| B256ARC args_eeeeee {
- addIntOp(OP_PUSHINT, 6); // with bounding rectangle
+ addLongOp(OP_PUSHLONG, 6); // with bounding rectangle
addOp(OP_ARC);
}
;
chordstmt:
B256CHORD args_eeeee {
- addIntOp(OP_PUSHINT, 5); // with bounding circle
+ addLongOp(OP_PUSHLONG, 5); // with bounding circle
addOp(OP_CHORD);
}
| B256CHORD args_eeeeee {
- addIntOp(OP_PUSHINT, 6); // with bounding rectangle
+ addLongOp(OP_PUSHLONG, 6); // with bounding rectangle
addOp(OP_CHORD);
}
;
piestmt:
B256PIE args_eeeee {
- addIntOp(OP_PUSHINT, 5); // with bounding circle
+ addLongOp(OP_PUSHLONG, 5); // with bounding circle
addOp(OP_PIE);
}
| B256PIE args_eeeeee {
- addIntOp(OP_PUSHINT, 6); // with bounding rectangle
+ addLongOp(OP_PUSHLONG, 6); // with bounding rectangle
addOp(OP_PIE);
}
;
@@ -3498,7 +3510,7 @@ textstmt:
addOp(OP_TEXT);
}
| B256TEXT args_eeeee {
- addIntOp(OP_PUSHINT, 0); // flags
+ addLongOp(OP_PUSHLONG, 0); // flags
addOp(OP_TEXTBOX);
}
| B256TEXT args_eeeeee {
@@ -3511,18 +3523,18 @@ fontstmt:
addOp(OP_FONT);
}
| B256FONT args_eee {
- addIntOp(OP_PUSHINT, 0); // font is not italic
+ addLongOp(OP_PUSHLONG, 0); // font is not italic
addOp(OP_FONT);
}
| B256FONT args_ee {
- addIntOp(OP_PUSHINT, -1); // default weight
- addIntOp(OP_PUSHINT, 0); // font is not italic
+ addLongOp(OP_PUSHLONG, -1); // default weight
+ addLongOp(OP_PUSHLONG, 0); // font is not italic
addOp(OP_FONT);
}
| B256FONT expr {
- addIntOp(OP_PUSHINT, -1); // default size
- addIntOp(OP_PUSHINT, -1); // default weight
- addIntOp(OP_PUSHINT, 0); // font is not italic
+ addLongOp(OP_PUSHLONG, -1); // default size
+ addLongOp(OP_PUSHLONG, -1); // default weight
+ addLongOp(OP_PUSHLONG, 0); // font is not italic
addOp(OP_FONT);
}
;
@@ -3568,53 +3580,53 @@ stampstmt: B256STAMP args_eeeee {
;
openstmt: B256OPEN expr {
- addIntOp(OP_PUSHINT, 0); // file number zero
+ addLongOp(OP_PUSHLONG, 0); // file number zero
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT, 0); // not binary
+ addLongOp(OP_PUSHLONG, 0); // not binary
addOp(OP_OPEN);
}
| B256OPEN args_ee {
- addIntOp(OP_PUSHINT, 0); // not binary
+ addLongOp(OP_PUSHLONG, 0); // not binary
addOp(OP_OPEN);
}
| B256OPENB expr {
- addIntOp(OP_PUSHINT, 0); // file number zero
+ addLongOp(OP_PUSHLONG, 0); // file number zero
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT, 1); // binary
+ addLongOp(OP_PUSHLONG, 1); // binary
addOp(OP_OPEN);
}
| B256OPENB args_ee {
- addIntOp(OP_PUSHINT, 1); // binary
+ addLongOp(OP_PUSHLONG, 1); // binary
addOp(OP_OPEN);
}
| B256OPENSERIAL args_ee {
- addIntOp(OP_PUSHINT, 9600); // baud
- addIntOp(OP_PUSHINT, 8); // data bits
- addIntOp(OP_PUSHINT, 1); // stop bits
- addIntOp(OP_PUSHINT, 0); // parity
- addIntOp(OP_PUSHINT, 0); // flow
+ addLongOp(OP_PUSHLONG, 9600); // baud
+ addLongOp(OP_PUSHLONG, 8); // data bits
+ addLongOp(OP_PUSHLONG, 1); // stop bits
+ addLongOp(OP_PUSHLONG, 0); // parity
+ addLongOp(OP_PUSHLONG, 0); // flow
addOp(OP_OPENSERIAL);
}
| B256OPENSERIAL args_eee {
- addIntOp(OP_PUSHINT, 8); // data bits
- addIntOp(OP_PUSHINT, 1); // stop bits
- addIntOp(OP_PUSHINT, 0); // parity
- addIntOp(OP_PUSHINT, 0); // flow
+ addLongOp(OP_PUSHLONG, 8); // data bits
+ addLongOp(OP_PUSHLONG, 1); // stop bits
+ addLongOp(OP_PUSHLONG, 0); // parity
+ addLongOp(OP_PUSHLONG, 0); // flow
addOp(OP_OPENSERIAL);
}
| B256OPENSERIAL args_eeee {
- addIntOp(OP_PUSHINT, 1); // stop bits
- addIntOp(OP_PUSHINT, 0); // parity
- addIntOp(OP_PUSHINT, 0); // flow
+ addLongOp(OP_PUSHLONG, 1); // stop bits
+ addLongOp(OP_PUSHLONG, 0); // parity
+ addLongOp(OP_PUSHLONG, 0); // flow
addOp(OP_OPENSERIAL);
}
| B256OPENSERIAL args_eeeee {
- addIntOp(OP_PUSHINT, 0); // parity
- addIntOp(OP_PUSHINT, 0); // flow
+ addLongOp(OP_PUSHLONG, 0); // parity
+ addLongOp(OP_PUSHLONG, 0); // flow
addOp(OP_OPENSERIAL);
}
| B256OPENSERIAL args_eeeeee {
- addIntOp(OP_PUSHINT, 0); // flow
+ addLongOp(OP_PUSHLONG, 0); // flow
addOp(OP_OPENSERIAL);
}
| B256OPENSERIAL args_eeeeeee {
@@ -3623,7 +3635,7 @@ openstmt: B256OPEN expr {
;
writestmt: B256WRITE expr {
- addIntOp(OP_PUSHINT, 0); // file number zero
+ addLongOp(OP_PUSHLONG, 0); // file number zero
addOp(OP_STACKSWAP);
addOp(OP_WRITE);
}
@@ -3634,7 +3646,7 @@ writestmt: B256WRITE expr {
writelinestmt:
B256WRITELINE expr {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_STACKSWAP);
addOp(OP_WRITELINE);
}
@@ -3645,7 +3657,7 @@ writelinestmt:
writebytestmt:
B256WRITEBYTE expr {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_STACKSWAP);
addOp(OP_WRITEBYTE);
}
@@ -3655,7 +3667,7 @@ writebytestmt:
;
closestmt: B256CLOSE args_none {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_CLOSE);
}
| B256CLOSE expr {
@@ -3664,7 +3676,7 @@ closestmt: B256CLOSE args_none {
;
resetstmt: B256RESET args_none {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_RESET);
}
| B256RESET expr {
@@ -3678,7 +3690,7 @@ seedstmt: B256SEED expr {
;
seekstmt: B256SEEK expr {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_STACKSWAP);
addOp(OP_SEEK);
}
@@ -3688,94 +3700,94 @@ seekstmt: B256SEEK expr {
;
inputstmt: B256INPUT args_ev {
- addIntOp(OP_PUSHINT,T_UNASSIGNED);
+ addLongOp(OP_PUSHLONG,T_UNASSIGNED);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUT variable {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_UNASSIGNED);
+ addLongOp(OP_PUSHLONG,T_UNASSIGNED);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUT args_ea {
addOp(OP_STACKTOPTO2); addOp(OP_STACKTOPTO2); // bring prompt to top
- addIntOp(OP_PUSHINT,T_UNASSIGNED);
+ addLongOp(OP_PUSHLONG,T_UNASSIGNED);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
| B256INPUT array_element {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_UNASSIGNED);
+ addLongOp(OP_PUSHLONG,T_UNASSIGNED);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
| B256INPUTSTRING args_ev {
- addIntOp(OP_PUSHINT,T_STRING);
+ addLongOp(OP_PUSHLONG,T_STRING);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUTSTRING variable {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_STRING);
+ addLongOp(OP_PUSHLONG,T_STRING);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUTSTRING args_ea {
addOp(OP_STACKTOPTO2); addOp(OP_STACKTOPTO2); // bring prompt to top
- addIntOp(OP_PUSHINT,T_STRING);
+ addLongOp(OP_PUSHLONG,T_STRING);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
| B256INPUTSTRING array_element {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_STRING);
+ addLongOp(OP_PUSHLONG,T_STRING);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
| B256INPUTINT args_ev {
- addIntOp(OP_PUSHINT,T_INT);
+ addLongOp(OP_PUSHLONG,T_INT);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUTINT variable {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_INT);
+ addLongOp(OP_PUSHLONG,T_INT);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUTINT args_ea {
addOp(OP_STACKTOPTO2); addOp(OP_STACKTOPTO2); // bring prompt to top
- addIntOp(OP_PUSHINT,T_INT);
+ addLongOp(OP_PUSHLONG,T_INT);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
| B256INPUTINT array_element {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_INT);
+ addLongOp(OP_PUSHLONG,T_INT);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
| B256INPUTFLOAT args_ev {
- addIntOp(OP_PUSHINT,T_FLOAT);
+ addLongOp(OP_PUSHLONG,T_FLOAT);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUTFLOAT variable {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_FLOAT);
+ addLongOp(OP_PUSHLONG,T_FLOAT);
addOp(OP_INPUT);
addIntOp(OP_VAR_SET, varnumber[--nvarnumber]);
}
| B256INPUTFLOAT args_ea {
addOp(OP_STACKTOPTO2); addOp(OP_STACKTOPTO2); // bring prompt to top
- addIntOp(OP_PUSHINT,T_FLOAT);
+ addLongOp(OP_PUSHLONG,T_FLOAT);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
| B256INPUTFLOAT array_element {
addStringOp(OP_PUSHSTRING, "");
- addIntOp(OP_PUSHINT,T_FLOAT);
+ addLongOp(OP_PUSHLONG,T_FLOAT);
addOp(OP_INPUT);
addIntOp(OP_ARR_SET, varnumber[--nvarnumber]);
}
@@ -3783,43 +3795,43 @@ inputstmt: B256INPUT args_ev {
printstmt:
B256PRINT args_none {
- addIntOp(OP_PUSHINT, 0); //push number of arguments passed
- addIntOp(OP_PUSHINT, 1); // need NL
+ addLongOp(OP_PUSHLONG, 0); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 1); // need NL
addOp(OP_PRINT);
}
| B256PRINT expr B256SEMICOLON {
- addIntOp(OP_PUSHINT, 1); //push number of arguments passed
- addIntOp(OP_PUSHINT, 0); // suppress NL
+ addLongOp(OP_PUSHLONG, 1); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 0); // suppress NL
addOp(OP_PRINT);
}
| B256PRINT listitems {
- addIntOp(OP_PUSHINT, listlen); //push number of arguments passed
- addIntOp(OP_PUSHINT, 1); // need NL
+ addLongOp(OP_PUSHLONG, listlen); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 1); // need NL
addOp(OP_PRINT);
}
| B256PRINT '(' listitems ')' {
- addIntOp(OP_PUSHINT, listlen); //push number of arguments passed
- addIntOp(OP_PUSHINT, 1); // need NL
+ addLongOp(OP_PUSHLONG, listlen); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 1); // need NL
addOp(OP_PRINT);
}
| '?' args_none {
- addIntOp(OP_PUSHINT, 0); //push number of arguments passed
- addIntOp(OP_PUSHINT, 1); // need NL
+ addLongOp(OP_PUSHLONG, 0); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 1); // need NL
addOp(OP_PRINT);
}
| '?' expr B256SEMICOLON {
- addIntOp(OP_PUSHINT, 1); //push number of arguments passed
- addIntOp(OP_PUSHINT, 0); // suppress NL
+ addLongOp(OP_PUSHLONG, 1); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 0); // suppress NL
addOp(OP_PRINT);
}
| '?' listitems {
- addIntOp(OP_PUSHINT, listlen); //push number of arguments passed
- addIntOp(OP_PUSHINT, 1); // need NL
+ addLongOp(OP_PUSHLONG, listlen); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 1); // need NL
addOp(OP_PRINT);
}
| '?' '(' listitems ')' {
- addIntOp(OP_PUSHINT, listlen); //push number of arguments passed
- addIntOp(OP_PUSHINT, 1); // need NL
+ addLongOp(OP_PUSHLONG, listlen); //push number of arguments passed
+ addLongOp(OP_PUSHLONG, 1); // need NL
addOp(OP_PRINT);
} ;
@@ -3876,15 +3888,15 @@ putslicestmt:
imgloadstmt:
B256IMGLOAD args_eee
{
- addIntOp(OP_PUSHINT, 1); // scale
+ addLongOp(OP_PUSHLONG, 1); // scale
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT, 0); // rotate
+ addLongOp(OP_PUSHLONG, 0); // rotate
addOp(OP_STACKSWAP);
addOp(OP_IMGLOAD);
}
| B256IMGLOAD args_eeee
{
- addIntOp(OP_PUSHINT, 0); // rotate
+ addLongOp(OP_PUSHLONG, 0); // rotate
addOp(OP_STACKSWAP);
addOp(OP_IMGLOAD);
}
@@ -3920,7 +3932,7 @@ spritepolystmt:
spritetextstmt:
B256SPRITETEXT args_ee {
- addIntOp(OP_PUSHINT, 0x00); // clear
+ addLongOp(OP_PUSHLONG, 0x00); // clear
addOp(OP_SPRITETEXT);
}
| B256SPRITETEXT args_eee {
@@ -3931,22 +3943,22 @@ spritetextstmt:
spriteplacestmt:
B256SPRITEPLACE args_eee
{
- addIntOp(OP_PUSHINT,3); // nr of arguments
+ addLongOp(OP_PUSHLONG,3); // nr of arguments
addOp(OP_SPRITEPLACE);
}
| B256SPRITEPLACE args_eeee
{
- addIntOp(OP_PUSHINT,4); // nr of arguments
+ addLongOp(OP_PUSHLONG,4); // nr of arguments
addOp(OP_SPRITEPLACE);
}
| B256SPRITEPLACE args_eeeee
{
- addIntOp(OP_PUSHINT,5); // nr of arguments
+ addLongOp(OP_PUSHLONG,5); // nr of arguments
addOp(OP_SPRITEPLACE);
}
| B256SPRITEPLACE args_eeeeee
{
- addIntOp(OP_PUSHINT,6); // nr of arguments
+ addLongOp(OP_PUSHLONG,6); // nr of arguments
addOp(OP_SPRITEPLACE);
}
;
@@ -3954,19 +3966,19 @@ spriteplacestmt:
spritemovestmt:
B256SPRITEMOVE args_eee
{
- addIntOp(OP_PUSHINT,3); // nr of arguments
+ addLongOp(OP_PUSHLONG,3); // nr of arguments
addOp(OP_SPRITEMOVE);
}
| B256SPRITEMOVE args_eeee {
- addIntOp(OP_PUSHINT,4); // nr of arguments
+ addLongOp(OP_PUSHLONG,4); // nr of arguments
addOp(OP_SPRITEMOVE);
}
| B256SPRITEMOVE args_eeeee {
- addIntOp(OP_PUSHINT,5); // nr of arguments
+ addLongOp(OP_PUSHLONG,5); // nr of arguments
addOp(OP_SPRITEMOVE);
}
| B256SPRITEMOVE args_eeeeee {
- addIntOp(OP_PUSHINT,6); // nr of arguments
+ addLongOp(OP_PUSHLONG,6); // nr of arguments
addOp(OP_SPRITEMOVE);
}
;
@@ -3997,7 +4009,7 @@ changedirstmt:
dbopenstmt:
B256DBOPEN expr {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_STACKSWAP);
addOp(OP_DBOPEN);
}
@@ -4008,7 +4020,7 @@ dbopenstmt:
dbclosestmt:
B256DBCLOSE args_none {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_DBCLOSE);
}
| B256DBCLOSE expr {
@@ -4018,7 +4030,7 @@ dbclosestmt:
dbexecutestmt:
B256DBEXECUTE expr {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_STACKSWAP);
addOp(OP_DBEXECUTE);
}
@@ -4029,14 +4041,14 @@ dbexecutestmt:
dbopensetstmt:
B256DBOPENSET expr {
- addIntOp(OP_PUSHINT,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default db number
addOp(OP_STACKSWAP);
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBOPENSET);
}
| B256DBOPENSET args_ee {
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_STACKSWAP);
addOp(OP_DBOPENSET);
}
@@ -4047,12 +4059,12 @@ dbopensetstmt:
dbclosesetstmt:
B256DBCLOSESET args_none {
- addIntOp(OP_PUSHINT,0); // default db number
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default db number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_DBCLOSESET);
}
| B256DBCLOSESET expr {
- addIntOp(OP_PUSHINT,0); // default dbset number
+ addLongOp(OP_PUSHLONG,0); // default dbset number
addOp(OP_DBCLOSESET);
}
| B256DBCLOSESET args_ee {
@@ -4062,7 +4074,7 @@ dbclosesetstmt:
netlistenstmt:
B256NETLISTEN expr {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_STACKSWAP);
addOp(OP_NETLISTEN);
}
@@ -4073,7 +4085,7 @@ netlistenstmt:
netconnectstmt:
B256NETCONNECT args_ee {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_STACKTOPTO2);
addOp(OP_NETCONNECT);
}
@@ -4084,7 +4096,7 @@ netconnectstmt:
netwritestmt:
B256NETWRITE expr {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_STACKSWAP);
addOp(OP_NETWRITE);
}
@@ -4095,7 +4107,7 @@ netwritestmt:
netclosestmt:
B256NETCLOSE args_none {
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addOp(OP_NETCLOSE);
}
| B256NETCLOSE expr {
@@ -4362,7 +4374,7 @@ functionstmt:
}
//
// initialize return variable
- addIntOp(OP_PUSHINT, 0);
+ addLongOp(OP_PUSHLONG, 0);
addIntOp(OP_VAR_SET, functionDefSymbol);
//
numargs=0; // clear the list for next function
@@ -4490,22 +4502,22 @@ imagecropstmt:
imageautocropstmt:
B256IMAGEAUTOCROP expr {
- addIntOp(OP_PUSHINT,1); // nr of arguments
+ addLongOp(OP_PUSHLONG,1); // nr of arguments
addOp(OP_IMAGEAUTOCROP);
}
| B256IMAGEAUTOCROP args_ee {
- addIntOp(OP_PUSHINT,2); // nr of arguments
+ addLongOp(OP_PUSHLONG,2); // nr of arguments
addOp(OP_IMAGEAUTOCROP);
}
;
imageresizestmt:
B256IMAGERESIZE args_eee {
- addIntOp(OP_PUSHINT,3); // nr of arguments
+ addLongOp(OP_PUSHLONG,3); // nr of arguments
addOp(OP_IMAGERESIZE);
}
| B256IMAGERESIZE args_ee {
- addIntOp(OP_PUSHINT,2); // nr of arguments
+ addLongOp(OP_PUSHLONG,2); // nr of arguments
addOp(OP_IMAGERESIZE);
}
;
@@ -4522,19 +4534,19 @@ imagesetpixelstmt:
imagedrawstmt:
B256IMAGEDRAW args_eeeeee {
- addIntOp(OP_PUSHINT,6); // nr of arguments
+ addLongOp(OP_PUSHLONG,6); // nr of arguments
addOp(OP_IMAGEDRAW);
}
| B256IMAGEDRAW args_eeeee {
- addIntOp(OP_PUSHINT,5); // nr of arguments
+ addLongOp(OP_PUSHLONG,5); // nr of arguments
addOp(OP_IMAGEDRAW);
}
| B256IMAGEDRAW args_eeee {
- addIntOp(OP_PUSHINT,4); // nr of arguments
+ addLongOp(OP_PUSHLONG,4); // nr of arguments
addOp(OP_IMAGEDRAW);
}
| B256IMAGEDRAW args_eee {
- addIntOp(OP_PUSHINT,3); // nr of arguments
+ addLongOp(OP_PUSHLONG,3); // nr of arguments
addOp(OP_IMAGEDRAW);
}
;
@@ -4542,19 +4554,19 @@ imagedrawstmt:
imagecenteredstmt:
B256IMAGECENTERED args_eeeeee
{
- addIntOp(OP_PUSHINT,6); // nr of arguments
+ addLongOp(OP_PUSHLONG,6); // nr of arguments
addOp(OP_IMAGECENTERED);
}
| B256IMAGECENTERED args_eeeee {
- addIntOp(OP_PUSHINT,5); // nr of arguments
+ addLongOp(OP_PUSHLONG,5); // nr of arguments
addOp(OP_IMAGECENTERED);
}
| B256IMAGECENTERED args_eeee {
- addIntOp(OP_PUSHINT,4); // nr of arguments
+ addLongOp(OP_PUSHLONG,4); // nr of arguments
addOp(OP_IMAGECENTERED);
}
| B256IMAGECENTERED args_eee {
- addIntOp(OP_PUSHINT,3); // nr of arguments
+ addLongOp(OP_PUSHLONG,3); // nr of arguments
addOp(OP_IMAGECENTERED);
}
;
@@ -4564,7 +4576,7 @@ imagetransformedstmt:
addOp(OP_IMAGETRANSFORMED);
}
| B256IMAGETRANSFORMED args_eeeeeeeee {
- addIntOp(OP_PUSHINT,1); // opacity
+ addLongOp(OP_PUSHLONG,1); // opacity
addOp(OP_IMAGETRANSFORMED);
}
;
@@ -4581,7 +4593,7 @@ imageflipstmt:
addOp(OP_IMAGEFLIP);
}
| B256IMAGEFLIP args_ee {
- addIntOp(OP_PUSHINT,0);
+ addLongOp(OP_PUSHLONG,0);
addOp(OP_IMAGEFLIP);
}
;
--- basic256-2.0.99.10.orig/Main.cpp
+++ basic256-2.0.99.10/Main.cpp
@@ -162,7 +162,7 @@ int main(int argc, char *argv[]) {
#endif
qapp.installTranslator(&kbTranslator);
- MainWindow mainwin(0, 0, localecode, guimode);
+ MainWindow mainwin(0, Qt::Widget, localecode, guimode);
mainwin.setObjectName( "mainwin" );
mainwin.statusBar()->showMessage(QObject::tr("Ready."));
mainwin.show();
--- basic256-2.0.99.10.orig/MainWindow.cpp
+++ basic256-2.0.99.10/MainWindow.cpp
@@ -26,14 +26,13 @@
#include <QWaitCondition>
#include <QDesktopServices>
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QGridLayout>
-#include <QtWidgets/QMenuBar>
-#include <QtWidgets/QStatusBar>
-#include <QtWidgets/QDialog>
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QShortcut>
-#include <QtWidgets/QDesktopWidget>
+#include <QApplication>
+#include <QGridLayout>
+#include <QMenuBar>
+#include <QStatusBar>
+#include <QDialog>
+#include <QLabel>
+#include <QShortcut>
#include "MainWindow.h"
#include "Settings.h"
@@ -77,8 +76,8 @@ MainWindow::MainWindow(QWidget * parent,
// create the global mymutexes and waits
- mymutex = new QMutex(QMutex::NonRecursive);
- mydebugmutex = new QMutex(QMutex::NonRecursive);
+ mymutex = new QMutex();
+ mydebugmutex = new QMutex();
waitCond = new QWaitCondition();
waitDebugCond = new QWaitCondition();
@@ -166,7 +165,7 @@ MainWindow::MainWindow(QWidget * parent,
for(int i=0;i<SETTINGSGROUPHISTN;i++){
recentfiles_act[i] = filemenu_recentfiles->addAction(basicIcons->openIcon, QObject::tr(""));
if(i<10)
- recentfiles_act[i]->setShortcut(Qt::Key_0 + ((i+1)%SETTINGSGROUPHISTN) + Qt::CTRL);
+ recentfiles_act[i]->setShortcut(Qt::Key_0 | Qt::CTRL | ((i+1)%SETTINGSGROUPHISTN));
}
filemenu_recentfiles->addSeparator();
recentfiles_empty_act = filemenu_recentfiles->addAction(basicIcons->clearIcon, QObject::tr("&Clear list"));
@@ -256,35 +255,35 @@ MainWindow::MainWindow(QWidget * parent,
graphwin->slotGridLines(SETTINGSGRAPHGRIDLINESDEFAUT);
// Graphics Zoom
- double z = graphwin->getZoom();
- viewmenu_zoom = viewmenu->addMenu(basicIcons->zoomInIcon, QObject::tr("Graphics Window &Zoom"));
- viewmenu_zoom_group = new QActionGroup(this);
- viewmenu_zoom_group->setExclusive(true);
- viewmenu_zoom_1_4 = viewmenu_zoom_group->addAction(QObject::tr("1:4 (quarter)"));
- viewmenu_zoom_1_4->setCheckable(true);
- viewmenu_zoom_1_4->setChecked(z==0.25);
- viewmenu_zoom_1_4->setData(0.25);
- viewmenu_zoom_1_2 = viewmenu_zoom_group->addAction(QObject::tr("1:2 (half)"));
- viewmenu_zoom_1_2->setCheckable(true);
- viewmenu_zoom_1_2->setChecked(z==0.5);
- viewmenu_zoom_1_2->setData(0.5);
- viewmenu_zoom_1_1 = viewmenu_zoom_group->addAction(QObject::tr("1:1 (original)"));
- viewmenu_zoom_1_1->setCheckable(true);
- viewmenu_zoom_1_1->setChecked(z==1.0);
- viewmenu_zoom_1_1->setData(1.0);
- viewmenu_zoom_2_1 = viewmenu_zoom_group->addAction(QObject::tr("2:1 (double)"));
- viewmenu_zoom_2_1->setCheckable(true);
- viewmenu_zoom_2_1->setChecked(z==2.0);
- viewmenu_zoom_2_1->setData(2.0);
- viewmenu_zoom_3_1 = viewmenu_zoom_group->addAction(QObject::tr("3:1 (triple)"));
- viewmenu_zoom_3_1->setCheckable(true);
- viewmenu_zoom_3_1->setChecked(z==3.0);
- viewmenu_zoom_3_1->setData(3.0);
- viewmenu_zoom_4_1 = viewmenu_zoom_group->addAction(QObject::tr("4:1 (quadruple)"));
- viewmenu_zoom_4_1->setCheckable(true);
- viewmenu_zoom_4_1->setChecked(z==4.0);
- viewmenu_zoom_4_1->setData(4.0);
- viewmenu_zoom->addActions(viewmenu_zoom_group->actions());
+ //double z = graphwin->getZoom();
+ //viewmenu_zoom = viewmenu->addMenu(basicIcons->zoomInIcon, QObject::tr("Graphics Window &Zoom"));
+ //viewmenu_zoom_group = new QActionGroup(this);
+ //viewmenu_zoom_group->setExclusive(true);
+ //viewmenu_zoom_1_4 = viewmenu_zoom_group->addAction(QObject::tr("1:4 (quarter)"));
+ //viewmenu_zoom_1_4->setCheckable(true);
+ //viewmenu_zoom_1_4->setChecked(z==0.25);
+ //viewmenu_zoom_1_4->setData(0.25);
+ //viewmenu_zoom_1_2 = viewmenu_zoom_group->addAction(QObject::tr("1:2 (half)"));
+ //viewmenu_zoom_1_2->setCheckable(true);
+ //viewmenu_zoom_1_2->setChecked(z==0.5);
+ //viewmenu_zoom_1_2->setData(0.5);
+ //viewmenu_zoom_1_1 = viewmenu_zoom_group->addAction(QObject::tr("1:1 (original)"));
+ //viewmenu_zoom_1_1->setCheckable(true);
+ //viewmenu_zoom_1_1->setChecked(z==1.0);
+ //viewmenu_zoom_1_1->setData(1.0);
+ //viewmenu_zoom_2_1 = viewmenu_zoom_group->addAction(QObject::tr("2:1 (double)"));
+ //viewmenu_zoom_2_1->setCheckable(true);
+ //viewmenu_zoom_2_1->setChecked(z==2.0);
+ //viewmenu_zoom_2_1->setData(2.0);
+ //viewmenu_zoom_3_1 = viewmenu_zoom_group->addAction(QObject::tr("3:1 (triple)"));
+ //viewmenu_zoom_3_1->setCheckable(true);
+ //viewmenu_zoom_3_1->setChecked(z==3.0);
+ //viewmenu_zoom_3_1->setData(3.0);
+ //viewmenu_zoom_4_1 = viewmenu_zoom_group->addAction(QObject::tr("4:1 (quadruple)"));
+ //viewmenu_zoom_4_1->setCheckable(true);
+ //viewmenu_zoom_4_1->setChecked(z==4.0);
+ //viewmenu_zoom_4_1->setData(4.0);
+ //viewmenu_zoom->addActions(viewmenu_zoom_group->actions());
@@ -317,15 +316,15 @@ MainWindow::MainWindow(QWidget * parent,
runact->setShortcut(Qt::Key_F5);
editmenu->addSeparator();
debugact = runmenu->addAction(basicIcons->debugIcon, QObject::tr("&Debug"));
- debugact->setShortcut(Qt::Key_F5 + Qt::CTRL);
+ debugact->setShortcut(Qt::Key_F5 | Qt::CTRL);
stepact = runmenu->addAction(basicIcons->stepIcon, QObject::tr("S&tep"));
stepact->setShortcut(Qt::Key_F11);
stepact->setEnabled(false);
bpact = runmenu->addAction(basicIcons->breakIcon, QObject::tr("Run &to"));
- bpact->setShortcut(Qt::Key_F11 + Qt::CTRL);
+ bpact->setShortcut(Qt::Key_F11 | Qt::CTRL);
bpact->setEnabled(false);
stopact = runmenu->addAction(basicIcons->stopIcon, QObject::tr("&Stop"));
- stopact->setShortcut(Qt::Key_F5 + Qt::SHIFT);
+ stopact->setShortcut(Qt::Key_F5 | Qt::SHIFT);
stopact->setEnabled(false);
runmenu->addSeparator();
clearbreakpointsact = runmenu->addAction(basicIcons->clearIcon, QObject::tr("&Clear all breakpoints"));
@@ -423,7 +422,7 @@ MainWindow::MainWindow(QWidget * parent,
QObject::connect(outwin_toolbar_visible_act, SIGNAL(toggled(bool)), outwin_widget, SLOT(slotShowToolBar(const bool)));
QObject::connect(varwin_visible_act, SIGNAL(triggered(bool)), varwin_dock, SLOT(setVisible(bool)));
- QObject::connect(viewmenu_zoom_group, SIGNAL(triggered(QAction*)), this, SLOT(zoomGroupActionEvent(QAction*)));
+ //QObject::connect(viewmenu_zoom_group, SIGNAL(triggered(QAction*)), this, SLOT(zoomGroupActionEvent(QAction*)));
@@ -592,7 +591,8 @@ void MainWindow::about() {
#endif // WIN32PORTABLE
message += QObject::tr("version ") + "<b>" + VERSION + "</b>" + QObject::tr(" - built with QT ") + "<b>" + QT_VERSION_STR + "</b>" +
- "<br>" + QObject::tr("Locale Name: ") + "<b>" + locale->name() + "</b> "+ QObject::tr("Decimal Point: ") + "<b>'" + (usefloatlocale?locale->decimalPoint():'.') + "'</b>" +
+ "<br>" + QObject::tr("Locale Name: ") + "<b>" + locale->name() + "</b> "+
+ QObject::tr("Decimal Point: ") + "<b>'" + (usefloatlocale?locale->decimalPoint():QChar('.')) + "'</b>" +
"<p>" + QObject::tr("Copyright © 2006-2020, The BASIC-256 Team") + "</p>" +
"<p>" + QObject::tr("Please visit our web site at <a href=\"http://www.basic256.org\">http://www.basic256.org</a> for tutorials and documentation.") + "</p>" +
"<p>" + QObject::tr("Please see the CONTRIBUTORS file for a list of developers and translators for this project.") + "</p>" +
@@ -832,11 +832,11 @@ void MainWindow::sourceforgeReplyFinishe
filename = jsonObject["platform_releases"].toObject()["mac"].toObject()["filename"].toString();
url = jsonObject["platform_releases"].toObject()["mac"].toObject()["url"].toString();
#endif
- QRegExp rx("\\d+\\.\\d+\\.\\d+\\.\\d+");
- rx.indexIn(filename);
- QString siteversion = rx.cap(0);
- rx.indexIn(VERSION);
- QString thisversion = rx.cap(0);
+ QRegularExpression rx("\\d+\\.\\d+\\.\\d+\\.\\d+");
+ QRegularExpressionMatch match = rx.match(filename);
+ QString siteversion = match.captured(0);
+ match = rx.match(VERSION);
+ QString thisversion = match.captured(0);
if(siteversion=="" || thisversion==""){
//Unknown error
if(!autoCheckForUpdate)QMessageBox::warning(this, tr("Check for an update"), tr("Unknown error."),QMessageBox::Ok, QMessageBox::Ok);
@@ -1183,93 +1183,93 @@ void MainWindow::loadProgram() {
bool MainWindow::loadFile(QString s) {
s = s.trimmed();
- if (s != NULL) {
- bool doload = true;
- if (QFile::exists(s)) {
- QFile f(s);
- if (f.open(QIODevice::ReadOnly)) {
- QFileInfo fi(f);
- QString filename = fi.absoluteFilePath();
-
- //check if file is already open
- for(int i=0; i<editwintabs->count(); i++){
- BasicEdit* e = (BasicEdit*)editwintabs->widget(i);
- if(e && e->filename==filename){
- f.close();
- editwintabs->setCurrentIndex(i);
- return true;
- }
+ if (s.length()) {
+ bool doload = true;
+ if (QFile::exists(s)) {
+ QFile f(s);
+ if (f.open(QIODevice::ReadOnly)) {
+ QFileInfo fi(f);
+ QString filename = fi.absoluteFilePath();
+
+ //check if file is already open
+ for(int i=0; i<editwintabs->count(); i++){
+ BasicEdit* e = (BasicEdit*)editwintabs->widget(i);
+ if(e && e->filename==filename){
+ f.close();
+ editwintabs->setCurrentIndex(i);
+ return true;
}
+ }
- QMimeDatabase db;
- QMimeType mime = db.mimeTypeForFile(fi);
- // Get user confirmation for non-text files
- //Remember that empty ".kbs" files are detected as non-text files
- if (!(mime.inherits("text/plain") && !(fi.fileName().endsWith(".kbs",Qt::CaseInsensitive) && fi.size()==0))) {
- doload = ( QMessageBox::Yes == QMessageBox::warning(this, QObject::tr("Load File"),
- QObject::tr("It does not seem to be a text file.")+ "\n" + QObject::tr("Load it anyway?"),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No));
- }else if (!fi.fileName().endsWith(".kbs",Qt::CaseInsensitive)) {
- doload = ( QMessageBox::Yes == QMessageBox::warning(this, QObject::tr("Load File"),
- QObject::tr("You're about to load a file that does not end with the .kbs extension.")+ "\n" + QObject::tr("Load it anyway?"),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No));
- }
- if (doload) {
- //replace empty document created by default (if exists)
- bool replaceEmptyDoc = false;
- BasicEdit *neweditor;
- if(untitledNumber==2){
- BasicEdit *e = (BasicEdit*)editwintabs->currentWidget();
- if(e){
- if(e->filename.isEmpty() && !e->document()->isModified()){
- neweditor=e;
- replaceEmptyDoc=true;
- }
+ QMimeDatabase db;
+ QMimeType mime = db.mimeTypeForFile(fi);
+ // Get user confirmation for non-text files
+ //Remember that empty ".kbs" files are detected as non-text files
+ if (!(mime.inherits("text/plain") && !(fi.fileName().endsWith(".kbs",Qt::CaseInsensitive) && fi.size()==0))) {
+ doload = ( QMessageBox::Yes == QMessageBox::warning(this, QObject::tr("Load File"),
+ QObject::tr("It does not seem to be a text file.")+ "\n" + QObject::tr("Load it anyway?"),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No));
+ }else if (!fi.fileName().endsWith(".kbs",Qt::CaseInsensitive)) {
+ doload = ( QMessageBox::Yes == QMessageBox::warning(this, QObject::tr("Load File"),
+ QObject::tr("You're about to load a file that does not end with the .kbs extension.")+ "\n" + QObject::tr("Load it anyway?"),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No));
+ }
+ if (doload) {
+ //replace empty document created by default (if exists)
+ bool replaceEmptyDoc = false;
+ BasicEdit *neweditor;
+ if(untitledNumber==2){
+ BasicEdit *e = (BasicEdit*)editwintabs->currentWidget();
+ if(e){
+ if(e->filename.isEmpty() && !e->document()->isModified()){
+ neweditor=e;
+ replaceEmptyDoc=true;
}
}
- if(!replaceEmptyDoc) neweditor = newEditor(fi.fileName());
- editwin = neweditor;
- neweditor->filename = filename;
- neweditor->path = fi.absolutePath();
- neweditor->title=fi.fileName();
-
- updateStatusBar(QObject::tr("Loading file..."));
- QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- QByteArray ba = f.readAll();
- f.close();
- neweditor->setPlainText(QString::fromUtf8(ba.data()));
- neweditor->document()->setModified(false);
- setWindowTitle(fi.fileName());
- addFileToRecentList(s);
- QApplication::restoreOverrideCursor();
- updateStatusBar(QObject::tr("Ready."));
- if(fileSystemWatcher) fileSystemWatcher->addPath(filename);
-
- //add tab and make it active
- if(!replaceEmptyDoc){
- int i = editwintabs->addTab(neweditor, neweditor->title);
- editwintabs->setTabIcon(i, basicIcons->documentIcon);
- editwintabs->setCurrentIndex(i);
- }else{
- neweditor->updateTitle();
- }
- return true;
}
+ if(!replaceEmptyDoc) neweditor = newEditor(fi.fileName());
+ editwin = neweditor;
+ neweditor->filename = filename;
+ neweditor->path = fi.absolutePath();
+ neweditor->title=fi.fileName();
+
+ updateStatusBar(QObject::tr("Loading file..."));
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ QByteArray ba = f.readAll();
f.close();
- } else {
- QMessageBox::warning(this, QObject::tr("Load File"),
- QObject::tr("Unable to open program file")+" \""+s+"\".\n"+QObject::tr("File permissions problem or file open by another process."),
- QMessageBox::Ok, QMessageBox::Ok);
+ neweditor->setPlainText(QString::fromUtf8(ba.data()));
+ neweditor->document()->setModified(false);
+ setWindowTitle(fi.fileName());
+ addFileToRecentList(s);
+ QApplication::restoreOverrideCursor();
+ updateStatusBar(QObject::tr("Ready."));
+ if(fileSystemWatcher) fileSystemWatcher->addPath(filename);
+
+ //add tab and make it active
+ if(!replaceEmptyDoc){
+ int i = editwintabs->addTab(neweditor, neweditor->title);
+ editwintabs->setTabIcon(i, basicIcons->documentIcon);
+ editwintabs->setCurrentIndex(i);
+ }else{
+ neweditor->updateTitle();
+ }
+ return true;
}
+ f.close();
} else {
QMessageBox::warning(this, QObject::tr("Load File"),
- QObject::tr("Program file does not exist.")+" \""+s+QObject::tr("\"."),
+ QObject::tr("Unable to open program file")+" \""+s+"\".\n"+QObject::tr("File permissions problem or file open by another process."),
QMessageBox::Ok, QMessageBox::Ok);
}
+ } else {
+ QMessageBox::warning(this, QObject::tr("Load File"),
+ QObject::tr("Program file does not exist.")+" \""+s+QObject::tr("\"."),
+ QMessageBox::Ok, QMessageBox::Ok);
}
-return false;
+ }
+ return false;
}
void MainWindow::updateWindowMenu(){
--- basic256-2.0.99.10.orig/MainWindow.h
+++ basic256-2.0.99.10/MainWindow.h
@@ -29,16 +29,14 @@
#include <QJsonObject>
#include <QJsonArray>
-
-
-#include <QtWidgets/QMainWindow>
-#include <QtWidgets/QGridLayout>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QMessageBox>
-#include <QtWidgets/QShortcut>
-#include <QtWidgets/QScrollArea>
-#include <QtWidgets/QFontDialog>
-#include <QtWidgets/QFileDialog>
+#include <QMainWindow>
+#include <QGridLayout>
+#include <QAction>
+#include <QMessageBox>
+#include <QShortcut>
+#include <QScrollArea>
+#include <QFontDialog>
+#include <QFileDialog>
#include <QClipboard>
#include <QFileSystemWatcher>
--- basic256-2.0.99.10.orig/PreferencesWin.cpp
+++ basic256-2.0.99.10/PreferencesWin.cpp
@@ -416,36 +416,36 @@ PreferencesWin::PreferencesWin (QWidget
paperlabel = new QLabel(tr("Paper:"),this);
printertablayout->addWidget(paperlabel,r,1,1,1);
papercombo = new QComboBox(this);
- papercombo->addItem(tr("A0 (841 x 1189 mm)"), QPrinter::A0);
- papercombo->addItem(tr("A1 (594 x 841 mm)"), QPrinter::A1);
- papercombo->addItem(tr("A2 (420 x 594 mm)"), QPrinter::A2);
- papercombo->addItem(tr("A3 (297 x 420 mm)"), QPrinter::A3);
- papercombo->addItem(tr("A4 (210 x 297 mm, 8.26 x 11.69 inches)"), QPrinter::A4);
- papercombo->addItem(tr("A5 (148 x 210 mm)"), QPrinter::A5);
- papercombo->addItem(tr("A6 (105 x 148 mm)"), QPrinter::A6);
- papercombo->addItem(tr("A7 (74 x 105 mm)"), QPrinter::A7);
- papercombo->addItem(tr("A9 (52 x 74 mm)"), QPrinter::A8);
- papercombo->addItem(tr("A9 (37 x 52 mm)"), QPrinter::A9);
- papercombo->addItem(tr("B0 (1000 x 1414 mm)"), QPrinter::B0);
- papercombo->addItem(tr("B1 (707 x 1000 mm)"), QPrinter::B1);
- papercombo->addItem(tr("B2 (500 x 707 mm)"), QPrinter::B2);
- papercombo->addItem(tr("B3 (353 x 500 mm)"), QPrinter::B3);
- papercombo->addItem(tr("B4 (250 x 353 mm)"), QPrinter::B4);
- papercombo->addItem(tr("B5 (176 x 250 mm, 6.93 x 9.84 inches)"), QPrinter::B5);
- papercombo->addItem(tr("B6 (125 x 176 mm)"), QPrinter::B6);
- papercombo->addItem(tr("B7 (88 x 125 mm)"), QPrinter::B7);
- papercombo->addItem(tr("B8 (62 x 88 mm)"), QPrinter::B8);
- papercombo->addItem(tr("B9 (33 x 62 mm)"), QPrinter::B9);
- papercombo->addItem(tr("B10 (31 x 44 mm)"), QPrinter::B10);
- papercombo->addItem(tr("#5 Envelope (163 x 229 mm)"), QPrinter::C5E);
- papercombo->addItem(tr("#10 Envelope (105 x 241 mm)"), QPrinter::Comm10E);
- papercombo->addItem(tr("DLE (110 x 220 mm)"), QPrinter::DLE);
- papercombo->addItem(tr("Executive (7.5 x 10 inches, 190.5 x 254 mm)"), QPrinter::Executive);
- papercombo->addItem(tr("Folio (210 x 330 mm)"), QPrinter::Folio);
- papercombo->addItem(tr("Ledger (431.8 x 279.4 mm)"), QPrinter::Ledger);
- papercombo->addItem(tr("Legal (8.5 x 14 inches, 215.9 x 355.6 mm)"), QPrinter::Legal);
- papercombo->addItem(tr("Letter (8.5 x 11 inches, 215.9 x 279.4 mm)"), QPrinter::Letter);
- papercombo->addItem(tr("Tabloid (279.4 x 431.8 mm)"), QPrinter::Tabloid);
+ papercombo->addItem(tr("A0 (841 x 1189 mm)"), QPageSize::A0);
+ papercombo->addItem(tr("A1 (594 x 841 mm)"), QPageSize::A1);
+ papercombo->addItem(tr("A2 (420 x 594 mm)"), QPageSize::A2);
+ papercombo->addItem(tr("A3 (297 x 420 mm)"), QPageSize::A3);
+ papercombo->addItem(tr("A4 (210 x 297 mm, 8.26 x 11.69 inches)"), QPageSize::A4);
+ papercombo->addItem(tr("A5 (148 x 210 mm)"), QPageSize::A5);
+ papercombo->addItem(tr("A6 (105 x 148 mm)"), QPageSize::A6);
+ papercombo->addItem(tr("A7 (74 x 105 mm)"), QPageSize::A7);
+ papercombo->addItem(tr("A9 (52 x 74 mm)"), QPageSize::A8);
+ papercombo->addItem(tr("A9 (37 x 52 mm)"), QPageSize::A9);
+ papercombo->addItem(tr("B0 (1000 x 1414 mm)"), QPageSize::B0);
+ papercombo->addItem(tr("B1 (707 x 1000 mm)"), QPageSize::B1);
+ papercombo->addItem(tr("B2 (500 x 707 mm)"), QPageSize::B2);
+ papercombo->addItem(tr("B3 (353 x 500 mm)"), QPageSize::B3);
+ papercombo->addItem(tr("B4 (250 x 353 mm)"), QPageSize::B4);
+ papercombo->addItem(tr("B5 (176 x 250 mm, 6.93 x 9.84 inches)"), QPageSize::B5);
+ papercombo->addItem(tr("B6 (125 x 176 mm)"), QPageSize::B6);
+ papercombo->addItem(tr("B7 (88 x 125 mm)"), QPageSize::B7);
+ papercombo->addItem(tr("B8 (62 x 88 mm)"), QPageSize::B8);
+ papercombo->addItem(tr("B9 (33 x 62 mm)"), QPageSize::B9);
+ papercombo->addItem(tr("B10 (31 x 44 mm)"), QPageSize::B10);
+ papercombo->addItem(tr("#5 Envelope (163 x 229 mm)"), QPageSize::C5E);
+ papercombo->addItem(tr("#10 Envelope (105 x 241 mm)"), QPageSize::Comm10E);
+ papercombo->addItem(tr("DLE (110 x 220 mm)"), QPageSize::DLE);
+ papercombo->addItem(tr("Executive (7.5 x 10 inches, 190.5 x 254 mm)"), QPageSize::Executive);
+ papercombo->addItem(tr("Folio (210 x 330 mm)"), QPageSize::Folio);
+ papercombo->addItem(tr("Ledger (431.8 x 279.4 mm)"), QPageSize::Ledger);
+ papercombo->addItem(tr("Legal (8.5 x 14 inches, 215.9 x 355.6 mm)"), QPageSize::Legal);
+ papercombo->addItem(tr("Letter (8.5 x 11 inches, 215.9 x 279.4 mm)"), QPageSize::Letter);
+ papercombo->addItem(tr("Tabloid (279.4 x 431.8 mm)"), QPageSize::Tabloid);
// set setting and select
setpaper = settings.value(SETTINGSPRINTERPAPER, SETTINGSPRINTERPAPERDEFAULT).toInt();
int index = papercombo->findData(setpaper);
@@ -490,8 +490,8 @@ PreferencesWin::PreferencesWin (QWidget
orientbox->addWidget(orientlandscape);
orientgroup->setLayout(orientbox);
printertablayout->addWidget(orientgroup,r,2,1,2);
- orientportrait->setChecked(settings.value(SETTINGSPRINTERORIENT, SETTINGSPRINTERORIENTDEFAULT)==QPrinter::Portrait);
- orientlandscape->setChecked(settings.value(SETTINGSPRINTERORIENT, SETTINGSPRINTERORIENTDEFAULT)==QPrinter::Landscape);
+ orientportrait->setChecked(settings.value(SETTINGSPRINTERORIENT, SETTINGSPRINTERORIENTDEFAULT)==QPageLayout::Portrait);
+ orientlandscape->setChecked(settings.value(SETTINGSPRINTERORIENT, SETTINGSPRINTERORIENTDEFAULT)==QPageLayout::Landscape);
}
@@ -610,8 +610,8 @@ void PreferencesWin::clickSaveButton() {
if (resolutionhigh->isChecked()) settings.setValue(SETTINGSPRINTERRESOLUTION, QPrinter::HighResolution);
if (resolutionscreen->isChecked()) settings.setValue(SETTINGSPRINTERRESOLUTION, QPrinter::ScreenResolution);
//
- if (orientportrait->isChecked()) settings.setValue(SETTINGSPRINTERORIENT, QPrinter::Portrait);
- if (orientlandscape->isChecked()) settings.setValue(SETTINGSPRINTERORIENT, QPrinter::Landscape);
+ if (orientportrait->isChecked()) settings.setValue(SETTINGSPRINTERORIENT, QPageLayout::Portrait);
+ if (orientlandscape->isChecked()) settings.setValue(SETTINGSPRINTERORIENT, QPageLayout::Landscape);
// *******************************************************************************************
@@ -702,7 +702,7 @@ SettingsBrowser::SettingsBrowser (QWidge
settings.beginGroup(app);
QStringList keys = settings.childKeys();
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidgetSettings, (QStringList() << app << QString::number(keys.count())) );
- item->setFlags(item->flags() | Qt::ItemIsTristate | Qt::ItemIsUserCheckable);
+ item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(0, Qt::Unchecked);
item->setIcon(0,iconProvider.icon(QFileIconProvider::Folder));
for (int k = 0; k < keys.size(); k++){
--- basic256-2.0.99.10.orig/PreferencesWin.h
+++ basic256-2.0.99.10/PreferencesWin.h
@@ -16,22 +16,22 @@
**/
#include <QObject>
-#include <QtWidgets/QMessageBox>
-#include <QtWidgets/QWidget>
-#include <QtWidgets/QDialog>
-#include <QtWidgets/QGridLayout>
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QToolBar>
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QLineEdit>
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QComboBox>
-#include <QtWidgets/QPushButton>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QTabWidget>
-#include <QtWidgets/QGroupBox>
-#include <QtWidgets/QRadioButton>
-#include <QtWidgets/QSlider>
+#include <QMessageBox>
+#include <QWidget>
+#include <QDialog>
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QToolBar>
+#include <QLabel>
+#include <QLineEdit>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QPushButton>
+#include <QAction>
+#include <QTabWidget>
+#include <QGroupBox>
+#include <QRadioButton>
+#include <QSlider>
#include <QToolTip>
#include <QFileIconProvider>
#include <QTreeWidget>
--- basic256-2.0.99.10.orig/ReplaceWin.h
+++ basic256-2.0.99.10/ReplaceWin.h
@@ -15,12 +15,12 @@
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
**/
-#include <QtWidgets/QDialog>
-#include <QtWidgets/QGridLayout>
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QLineEdit>
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QAction>
+#include <QDialog>
+#include <QGridLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QCheckBox>
+#include <QAction>
#include <QComboBox>
#include "BasicEdit.h"
--- basic256-2.0.99.10.orig/RunController.h
+++ basic256-2.0.99.10/RunController.h
@@ -21,11 +21,11 @@
#include <qglobal.h>
-#include <QtWidgets/QTextEdit>
-#include <QtWidgets/QPushButton>
-#include <QtWidgets/QStatusBar>
-#include <QtTextToSpeech/QTextToSpeech>
-#include <QtTextToSpeech/QVoice>
+#include <QTextEdit>
+#include <QPushButton>
+#include <QStatusBar>
+#include <QTextToSpeech>
+#include <QVoice>
#include <QThread>
#include <QLocale>
--- basic256-2.0.99.10.orig/Sound.h
+++ basic256-2.0.99.10/Sound.h
@@ -25,6 +25,7 @@
#include <QTimer>
#include <QMediaPlayer>
#include <QAudioOutput>
+#include <QAudioFormat>
#include <QBuffer>
#include <QEventLoop>
#include <QFileInfo>
--- basic256-2.0.99.10.orig/Stack.cpp
+++ basic256-2.0.99.10/Stack.cpp
@@ -93,6 +93,11 @@ void Stack::pushInt(int i) {
stackdata[stackpointer++] = new DataElement((long)i);
}
+void Stack::pushUInt(unsigned int i) {
+ if (stackpointer >= stacksize) stackGrow();
+ stackdata[stackpointer++] = new DataElement((long)i);
+}
+
void Stack::pushBool(bool i) {
if (stackpointer >= stacksize) stackGrow();
stackdata[stackpointer++] = new DataElement(i?1L:0L);
@@ -150,6 +155,16 @@ int Stack::popBool() {
return b;
}
+unsigned int Stack::popUInt() {
+ if (stackpointer==0) {
+ e = ERROR_STACKUNDERFLOW;
+ return 0;
+ }
+ unsigned int i = convert->getUInt(stackdata[--stackpointer]);
+ delete stackdata[stackpointer];
+ return i;
+}
+
int Stack::popInt() {
if (stackpointer==0) {
e = ERROR_STACKUNDERFLOW;
@@ -159,7 +174,6 @@ int Stack::popInt() {
delete stackdata[stackpointer];
return i;
}
-
long Stack::popLong() {
if (stackpointer==0) {
e = ERROR_STACKUNDERFLOW;
@@ -209,7 +223,7 @@ QColor Stack::popQColor() {
return Qt::transparent;
}
} else {
- return QColor::fromRgba((QRgb) popInt());
+ return QColor::fromRgba((QRgb) popUInt());
}
}
--- basic256-2.0.99.10.orig/Stack.h
+++ basic256-2.0.99.10/Stack.h
@@ -34,6 +34,7 @@ class Stack
void pushBool(bool);
void pushQString(QString);
void pushInt(int);
+ void pushUInt(unsigned int);
void pushLong(long);
void pushRef(int, int);
void pushDouble(double);
@@ -47,6 +48,7 @@ class Stack
int peekType(int);
DataElement *popDE();
int popInt();
+ unsigned int popUInt();
int popBool();
QColor popQColor();
long popLong();
--- basic256-2.0.99.10.orig/VariableWin.h
+++ basic256-2.0.99.10/VariableWin.h
@@ -64,8 +64,8 @@ private:
bool operator<(const QTreeWidgetItem &other)const {
const int column = treeWidget()->sortColumn();
if(column==COLUMNTYPE)
- return data(column,Qt::EditRole) < other.data(column,Qt::EditRole);
- return data(column,Qt::UserRole + 1) < other.data(column,Qt::UserRole + 1);
+ return data(column,Qt::EditRole).toString() < other.data(column,Qt::EditRole).toString();
+ return data(column,Qt::UserRole + 1).toString() < other.data(column,Qt::UserRole + 1).toString();
}
};
--- basic256-2.0.99.10.orig/Version.h
+++ basic256-2.0.99.10/Version.h
@@ -19,8 +19,8 @@
#ifndef __VERSION
#define __VERSION
-#define VERSION "2.0.99.10 (2024-04-03)"
-#define VERSIONSIGNATURE 2009910
-#define VERSIONPRODUCT 2,0,99,10
+#define VERSION "2.0.99.12 (2024-11-03)"
+#define VERSIONSIGNATURE 2009912
+#define VERSIONPRODUCT 2,0,99,12
#endif
--- basic256-2.0.99.10.orig/WordCodes.h
+++ basic256-2.0.99.10/WordCodes.h
@@ -26,6 +26,7 @@
#define OPTYPE_LABEL 0x04000000 // label number (int) - converted to address at runtime
#define OPTYPE_VARIABLE 0x05000000 // variable number (int)
#define OPTYPE_VAR_VAR 0x06000000 // two variable numbers (int*2)
+#define OPTYPE_LONG 0x07000000 // a trailing LONG
#define OPTYPE_MASK 0xff000000 // and mask to strip optype out of opcode
@@ -373,6 +374,7 @@
#define OP_PUSHSTRING OPTYPE_STRING + 0x000000
+#define OP_PUSHLONG OPTYPE_LONG + 0x000000
|