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 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439
|
The following are the changes from calc version 2.15.0.7 to 2.15.1.0:
Converted all ASCII tabs to ASCII spaces using a 8 character
tab stop, for all files, except for all Makefiles (plus rpm.mk).
The command `git diff -w` reports no changes. There is no
functionality change in calc: only ASCII tabs to ASCII spaces.
Fixed trailblank. It was pruning . in its find search.
Added check for ASCII tabs is non-Makefiles.
This version will form the basis for the calc v2 to calc v3 fork.
The following are the changes from calc version 2.15.0.6 to 2.15.0.7:
Thanks to GitHub user @bambooleafz a critical bug (GitHub issue
#148 - https://github.com/lcn2/calc/issues/148) they identified
was fixed.
The following are the changes from calc version 2.15.0.5 to 2.15.0.6:
Thanks to GitHub user @ashamedbit, a long standing memory leak in
zrandom.c has been fixed.
The following are the changes from calc version 2.15.0.4 to 2.15.0.5:
make clobber now removes the legacy files: have_fpos.h, help/man,
and help/usage. The latter 2 are now managed as help aliases
in help.c.
make install now removes the legacy files: ${HELPDIR}/man
and ${HELPDIR}/usage.
Fixed a problem where, when calc was linked with and uses GNU
readline then for any multi-line copy-and-paste, only the first
line is executed. Thanks to GitHub user @malfisya for reporting
this problem, and thanks to GitHub user @gromit1811 for doing
the research needed to overcome deficiencies in the GNU readline
documentation, and for supplying the work-a-round to allow
multi-line copy-and-paste to work as expected!
The following are the changes from calc version 2.15.0.3 to 2.15.0.4:
Fixed bug that caused calc to fail to compile filepos2z() in file.c
on little endian machines for the Debian apcalc package. Thanks to
Martin Buck (m at rtin-buck dor de) for for fix.
Removed unused macros from zmath.h:
SWAP_B32_IN_HASH(dest, src)
SWAP_B16_IN_HASH(dest, src)
SWAP_B8_IN_HASH(dest, src)
SWAP_B32_IN_FLAG(dest, src)
SWAP_B16_IN_FLAG(dest, src)
SWAP_B8_IN_FLAG(dest, src)
When SWAP_HALF_IN_B32(dest, src), SWAP_B32_IN_FULL(dest, src),
SWAP_B16_IN_HALF(dest, src), SWAP_B32_IN_bool(dest, src),
or SWAP_B32_IN_LEN(dest, src), SWAP_HALF_IN_FILEPOS(dest, src)
is an assignment such as:
(*(dest) = *(src))
We now case the dest and src pointers to the proper type before
referencing and performing the assignment.
Documented unexpected behavior when calc is running in
"shell script mode" and the prompt builtin function is used
without the -p flag. Updated help/prompt, help/unexpected
and the calc man page accordingly.
Unless calc is given the -p command line option, calc will reopen
stdin as /dev/null instead of just closing stdin. This prevents
subsequent opens grabbing the 1st file descriptor.
Disable regress tests 4709, 4710, and 7763 because they print
multi-byte sequences, which are just fine for calc, the awk
used to evaluate the regression suite output in some legacy
systems report a "multibyte conversion failure".
Added a number of missing Makefile variables to the "make env" rule.
The man command is used to format the calc.1 man page into calc.usage.
The "help calc" command now prints the formatted calc man page (calc.usage).
The "help man" command now prints the formatted calc man page (calc.usage).
The "help usage" command now prints the formatted calc man page (calc.usage).
The file, calc.cat1, is formed by gzipping the calc.usage
formatted man page. The calc.cat1 is installed as the calc
cat section 1 man page.
Updated the Copyright string in version.c to refer to
the COPYING file and the "help copying" command.
Added calc.cat1 to .gitignore. Using "sort -d -u" to sort .gitignore content.
Avoiding use of modern [[ and ]] in Makefile for those legacy systems
whose shell do not support them. Be sure to use ||'s between []'s
to avoid problems with legacy shell such as the Bourne shell. *sigh*
Fixed the order of "help full" to match the order of topics listed
buy the "help help" command.
Sorted the halias[] help topics table in help.c using sort -d -u.
The following are the changes from calc version 2.15.0.1 to 2.15.0.2:
Updated BUGS about MSYS2 on Windows compiling of calc.
Added more git related checks and sanity checks to chk_tree.
Added ${FSANITIZE} make variable to Makefile.config to hold
common Address Sanitizer (ASAN) optins to modern Linux and macOS.
The Address Sanitizer is NOT enabled not compiled in by default.
Improved comments in Makefile.local for RHEL9.2 (Linux) and for
macOS 14.0 that, when uncommented and calc is recompiled (i.e.,
make clobber all) will enable the Address Sanitizer (ASAN) for calc.
Fixed memory leaks in the logn, aversin, acoversin, avercos,
acovercos, ahaversin, ahavercos, ahacovercos, aexsec,
aexcsc, and acrd.
Fixed a compile error in zmath.h that impacted legacy 32-bit Big
Endian machines. Thanks goes to GitHub user @gromit1811 for their
pull request.
Fixed the check for <sys/mount.h> when forming have_sys_mount.h.
Thanks goes to GitHub user @gromit1811 for their pull request.
Added "STATIC bool blum_initialized = false" to zrandom.c to improve
how the code detects if the Blum-Blum-Shub pseudo-random number
generator is seeded or not, and how to free the state correctly.
NOTE: There is a very minor memory leak in zrandom.c that will be
fixed in a later release.
The following are the changes from calc version 2.14.3.5 to 2.15.0.1:
The tarball for calc version 2.15.0.0 was missing version.h.
The version.h is now listed as part of the calc distribution.
Added the following new trigonometric functions:
versin(x [,eps]) versed trigonometric sine
coversin(x [,eps]) coversed trigonometric sine
vercos(x [,eps]) versed trigonometric cosine
covercos(x [,eps]) coversed trigonometric cosine
aversin(x [,eps]) inverse versed trigonometric sine
acoversin(x [,eps]) inverse coversed trigonometric sine
avercos(x [,eps]) inverse versed trigonometric cosine
acovercos(x [,eps]) inverse coversed trigonometric cosine
haversin(x [,eps]) half versed trigonometric sine
hacoversin(x [,eps]) half coversed trigonometric sine
havercos(x [,eps]) half versed trigonometric cosine
hacovercos(x [,eps]) half coversed trigonometric cosine
ahaversin(x [,eps]) inverse half versed trigonometric sine
ahacoversin(x [,eps]) inverse half coversed trigonometric sine
ahavercos(x [,eps]) inverse half versed trigonometric cosine
ahacovercos(x [,eps]) inverse half coversed trigonometric cosine
exsec(x [,eps]) exterior trigonometric secant
aexsec(x [,eps]) inverse exterior trigonometric secant
excsc(x [,eps]) exterior trigonometric cosecant
aexcsc(x [,eps]) inverse exterior trigonometric cosecant
crd(x [,eps]) trigonometric chord of a unit circle
acrd(x [,eps]) inverse trigonometric chord of a unit circle
cas(x [,eps]) trigonometric cosine plus sine
cis(x [,eps]) Euler's formula
As Msys2 is a fork of Cygwin, if the OSNAME is Msys, the Cygwin
target will be used. Thanks to GitHub user @iahung2 for the
pull request.
Support for win32 and DJGPP has been dropped. Calc version
2.14.3.5 was the last to make references to win32 and make
references to DJGPP. Future versions of calc may work under
those systems, we just elected to remove the somewhat out of
date and awkward `win32.mkdef` and related win32 references.
If you are a win32 user, please feel free to create a win32
target in Makefile.target and submit as a pull request.
If you are a DJGPP user, please feel free to create a DJGPP
target in Makefile.target and submit as a pull request.
Until someone can test such systems, we prefer to wait
until someone is able to test and supply a pull request.
Added PTR_LEN (length of a pointer) and PTR_BITS (bit length
of a pointer) to longbits.h.
Moved calc version definition from version.c to version.h.
Sorted the order of symbols printed by "make env".
Test if <stdbool.h> exists and set HAVE_STDBOOL_H accordingly
in have_stdbool.h. Added HAVE_STDBOOL_H to allow one to force
this value.
Added "bool.h" include file to support use of boolean symbols,
true and false for pre-c99 C compilers. The "bool.h" include
file defines TRUE as true, FALSE as false, and BOOL as bool:
for backward compatibility.
Replaced in C source, TRUE with true, FALSE with false, and
BOOL with bool.
Fixed have_statfs optional executable file extension ${EXT{ in
the ${UTIL_PROGS} make variable.
Test if <stdint.h> exists and set HAVE_STDINT_H accordingly
in have_stdint.h. Added HAVE_STDINT_H to allow one to force
this value.
Test if <inttypes.h> exists and set HAVE_INTTYPES_H accordingly
in have_inttypes.h. Added HAVE_INTTYPES_H to allow one to force
this value.
Added c_chk.c to check the compiler and C include for calc
requirements. If you are unable to compile this program, or
if this program when compiles does not exit 0, then your C
compiler and/or C include fails to meet calc requirements.
Compilers that are at least c99 MUST be able to compile this
program such that when run will exit 0.
The "make hsrc" file will attempt to compile and run c_chk and
will warn if the C compiler and/or C include fails to meet
calc requirements. The "make debug" system will run c_chk -c
to print information about the C compiler and C include.
Currently failure to compile cc_chk.c or c_chk exiting non-0
will just print "WARNING!!" strings to stderr.
The make chk_c file also forms status.chk_c.h which either
defines CHK_C when the C compiler and select include files
appear to meet calc requirements, or undefines CHK_C
when it does not.
Added int.h as a central place for calc integer types and
integer macros.
Removed `-R release_file` and `-r release_file` command
line options from `ver_calc`. Add `-h` option. Updated
comments in "README.RELEASE", which serves as the contents
of the calc command "help release".
Added log2(x [,eps]) builtin function. When x is an integer
power of 2, log2(x) will return an integer, otherwise it will
return the equivalent of ln(x)/ln(2).
Removed CALC2_COMPAT in favor of ckecking if MAJOR_VER < 3.
The sign element in a ZVALUE is now of type SIGN, which is either
SB32 when MAJOR_VER < 3, or a bool otherwise.
The len element in a ZVALUE is of type LEN. LEN type is SB32 when
MAJOR_VER < 3, or a uintptr_t otherwise.
Setting an invalid epsilon via the epsilon(value) or confiv("epsilon",
value) triggers an error. The epsilon value must be: 0 < epsilon < 1.
Added new logn(x, n [,eps]) builtin to compute logarithms to base n.
Verify that eps arguments (error tolerance arguments that override
the default epsilon value) to builtin functions have proper values.
Previously the eps argument had little to no value checks for
many builtin functions.
Document in help files for builtin functions that take eps arguments,
the LIMIT range for such eps values.
Removed old Makefile testing rules for make dbx and make gdb.
Improved "make run" to execute calccalc using shared libraries
from the local directory, and with reading of the startup scripts
disabled.
Changed "make prep" to perform various tests that are used to
help verify that calc is ready for a release. Added the
update_ver tool, (formerly verupdate) and the trailblank tool
that existed outside of the calc source base but neverthless
used in the calc release process. Both of these tools are used
by "make prep".
Added Makefile testing rule "make testfuncsort" to check for
the sort of the builtin function list. Changed the order that
builtin functions are listed by "show builtin" and the help/builtin
to match the sorting of "LANG=C LC_ALL=C sort -d -u".
Added c_to_q(COMPLEX *c, bool cfree) to make is easier to convert
a COMPLEX value that is real (imag part is 0) into a NUMBER and
optionally free the COMPLEX value. The func.c code now uses c_to_q().
Added q_to_c(NUMBER *q) to make it easier to convert a NUMBER
into an allocated COMPLEX value.
Added new vercos(x, [,eps]) for versed cosine and covercos(x, [,eps])
for inverse versed cosine.
Added new avercos(x, [,eps]) for inverse versed cosine and acovercos(x, [,eps])
for inverse coversed cosine.
Improved comments about use of the ${CALC_ENV} Makefile variable.
Noted in Makefile.cal where and how the ${CALC_ENV} is used.
Use ${CALC_ENV} Makefile variable were needed.
Modified regression test cal/regress.cal: in some cases test numbers
were adjusted. Add comments indicate which test numbers apply to
which code. Indicated where there is room for new tests.
Expanded the end of test numbers from 9999 to 99999.
To make the meaning a bit more clear in cal/regress.cal, we have
renamed the following test calc resource files that are related to
the calc regression test suite:
cal/test1700.cal -> cal/test8000.read.cal
cal/test2300.cal -> cal/test2300.obj_incdec.cal
cal/test2600.cal -> cal/test2600.numfunc.cal
cal/test2700.cal -> cal/test2700.isqrt.cal
cal/test3100.cal -> cal/test3100.matobj.cal
cal/test3400.cal -> cal/test3400.trig.cal
cal/test4000.cal -> cal/test4000.ptest.cal
cal/test4100.cal -> cal/test4100.redc.cal
cal/test4600.cal -> cal/test4600.fileop.cal
cal/test5100.cal -> cal/test5100.newdecl.cal
cal/test5200.cal -> cal/test5200.globstat.cal
cal/test8400.cal -> cal/test8400.quit.cal
cal/test8500.cal -> cal/test8500.divmod.cal
cal/test8600.cal -> cal/test8600.maxargs.cal
cal/set8700.cal -> cal/test8700.dotest.cal
cal/test8900.cal -> cal/test8900.special.cal
cal/test9300.cal -> cal/test9300.frem.cal
Added to test 94dd, read of a number of new calc resource files
that are not already read as a result of the calc regression test suite.
Fixed more documentation and code comments that referred to the
old additive 55 (a55) shuffle pseudo-random number generator.
We have been using the subtractive 100 shuffle pseudo-random
number generator in place of the additive 55 generator for a
while now.
Improved help files trigonometric functions. They were corrected
to indicate that complex arguments are allowed: an oversight
from long ago when those trigonometric functions were expanded
to include complex arguments. The EXAMPLE sections were expanded
and made consistent, where applicable, across the trigonometric
help files. Documented libcalc functions in the SEE ALSO sections.
Improved "SEE ALSO" for the hyperbolic function help files.
Expanded the calc regression test suite test 34dd to test various
real and complex values for trigonometric functions.
Added complex multiple approximation function to commath.c so
that users of libcalc may directly round complex number to
nearest multiple of a given real number:
E_FUNC COMPLEX *cmappr(COMPLEX *c, NUMBER *e, long rnd, bool cfree);
For example:
COMPLEX *c; /* complex number to round to nearest epsilon */
NUMBER *eps; /* epsilon rounding precision */
COMPLEX *res; /* c rounded to nearest epsilon */
long rnd = 24L; /* a common rounding mode */
bool ok_to_free; /* true ==> free c, false ==> do not free c */
...
res = cmappr(c, eps, ok_to_free);
The complex trigonometric functions tan, cot, sec, csc were
implemented in func.c as calls to complex sin and complex cos.
We added the following direct calls to comfunc.c so that users
of libcalc may call them directly:
E_FUNC COMPLEX *c_tan(COMPLEX *c, NUMBER *eps);
E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps);
E_FUNC COMPLEX *c_sec(COMPLEX *c, NUMBER *eps);
E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps);
Added help/errorcodes rule to the top level Makefile.
Added E_USERMAX symbol (== 32767) to indicate the maximum value
allowed for user error codes.
Improved help/error. Added text about error code ranges and
range symbols.
Changed calc_errno a global int variable so that is may be directly
accessed by libcalc users.
Further improve help files for help/errno, help/error, help/newerror,
help/stoponerror and help/strerror by adding to documentation
of the calc error code system as well as libcalc interface
where applicable.
Changed #define E_USERDEF to #define E__USERDEF.
Removed use of E_USERDEF, E__BASE, E__COUNT, and E__HIGHEST
from custom/c_sysinfo because the c_sysinfo is just a demo
and this will simplify the custom/Makefile.
The include file calcerr.h is now the errsym.h include file.
The calcerr.tbl has been replaced by errtbl.c and errtbl.h.
The calcerr_c.awk, calcerr_c.sed, calcerr_h.awk, and
calcerr_h.sed files are now obsolete and have been removed.
The calcerr.c and calcerr.h now obsolete and are no longer built.
The calc computation error codes, symbols and messages are now in
a error_table[] array of struct errtbl.
An E_STRING is a string corresponds to an error code #define.
For example, the E_STRING for the calc error E_STRCAT,
is the string "E_STRING". An E_STRING must now match
the regular expression: "^E_[A-Z0-9_]+$".
The old array error_table[] of error message strings has been
replaced by a new error_table[] array of struct errtbl. The struct
errtbl array holds calc errnum error codes, the related E_STRING
symbol as a string, and the original related error message.
To add new computation error codes, add them near the bottom of the
error_table[] array, just before the NULL entry.
The ./errcode utility, when run, will verify the consistency of
the error_table[] array.
The Makefile uses ./errcode -e to generate the contents of
help/errorcodes file. The help errorcodes now prints
information from the new cstruct errtbl error_table[] array.
The help/errorcodes.hdr and help/errorcodes.sed files are
now obsolete and have been removed.
The Makefile uses ./errcode -d to generate the contents of the
errsym.h include file.
Code that used the old array error_table[] of error message strings
such as:
#include "calcerr.h"
char *msg; /* calc computation error message */
msg = error_table[errnum - E__BASE];
where errnum is the calc computation error code
E__BASE <= errnum <= E__HIGHEST, may now use:
#include "errtbl.h"
#include "errsym.h"
char *msg; /* calc computation error message */
msg = error_table[errnum - E__BASE].errmsg;
Rename the #define E__COUNT to ECOUNT to avoid confusion
with "E_STRING" error symbols.
Renamed "E_1OVER0" to "E_DIVBYZERO".
Renamed "E_0OVER0" to "E_ZERODIVZERO".
The verify_error_table() function that does a verification
the error_table[] array and setup private_error_alias[] array
is now called by libcalc_call_me_first().
Fix comment about wrong include file in have_sys_mount.h.
Removed unused booltostr() and strtobool() macros from bool.h.
Moved define of math_error(char *, ...) from zmath.h to errtbl.h.
The errtbl.h include file, unless ERRCODE_SRC is defined
also includes attribute.h and errsym.h.
Added E_STRING to error([errnum | "E_STRING"]) builtin function.
Added E_STRING to errno([errnum | "E_STRING"]) builtin function.
Added E_STRING to strerror([errnum | "E_STRING"]) builtin function.
Calling these functions with an E_STRING errsym is the same as calling
them with the matching errnum code.
Standardized on calc computation error related E_STRING strings
where there are a set of related codes. Changed "E_...digits" into
"E_..._digits". For example, E_FPUTC1 became E_FPUTC_1, E_FPUTC2
became E_FPUTC_2, and E_FPUTC3 became E_FPUTC_3. In a few cases
such as E_APPR became E_APPR_1, because there was a E_APPR2 (which
became E_APPR_2) and E_APPR3 (which became E_APPR_3). To other
special cases, E_ILOG10 became E_IBASE10_LOG and E_ILOG2 became
E_IBASE2_LOG because E_ILOG10 and E_ILOG2 are both independent calc
computation error related E_STRING strings. Now related sets of
E_STRING strings end in _ (underscore) followed by digits.
Added errsym builtin function. The errsym(errnum | "E_STRING")
builtin, , when given a valid integer errnum that corresponds to a
calc error condition, will return an E_STRING string, AND when given
a valid E_STRING string that is associated with a calc error
condition, will return errnum integer that corresponds to a calc
error condition.
Supplying a non-integer numeric errnum code to error(), errno(),
strerror(), or errsym() will result in an error.
Added tests to the calc regression test suite (cal/regress.cal) to
verify that the errnum calc computation error codes and their
E_STRING values have not changed.
Improved the clarity of calc regression suite (regress.cal) to mostly
use E_STRING errsym instead of numeric errnum values for error()
and errno() related tests.
Fixed SEE ALSO typo in help randperm.
Fixed calc regression test 42dd to set the display value back to 20.
Added to test 95dd and test9500.trigeq.cal to the calc regression test
suite to perform extensive test of trigonometric functions.
Added to test 34dd, some if the missing inverse trigonometric tests.
Improved builtin function strings, as printed by help builtin,
that use an optional accuracy (epsilon) arg by adding a comma.
The following are the changes from calc version 2.14.3.4 to 2.14.3.5:
Under macOS, to reduce dependency chains, we remove functions
and data that are unreachable by the entry point or exported
symbols. In particular, the macOS linker is used with both
"-dead_strip" and "-dead_strip_dylibs".
The libcalc shared library is now linked with libcustcalc.
The config("triground") controls rounding for the following
trigonometric and hyperbolic functions:
sin, cos, tan, cot, sec, csc
asin, acos, atan, acot, asec, acsc
versin, coversin, vercos, covercos
aversin, acoversin, avercos, acovercos
haversin, hacoversin, havercos, hacovercos
ahaversin, hacoversin, havercos, ahacovercos
exsec, aexsec, excsc, aexcsc
crd, acrd
cas, cis
sinh, cosh, tanh, coth, sech, csch
asinh, acosh, atanh, acoth, asech, acsch
In addition to taking a complex root (such as via the power
function on a complex value), "triground" is used for:
exp, polar
For the above mentioned functions, the rounding mode used to
round the result to the nearest epsilon value is controlled by,
and defaults to:
config("triground", 24)
As with other config options, the call returns the previous mode,
without a 2nd argument, returns the current mode without changing it:
config("triground")
When printing an error, calc used to print the errnum (error number):
; 1/0
Error 10001
Calc now prints the errsym (errsym):
; 1/0
Error E_DIVBYZERO
Added errsym E_LN_3 for ln(0).
Added errsym E_LOG_5 for log(0).
Added errsym E_LOG2_4 for log2(0).
Added errsym E_LOGN_6 for logn(0,base).
Added a chk_tree tool to help look for problems such as files that are
result of building calc that are also part of the calc distribution,
and files that are part of the calc source that are missing from the
calc distribution, and files that are of unknown status that are either
result of building calc nor missing from the calc distribution.
Updated file lists in Makefile, sorting as needed.
Updated Makefile PHONY rule to include Makefile rules that are NOT files.
Reduced make chatter for rules that build lists.
Added make verifydist to verify the existence of files that are part of
the calc distribution.
Added make verifydist to make prep.
Added a chk_tree double check, one after make clobber, one before
the final make chk, to make prep. Added double pass of chk_tree to
make full_debug (and thus to the make debug output).
Improved notes for install locations in Makefile.config.
Added printing of ${BUILD_ALL} to make env output.
The following are the changes from calc version 2.14.3.0 to 2.14.3.4:
Fix typo in the `make debug` Makefile rule.
Improved .gitignore to ignore .static, calc-static,
sample_many-static and sample_rand-static.
Improved error messages when trying to compile with
with one calc type (when BLD_TYPE=calc-dynamic-only or
BLD_TYPE=calc-static-only) and install with the other.
When installing with BLD_TYPE=calc-static-only, the
installed calc and calc-static are links to each other.
Thanks to GitHub user @TurtleWilly for this suggestion.
The dynamic shared libraries are not installed if they are not
built. So when installing with BLD_TYPE=calc-static-only, the
install rule will not attempt to install dynamic shared libraries.
Thanks to GitHub user @TurtleWilly for bringing to our attention,
problems related to building a statically linked calc under macOS.
Updated comments in Makefile.local for how to Diagnosing memory,
thread, and crash issues under RHEL and macOS.
We no longer support the Makefile variable ${ALLOW_CUSTOM} to be empty.
Normally ${ALLOW_CUSTOM} is:
ALLOW_CUSTOM= -DCUSTOM
Now, to disable custom disable custom even if -C is given, use:
ALLOW_CUSTOM="-UCUSTOM"
Dropped support of Makefile.simple and custom/Makefile.simple.
The calc version 2.14.3.0 is the last release that supported
the Makefile.simple and custom/Makefile.simple files.
Now, a make that supports makefile conditional syntax is required.
The simple target, a target that only was used for Makefile.simple
was removed.
Moved makefile variables that configure calc and configure how to
compile calc from Makefile into a new Makefile.config file.
The Makeifle includes the Makefile.config file.
The cal/Makeifle includes the Makefile.config file.
The cscript/Makeifle includes the Makefile.config file.
The custom/Makeifle includes the Makefile.config file.
The help/Makeifle includes the Makefile.config file.
Now, the Makefile.config file will consistently configure
calc and how calc is compiled and built by all calc Makefiles.
The custom/Makefile no longer includes Makefile.
The platform target section from the old Makefile has been moved
to a new file, Makefile.target. Improved the format and comments
in target information.
The Makeifle includes the Makefile.target file.
The cal/Makeifle includes the Makefile.target file.
The cscript/Makeifle includes the Makefile.target file.
The custom/Makeifle includes the Makefile.target file.
The help/Makeifle includes the Makefile.target file.
Now, the Makefile.target file will consistently set
target information for all calc Makefiles.
The cal/Makeifle includes the Makefile.local file.
The cscript/Makeifle includes the Makefile.local file.
The custom/Makeifle includes the Makefile.local file.
The help/Makeifle includes the Makefile.local file.
Thus, one may modify or append many Makefile variables
in all calc Makefiles.
Removed the ${CAL_PASSDOWN}, ${HELP_PASSDOWN}, ${HELP_PASSDOWN},
${CSCRIPT_PASSDOWN} Makefile variables as the new Makefile
include files keep Makefile variables in sync.
Fixed the ability of calc to compile when CUSTOM is undefined
(i.e., -UCUSTOM). The libcustcalc is always built, regardless
of the $(ALLOW_CUSTOM} Makefile variable. However when CUSTOM
is undefined, the bulk of custom functions are not defined.
Dropped the use of Makefile variable ${SET_INSTALL_NAME}.
Under macOS it was always needed, elsewhere it was not.
Added Makefile variable ${VER} to hold the calc major release version.
The calc major release version is a 3 level version (x.y.z).
Under macOS, the current version of both libcalc and libcustcalc
shared libraries are set to the current calc major release version.
Under macOS, to reduce dependency chains, we remove functions and
data that are unreachable by the entry point or exported symbols.
In particular, the macOS linker is used with "-dead_strip" by default.
While calc on macOS will execute if linker used with "-dead_strip_dylibs"
and CUSTOM is defined, other applications that use libcalc but not
libcustcalc (such as sample_many and sample_rand) will fail to execute
due to missile symbols. Therefore "-dead_strip_dylibs" is not used
by default when ALLOW_CUSTOM is "-DCUSTOM" under macOS.
Thanks to GitHub user @TurtleWilly for bringing to our attention,
problems related to use of "-dead_strip_dylibs".
When installing shared libraries, libcalc.x.y.z will be a link
to the libcalc shared library and libcustcalc.x.y.z will be a link
to the libcustcal shared library.
The following are the changes from calc version 2.14.2.1 to 2.14.3.0:
Added cal/fnv_tool.cal, a calc resource file defining:
find_fnv_prime(bits)
deprecated_fnv0(bits,fnv_prime,string)
fnv_offset_basis(bits,fnv_prime)
fnv1a_style_hash(bits,fnv_prime,prev_hash,string)
Fixed sorted order of cal/README.
Removed references to obsolete Email addresses.
macOS Darwin defaults LCC to "cc".
Updated COPYING to include the actual text of "The Unlicense".
Made minor formatting changes to the file.
The Darwin specific ${DARWIN_ARCH}, thay by default was unset,
is now the ${ARCH_CFLAGS} Makefile variable. Comments about
various "-arch name" have been moved to the ${ARCH_CFLAGS} area.
For old Apple Power PC systems, the following is added:
COMMON_CFLAGS+= -std=gnu99
COMMON_LDFLAGS+= -std=gnu99
ARCH_CFLAGS+= -arch ppc
Old Apple Power PC systems should be detected by the
"uname -p" command returning "powerpc". One may force the
Power PC mode by adding to the end of any make command:
make ...make_args... target=Darwin arch=powerpc
or by adding the following in the Makefile.local file:
target= Darwin
arch= powerpc
Improved the output of the calcinfo rule by adding echos
of various uname values as well as some top Makefile variables.
Fixed the BUGS file with respect to using `make debug`.
Added a final ls of `debug.out` for `make debug`.
The following are the changes from calc version 2.14.2.0 to 2.14.2.0:
Ported calc to the s390x IBM Mainframe running RHEL9.1.
Added cal/splitbits.cal:
splitbits(x, b)
Given an integer x, split the value into a list of integers,
each of which is at most b bits long.
The value b must be an integer > 0.
The number of elements in the returned list is:
ceil((highbit(x) + 1) / b)
If x == 0, then a list of 1 element containing 0 is returned.
If x < 0, then the two's compliment of abs(x) is returned.
Even though calc represents negative integers as positive values
with sign bit, the bits returned by this function are as if
the integer converted as if the integer was a two's compliment value.
See also the help command:
; help resource
The following are the changes from calc version 2.14.1.5 to 2.14.1.6:
Fixed version numbers in two cases in CHANGES that referred
to the 2.14.2.x instead of 2.14.1.x.
Rename MINGW Makefile variable (a holdover from MINGW32_NT-5.0)
to OSNAME.
Fixed FUNCPTR typedef in hist.c to fix deprecated compiler warnings.
Fixed when USE_READLINE, READLINE_LIB, READLINE_EXTRAS, and
READLINE_INCLUDE are set to empty (disable use of the GNU-readline
facility).
Fix cases of spaces before tabs in Makefile and Makefile.simple.
Fixed obsolete references to the atoz() in LIBRARY to use the
correct internal function name of str2z().
Fixed obsolete references to the atoq() in LIBRARY to use the
correct internal function name of str2q().
Document in help/unexpected that * operator has has a higher
precedence than << in calc, which differs from C. Thanks
goes to GitHub user @inguin for pointing put this difference.
The following are the changes from calc version 2.14.1.3 to 2.14.1.4:
Fixed missing <string.h include in have_fpos_pos.c.
Change calc version from 2.14.1.2 to 2.14.2.3 as part of a test to
build calc RPMs on a reference RHEL8.7 platform (formerly a RHEL7.9
platform).
Changes #! lines in Makefiles to "#!/usr/bin/env make".
Set SHELL in Makefiles to the basename of the shell.
Updated COPYING file to indicate that these files are now
covered under "The Unlicense" (see https://unlicense.org):
sha1.c
sha1.h
cal/dotest.cal
cal/screen.cal
Updated help/credit to match the above changes to COPYING.
Updated CONTRIB-CODE and calc.man to refer to using GitHub pull requests
for contributing to calc (instead of using Email).
Updated BUGS and calc.man to refer to using GitHub issues
for reporting calc bugs (instead of using Email).
Updated QUESTIONS and calc.man to refer to using GitHub issues
for asking calc questions (instead of using Email).
Fixed Makefile.local command example to refer to overriding the
Makefile variable DEBUG (instead of CDEBUG).
Fixed all make chk ASAN warnings under macOS 13.2.1 when calc is compiled
with the following uncommented lines in Makefile.local:
DEBUG:= -O0 -g
CFLAGS+= -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
LDFLAGS+= -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
CALC_ENV+= ASAN_OPTIONS=detect_stack_use_after_return=1
Improved how pointers to functions are declared for the builtins
array in func.c to avoid function declarations without a prototype
that is now deprecated in C.
Improved how pointers to functions are declared for the opcodes
array in opcodes.c to avoid function declarations without a prototype
Replaced use of egrep with grep -E in Makefiles.
Fixed cases where variables were set but not used in symbol.c, calc.c,
and the main function in func.c as used by funclist.c.
Added rule name to "DO NOT EDIT -- generated by the Makefile" lines
in constructed files.
Test if <sys/vfs.h> exists and set HAVE_SYS_VFS_H accordingly
in have_sys_vfs.h. Added HAVE_SYS_VFS_H to allow one to force
this value.
Test if <sys/param.h> exists and set HAVE_SYS_PARAM_H accordingly
in have_sys_param.h. Added HAVE_SYS_PARAM_H to allow one to force
this value.
Test if <sys/mount.h> exists and set HAVE_SYS_MOUNT_H accordingly
in have_sys_mount.h. Added HAVE_SYS_MOUNT_H to allow one to force
this value.
Test if the system as the statfs() system call and set HAVE_STATFS
accordingly in have_statfs.h. Added HAVE_STATFS to allow one
to force this value.
The pseudo_seed() function will also try to call statfs() if
possible and permitted by the HAVE_STATFS value.
Test if makedepend command is available before trying to build
the Makefile dependency list via "make depend".
The following are the changes from calc version 2.14.1.0 to 2.14.1.2:
Attempted to address a paranoid compiler warning -Wmaybe-uninitialized
in swap_HALF_in_ZVALUE() where the gcc compiler seems to ignore the
fact that calling not_reached() above the call to zcopyval()
should prevent dest from being NULL to the 1st zcopyval() call.
Thanks to <GitHub user mattdm> for raising this potential concern.
Fixed a -Wuse-after-free warning that identified a call to realloc()
in find_tty_state() could move the fd_setup array. Thanks goes to
<GitHub user mattdm> for reporting this bug!
In find_tty_state(), we changed how we expand fd_orig as an original
pre-modified copy of fd_setup. We realloc the fd_orig array and copy
the fd_setup into it first, before touching the fd_setup array.
In pseudo_seed(), we removed a call to setjmp() that was only
there to add more information to mix into the seed. For compilers
such as gcc that used -Wclobbered, the call to setjmp() gave the
impression that the hash_val might be clobbered by a longjmp().
Where there is no longjmp() that would use the previous setjmp(),
the gcc compiler has nil ways to notice that. So to avoid confusion
we removed the setjmp() call. Thanks to <GitHub user mattdm> for
raising this potential concern.
Added config("tilde_space", boolean). The "tilde_space" controls
whether or not a space (' ') is printed after leading tilde ('~').
By default, config("tilde_space") is false.
For example, with the default, config("tilde_space", 0):
; 1/3
~0.33333333333333333333
; sqrt(7 + 5i,1e-100)
~2.79305614578749801863+~0.89507688693280053094i
With config("tilde_space", 1):
; 1/3
~ 0.33333333333333333333
; sqrt(7 + 5i,1e-100)
~ 2.79305614578749801863+~ 0.89507688693280053094i
NOTE: Use of config("tilde_space", 1) can break printing and scanning
of complex values via "%c".
To enable "tilde_space", use config("tilde_space", 1) on the
command line and/or use config("tilde_space", 1),; in your ~/.calcrc.
Thanks goes to <GitHub use ljramalho> for this suggestion.
Added config("tilde_space", boolean) to help/config, along with
a few few minor text improvements. Updated cal/regress to test
config("tilde_space").
For example, with the default, config("tilde_space", 0):
; pi(1e-50)
~3.14159265358979323846
With config("tilde_space", 1):
; pi(1e-50)
~ 3.14159265358979323846
Added config("fraction_space", boolean). The "fraction_space" controls
whether or not a space (' ') is printed before and after fractions.
By default, config("fraction_space") is false.
For example, with the default, config("fraction_space", 0):
; base(1/3),
; 1/7
1/7
With config("fraction_space", 1):
; base(1/3),
; 1/7
1 / 7
NOTE: Use of config("fraction_space", 1) can break printing and scanning
of fractional values via "%r".
NOTE: Use of config("fraction_space", 1) can break printing and scanning
of complex values via "%c".
Added config("fraction_space", boolean) to help/config, along with
a few few minor text improvements. Updated cal/regress to test
config("tilde_space").
Added config("complex_space", boolean). The "complex_space" controls
whether or not a space (' ') is printed before and after the + or -
in complex values.
By default, config("complex_space") is false.
For example, with the default, config("complex_space", 0):
; asin(2)
1.57079632679489661923-1.31695789692481670863i
With config("complex_space", 1):
; asin(2)
1.57079632679489661923 - 1.31695789692481670863i
NOTE: Use of config("complex_space", 1) can break printing and scanning
of fractional values via "%r".
NOTE: Use of config("complex_space", 1) can break printing and scanning
of complex values via "%c".
Added config("complex_space", boolean) to help/config, along with
a few few minor text improvements. Updated cal/regress to test
config("complex_space").
Clarify in the calc man page, the relationship between -q and
calc start scripts such as the ~/.calcrc file.
Fixed in the calc man page, the issue of -f not implying -q.
The following are the changes from calc version 2.14.1.2 to date:
Restored use of the #define FPOS_POS_LEN symbol. This refers to
the length of the __pos element (if the __pos element exists),
the fpos_t type (if that type exists).
Changed SWAP_HALF_IN_FILEPOS(dest, src) mato to use FILEPOS_LEN Little
Endian when FILEPOS is a simple scalar type (i.e., HAVE_FILEPOS_SCALAR
is defined).
Changed #define HAVE_FPOS to HAVE_FGETSETPOS.
Corrected comment in have_fpos_pos.h. The HAVE_FPOS_POS symbol was
NOT related to fgetpos & fsetpos but rather if we we have an __pos
element in FILEPOS.
Changed #define HAVE_NO_FPOS to HAVE_NO_FGETSETPOS.
Improved comments in have_fpos_pos.h to show why and how
HAVE_FPOS_POS, FPOS_POS_BITS, and FPOS_POS_LEN were defined or undefed.
Changed showfiles builtin to print sizes cast to (long int) with
the "%ld" printf format to avoid implementations that do not support
the "%lld" printf format specifier.
Renamed have_fpos.h to have_fgetsetpos.h. Renamed CALC_HAVE_FPOS_H
to CALC_HAVE_FGETSETPOS_H. The make install and the olduninstall
rules remove the any old have_fpos.h that was previously installed.
Added swap_HALFs(dest, src, len) function to byteswap.c.
Calc can now handle Big Engian file position sizes that are a
multiple of BASEB bits in length. Before handle Big Engian file
positions could only be 32 and 64 bits in length. This will allow,
for example, a Big Engian file position size of 128 (assuming that
128/BASEB is is an integer).
Temporary workaround for musl libc systems such as gentoo Linux that
allows them to compile calc and successfully run the regression test.
The following are the changes from calc version 2.14.1.1 to 2.14.1.1:
Added a few remarks on calc version numbers to version.c.
Fixed how fposval.h is built. On a number of systems, the fposval.c
file failed to compile incorrectly. This caused problems for systems in
which fposval.h.def was not correct.
Fixed how have_memmv.h is built. On a number of systems, the have_memmv.c
file failed to compile incorrectly, producing a potentially incorrect
have_memmv.h file for such systems.
Fixed how align32.h is built. On a number of systems, the align32.c
file failed to compile incorrectly, producing a potentially incorrect
align32.h file for such systems.
Fixed how have_newstr.h is built. On a number of systems, the have_newstr.c
failed to compile incorrectly, producing a potentially incorrect
have_newstr.h file for such systems.
Fixed how have_strdup.h is built. On a number of systems, the have_strdup.c
file failed to compile incorrectly, producing a potentially incorrect
have_strdup.h file for such systems.
Fixed how have_strlcat.h is built. On a number of systems, the have_strlcat.c
file failed to compile incorrectly, producing a potentially incorrect
have_strlcat.h file for such systems.
Fixed how have_strlcpy.h is built. On a number of systems, the have_strlcpy.c
file failed to compile incorrectly, producing a potentially incorrect
have_strlcpy.h file for such systems.
Fixed how have_uid_t.h is built. On a number of systems, the have_uid_t.c
file failed to compile incorrectly, producing a potentially incorrect
have_uid_t.h file for such systems.
Fixed how have_uid_t.h is built. On a number of systems, the have_uid_t.c
file failed to compile incorrectly, producing a potentially incorrect
have_uid_t.h file for such systems.
Added full_debug rule to Makefile. This does the work of the
old debug rule in a more verbose mode by using Q= H=@ S= E= V=@.
The debug rule in the Makefile now pre-removes debug.out and then
runs make full_debug sending stdout and stderr to debug.out. It then
prints a few instructions about filing a GitHub issue bug report.
The full_debug rule will no longer stop when one of the sub-tasks
failed (exit non-zero).
The following are the changes from calc version 2.14.1.0 to 2.14.1.0:
Fixed alignment of show item section of help command.
Bug fix: While 0^0 == 1, now for y > 0, 0^y == 0.
Adjusted cal/test8900.cal to reflect this bug fix.
Added tests to cal/regress.cal to help verify bug fix is fixed.
Fixed a \-escape bug in calc(1) man page.
Added cal/comma.cal:
Convert numbers into strings with 3-digit group and integer-fraction
separators.
If the value is an integer, the integer-fraction separator is not used.
str_comma(x, [group, [decimal]])
Convert x into a string.
If group is given and is a string, group will be used as
the 3-digit group separator, otherwise the default 3-digit
group separator will be used.
If decimal is given and is a string, group will be used as
the integer-fraction separator, otherwise the default
integer-fraction separator will be used.
The decimal and group arguments are optional.
set_default_group_separator(group)
Change the default 3-digit group separator if group is a string,
otherwise the default 3-digit group separator will not be
changed. Return the old 3-digit group separator.
set_default_decimal_separator(decimal)
Change the default 3-digit group separator if decimal is a
string, otherwise the default integer-fraction separator
will not be changed. Return the old integer-fraction separator.
print_comma(x, [group, [decimal]])
Print the value produced by str_comma(x, [group, [decimal]])
followed by a newline.
If the str_comma() does not return a string, nothing is printed.
The decimal and group arguments are optional.
The value produced by str_comma() is returned.
fprint_comma(fd, x, [group, [decimal]])
Print the value produced by str_comma(x, [group, [decimal]]),
without a trailing newline, on file fd.
If the str_comma() does not return a string, nothing is printed.
If fd is not an open file, nothing is printed.
The decimal and group arguments are optional.
The value produced by str_comma() is returned.
The following are the changes from calc version 2.14.0.15 to 2.14.0.15:
Changed Makefile to set shell before setting the SHELL Makefile
variable.
Added text to HOWTO.INSTALL to help people with systems that
lack the readline package.
Trimmed long line in the CONTRIBUTING.md file.
Expanded the globalsymbol string table size: from 1024 to 65536.
Expanded the how often to reallocate string table is performed:
from 100 to 1024.
Expanded the number env_pool elements to allocate at a time:
from 10 to 256.
Improve comments on Makefile.local and add a few more examples
of how it might be used.
Changed /*NOTREACHED*/ to not_reached(); and use "attribute.h".
Added .PHONY rule, just after all rule, to Makefiles.
Made minor format update on help/commands.
Added ${WINGM} Makefile variable for users under Windows 11 who
use Cygwin and the MinGW64 packages.
Updated README.WINDOWS for Windows 11 users based on advice
form a Microsoft 11 developer.
Fixed missing quotes in the PASSDOWN makefile variables.
Disable use of gettime() under _WIN32 or _WIN64.
The following are the changes from calc version 2.14.0.14 to 2.14.0.14:
Fixed typo in Makefile.local comment.
Established a tagging procedure for a production release.
Production git tags will be of the form:
prod-2.x.y.z
The following are the changes from calc version 2.14.0.13 to 2.14.0.13:
Made major changes to our release process in order to avoid
missing critical files that happened in calc v2.4.0.12.
Minor tweak to seed() builtin. Updated help/srand and help/srandom.
Moved Makefile.ship into Makefile.
Removed custom/Makefile.head and custom/Makefile.tail.
The custom/Makefile is now part of source and includes Makefile.
In particular, custom/Makefile makes use of the 'middle' of
the new top level Makefile where calc's top level Makefile
variables are defined.
Makefile.simple and custom/Makefile.simple are now part of the source
and are constructed from Makefile and custom/Makefile respectively.
The Makefile.simple and custom/Makefile.simple avoid using GNU
conditionals. They may be used with older/classic make commands.
Makefile.local will include comments about how to better use
it. Between releases, Makefile.local at the top of the master branch
will contain how we typically build calc and test calc (FYI: we
normally enable things such as -Werror -Wextra -pedantic). When we
push out a release, Makefile.local will be stripped of non-comment
lines. Thus, releases of calc, and, released "calc*.src.rpm"
files and the source tarballs, will have a Makefile.local with
only comments.
The "README.*" files and "HOWTO.INSTALL" file have been updated.
By default, compiler warnings have been turned up. The Makefile
variable ${CCWARN} now defaults to:
CCWARN= -Wall -Wextra -pedantic
The previous level of compiler warnings can be easily restored by
adding to Makefile.local:
CCWARN:= -Wall
The readline, history and ncurses libraries are now default.
The Makefile variables ${USE_READLINE}, ${READLINE_LIB}, and
${READLINE_EXTRAS} now default to:
USE_READLINE= -DUSE_READLINE
READLINE_LIB= -lreadline
READLINE_EXTRAS= -lhistory -lncurses
The previous mode where readline, history and ncurses libraries
were not compiled in by default can be easily restored by
adding to Makefile.local:
USE_READLINE:=
READLINE_LIB:=
READLINE_EXTRAS:=
We have renamed "stable" as "production".
We have renamed "unstable" as "tested".
On the web site:
http://www.isthe.com/chongo/src/calc/
these files has been renamed:
2.x.y.z_IS_LATEST_STABLE ==> 2.x.y.z_IS_LATEST_PRODUCTION
2.x.y.z_IS_LATEST_UNSTABLE ==> 2.x.y.z_IS_LATEST_TESTED
The terms 'stable' and 'unstable' were both misleading and
inaccurate. For details see the new documention file:
README.RELEASE
See also the help command:
; help release
Fixed bug impacting how have_ustat.h was formed.
Updated help/archive, BUGS, HOWTO.INSTALL to reflect GitHub use.
The following are the changes from calc version 2.14.0.11 to 2.14.0.12:
Fixed a number of typos.
Drop support for SunOS, IRIX and MINGW32_NT-5.0 targets.
Drop support for CLOCK_SGI_CYCLE. Drop testing for __MSDOS__.
Minor improvement of various help files. Made format of help
files more consistent.
Corrected a few comments in zrandom.c, including a case where
the comment referred to 1007 when it should have used 2^32.
Improved seed() generation. Improved some comments in seed.c.
Added have_environ.c to build have_environ.h in order to
determine if:
extern char **environ; /* user environment */
is an valid external symbol.
Fixed documentation that referred to the old additive 55
generator. We have been using the subtractive 100 in place
of the additive 55 generator for a while now.
Fixed depend rule for custom/Makefile.
Fixed how Makefile variable SHELL is set on macOS vs. Linux.
Using /bin/sh on macOS due to how zsh treats globs by default.
Added charbit.h to define CALC_CHARBIT which is either CHAR_BIT
from <limits.h> or 8 or a value set by the Makefile variable
CALC_CHARBIT. Added have_limits.h to determine if <limits.h>
is a system include file.
Compiling now tests for _WIN64 as well when testing for _WIN32.
Now assuming that <stdio.h> is available under _WIN32 and _WIN64.
Added some preliminary notes about attempts to compile calc
under Windows 11.
BTW: While we are unable to use Windows 11, we welcome
Windows 11 developers to try compiling calc natively
(instead of via a Linux virtual machine). If you are
able to compile Windows 11 natively, we would welcome
GitHub pull requests showing any needed modifications:
https://github.com/lcn2/calc/pulls
Please also add notes to the 'Compiling calc under Windows 11'
section in README.WINDOWS file.
We added Makefile.simple as part of the master branch source
to help those who may be using a make tool that does not support
GNU Make-like features such as "ifeq" and ":=".
Fixed incorrect ustat_dev member ref in seed() builtin that
was part of the unreleased calc v2.12.0.11.
The following are the changes from calc version 2.14.0.9 to 2.14.0.10:
Due to issues with clang and Apple Silicon, ARCH_CFLAGS is now,
by default, empty:
ARCH_CFLAGS=
If you want to use, say, -march=native, then either change
the Makefile or make with:
make all ARCH_CFLAGS='-march=native'
Added arch and hardware as GNU Makefile computed values.
As with ${target}, ${arch} and ${hardware} is computed by uname:
target: uname -a
arch: uname -p
hardware: uname -m
Fixed compiling calc on Apple Silicon with HomeBrew. On Apple
Silicon, HomeBrew installs on into a different location. The
Makefile checks if ${hardware} is arm64 and adjusts the location
of libraries such as readline and history accordingly.
Plugged a number of memory leaks.
Fixed a few cases where v_subtype was not properly initialized.
Improved the way that internal pre-defined constants are managed.
Removed unused internal pre-defined constants. Added code to
prevent an internal pre-defined constant (that was never allocated)
from being freed.
Remove unnecessary spaces in-between or next to tabs.
Update copyright dates to account for 2021 modifications.
The following are the changes from calc version 2.14.0.7 to 2.14.0.8:
Fizzbin is a better word. :-)
The help and man builtin commands now return an error when a
help file cannot be opened, such as when there is no help file.
Added palindrome.cal resource file. For example, to find the
largest (highly probable) prime palindrome under 280 decimal
digits (text tweet limit):
prevprimepal(1e280)
The following are the changes from calc version 2.14.0.0 to 2.14.0.6:
The :-separated default CALCRC value has been reversed.
The default CALCRC was:
${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
The default CALCRC is now:
./.calcinit:~/.calcrc:${CALC_SHAREDIR}/startup
See "help environment" for details.
Added engineering mode as per a GitHub pull request from
<GitHub user heitzmann>. Thank you! For example:
; config("mode","eng"),
; 10^41
100e39
or for example:
; base(1000),
; 2^23209-1
~402.87411577898877818187e6984
For more information see:
help base
Added regression test code for engineering mode. Improved and
expanded regression test code related to the base() and base2()
builtin functions.
Fixed a critical bug in the above mentioned pull request where
a call to base2(1000) would make calc unstable and likely to
dump core.
Added builtin functions to convert between degrees, radians
and gradians:
d2r(deg) - given degrees returns radians
g2r(grad) - given gradians returns radians
r2d(rad) - given radians returns degrees
g2d(grad) - given gradians returns degrees
r2g(rad) - given radians returns gradians
d2g(deg) - given degrees returns gradians
Add 6 functions take a 2nd optional epsilon argument.
For d2r(deg, ep), r2d(rad, ep), the optional 2nd epsilon argument controls
the precision of the internal constant pi/180.
For g2r(grad, ep), r2g(rad, ep), the optional 2nd epsilon argument controls
the precision of the internal constant pi/200.
The optional 2nd argument is ignored by g2d(grad, ep) and d2g(deg, ep).
The clean and clobber makefile rules no longer list custom/Makefile
as a dependency.
Unfortunately due to the complex dependency issues between
Makefile, Makefile.ship and custom/Makefile, parallel GNU make
is NOT recommended. Sorry (tm Canada) :)
The clean and clobber makefile rules no longer list custom/Makefile
as a dependency.
Unfortunately due to the complex dependency issues between
Makefile, Makefile.ship and custom/Makefile, parallel GNU make
is NOT recommended. Sorry (tm Canada) :)
Fixed a few typos in CHANGES.
As a side note: We stayed v2.13.x was kept for only a short time.
The move to 2.14.x was motivated by non-compatible changes due to
the default order of CALCRC, plus some new builtin functions.
More changes are likely, so we might see another v2.14.0.x release
before things are declared "recommended stable".
Not that we want to discourage people from trying v2.14.0, you should
try it. We just want things to become stable and well field tested
before we reach the "recommended stable" release state.
Added builtin functions to convert between degrees and
degrees, minutes and seconds under the config("mod")
round rules:
d2dms(degs, d, m, s [,rnd]) - given degs, compute d, m, s
d2dm(degs, d, m [,rnd]) - given degs, compute d, m
See help/d2dms and help/d2dm.
Example:
; print d2dms(360.321,deg=,min=,sec=), deg, min, sec;
0.321 0 19 15.6
; print d2dm(360.321,deg=,min=), deg, min;
0.321 0 19.26
Added builtin functions to convert between gradians and
gradians, minutes and seconds under the config("mod")
round rules:
g2gms(grads, g, m, s [,rnd]) - given grads, compute g, m, s
g2gm(grads, g, m [,rnd]) - given grads, compute g, m
See help/g2gms and help/g2gm.
Example:
; print g2gms(400.321,grad=,min=,sec=), grad, min, sec;
0.321 0 19 15.6
; print g2gm(400.321,grad=,min=), grad, min;
0.321 0 19.26
Added builtin functions to convert between hours and
hours, minutes and seconds under the config("mod")
round rules:
h2hms(hours, h, m, s [,rnd]) - given hours, compute h, m, s
h2hm(hours, h, m [,rnd]) - given hours, compute h, m
See help/h2hms and help/h2hm.
Example:
; print h2hms(24.321,hour=,min=,sec=), hour, min, sec;
0.321 0 19 15.6
; print h2hm(24.321,hour=,min=), hour, min;
0.321 0 19.26
Renumbered regression tests 3408 thru 3437, to 9102 thru 9131.
Updated Added hms.cal resource file to use h2hms() builtin.
Updated Added dms.cal resource file to use d2dms() builtin.
Fix minor typo in help/mod SYNOPSIS.
Fix minor typo in help/quo SYNOPSIS.
Added a few more examples to help/strcmp.
Added builtin functions to convert between degrees, minutes and
seconds and degrees under the config("mod") round rules:
dms2d(d, m, s [,rnd]) - convert deg, min, and secs to deg
dm2d(d, m [,rnd]) - convert deg, min to deg
See help/dms2d and help/dm2d.
Example:
; print dms2d(12, 20, 44.16);
12.3456
; print dm2d(3601, -25.5594);
0.57401
Added builtin functions to convert between gradians, minutes and
seconds and gradians under the config("mod") round rules:
gms2g(g, m, s [,rnd]) - convert grad, min, and secs to grad
gm2g(g, m [,rnd]) - convert grad and min to grad
See help/g2gms and help/g2gm.
Example:
; print gms2g(12, 20, 44.16);
12.3456
; print gm2g(4001, -25.5594);
0.57401
Added builtin functions to convert between hours, minutes and
seconds and hours under the config("mod") round rules:
hms2h(h, m, s [,rnd]) - convert hours, min, and secs to hours
hm2h(h, m [,rnd]) - convert hours, min to hours
See help/hms2h and help/hm2h.
Example:
; print hms2h(12, 20, 44.16);
12.3456
; print hm2h(241, -25.5594);
0.57401
Fixed typo in cal/statistics.cal thanks to a report by <GitHub user
dennisaldea>.
Fixed an old Windows pun in README.WINDOWS as requested by <GitHub
user marcodegio>.
Fixed a really obscure bug in the internal initconstants()
function of const.c that has been sitting for over 31 years!
We are amazed that nobody has encountered this bug before
now. Nevertheless, our very extensive regression and
multi-architecture testing found the bug. Now, after all
those years, it is fixed.
Fixed issues identified by the default CodeUL GitHub security code scan:
Wrong type of arguments to printf in have_fpos_pos.c
Multiplication result converted to larger type in zfunc.c
The following are the changes from calc version 2.13.0.1 to 2.13.0.1:
Replaced /usr/local with the use of ${PREFIX} in calc Makefiles.
The ${PREFIX} is not the same as ${T}. The ${T} specifies
a top level directory under which calc installs things.
While usually ${T} is empty, it can be specific path
as if calc where "chrooted" during an install.
The ${PREFIX} value, during install, is a path between
the top level ${T} install directory and the object
such as an include file.
Corrected a few more typos in Makefile comments.
Added Makefile.local, a file with a single comment. The main
Makefile includes Makefile.local just before the first all rule.
One may override any Makefile setting by modifying Makefile.local.
For example, Makefile.local could force BLD_TYPE:
HAVE_STRING_H:= YES
HAVE_TIMES_H:= YES
SED:= /usr/local/bin/nsed
Added ${LOC_MKF} to specify the make of the file that is
included just before the all file. So one could place
the above override lines into a different file and call
make changing the ${LOC_MKF} value. For example:
make LOC_MKF=Makefile.private clobber all chk
Updated HOWTO.INSTALL to mention Makefile.local.
The following are the changes from calc version 2.13.0.0 to 2.13.0.0:
Fixed typo (missing quotes) in the env rule.
Fixed indentation problem in CHANGES.
Combined 2.12.9.1 changes into the 2.12.8.2 to 2.12.9.0
range, and thus renamed the range to 2.12.8.2 to 2.12.9.1.
Fixed issues related to building Makefile.simple.
Fixed how the Makefile variable MANPATH is set for macOS.
Added a bunch of information to the near bottom of HOWTO.INSTALL
on calc Makefiles. This information discusses the various
Makefiles found in the calc source.
Added comments in various calc Makefiles about their origin.
In particular, for Makefiles that are constructed such as
Makefile.simple, custom/Makefile and custom/Makefile.simple
there are comments about how they were made.
For all calc Makefiles, including those in sub-directories,
near the top there is now a line of the form:
# SRC: ... some message about the origin ...
Fixed how the calc(1) man page is installed under macOS.
Fixed how calc man page in ${CATDIR} is formed.
Fixed how Makefile.simple is formed.
Fixed the #! calc script argument processing. The initial #!
line must end in a -f. For example, if calc is in /usr/local/bin/calc,
then the following would be the first line of a calc script:
#!/usr/local/bin/calc -f
...
It is common that -q be used with a calc script, so assuming the
same /usr/local/bin/calc path:
#!/usr/local/bin/calc -q -f
...
Use of -s in the #! first line of a calc script is not needed
since -f implies -f.
The argv() will now return values more typical of C's main().
Before it returned one less than the number of arguments. Now,
for example, when calc is given 2 args, argv() will return 3.
The value of argv(0) will be the path to calc, or in the
case of a #! calc cscript, it will return the name of the script.
Updated the calc man page and help/argv to reflect the
above changes.
Improved the formatting of the calc man page.
Fixed the formation of the win32 sub-directory via the win32_hsrc
Makefile rule.
Due to incompatible changes to the argv() function, and #! calc
scripts, we are setting the version to the next minor number:
2.13.0.x
Updated BUGS file as per v2.13.0 fixes.
The following are the changes from calc version 2.12.8.2 to 2.12.9.1:
Added notes to help/unexpected about:
display() will limit the number of digits printed after decimal point
%d will format after the decimal point for non-integer numeric values
%x will format as fractions for non-integer numeric values
fprintf(fd, "%d\n", huge_value) may need fflush(fd) to finish
Fixed Makefile dependencies for the args.h rule.
Fixed Makefile cases where echo with -n is used. On some systems,
/bin/sh does not use -n, so we must call /bin/echo -n instead
via the ${ECHON} Makefile variable.
Add missing standard tools to sub-Makefiles to make them
easier to invoke directly.
Sort lists of standard tool Makefile variables and remove duplicates.
Declare the SHELL at the top of Makefiles.
Fixed the depend rule in the custom Makefile.
Improved the messages produced by the depend in the Makefiles.
Changed the UNUSED define in have_unused.h to be a macro with
a parameter. Changed all use of UNUSED in *.c to be UNUSED(x).
Removed the need for HAVE_UNUSED in building the have_unused.h file.
CCBAN is given to ${CC} in order to control if banned.h is in effect.
The banned.h attempts to ban the use of certain dangerous functions
that, if improperly used, could compromise the computational integrity
if calculations.
In the case of calc, we are motivated in part by the desire for calc
to correctly calculate: even during extremely long calculations.
If UNBAN is NOT defined, then calling certain functions
will result in a call to a non-existent function (link error).
While we do NOT encourage defining UNBAN, there may be
a system / compiler environment where re-defining a
function may lead to a fatal compiler complication.
If that happens, consider compiling as:
make clobber all chk CCBAN=-DUNBAN
as see if this is a work-a-round.
If YOU discover a need for the -DUNBAN work-a-round, PLEASE tell us!
Please send us a bug report. See the file:
BUGS
or the URL:
http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
for how to send us such a bug report.
Added the building of have_ban_pragma.h, which will determine
if "#pragma GCC poison func_name" is supported. If it is not,
or of HAVE_PRAGMA_GCC_POSION=-DHAVE_NO_PRAGMA_GCC_POSION, then
banned.h will have no effect.
Fixed building of the have_getpgid.h file.
Fixed building of the have_getprid.h file.
Fixed building of the have_getsid.h file.
Fixed building of the have_gettime.h file.
Fixed building of the have_strdup.h file.
Fixed building of the have_ustat.h file.
Fixed building of the have_rusage.h file.
Added HAVE_NO_STRLCPY to control if we want to test if
the system has a strlcpy() function. This in turn produces
the have_strlcpy.h file wherein the symbol HAVE_STRLCPY will
be defined, or not depending if the system comes with a
strlcpy() function.
If the system does not have a strlcpy() function, we
compile our own strlcpy() function. See strl.c for details.
Added HAVE_NO_STRLCAT to control if we want to test if
the system has a strlcat() function. This in turn produces
the have_strlcat.h file wherein the symbol HAVE_STRLCAT will
be defined, or not depending if the system comes with a
strlcat() function.
If the system does not have a strlcat() function, we
compile our own strlcat() function. See strl.c for details.
Fixed places were <string.h>, using #ifdef HAVE_STRING_H
for legacy systems that do not have that include file.
Added ${H} Makefile symbol to control the announcement
of forming and having formed hsrc related files. By default
H=@ (announce hsrc file formation) vs. H=@: to silence hsrc
related file formation.
Explicitly turn off quiet mode (set Makefile variable ${Q} to
be empty) when building rpms.
Improved and fixed the hsrc build process.
Forming rpms is performed in verbose mode to assist debugging
to the rpm build process.
Compile custom code, if needed, after main code is compiled.
Fixed a typo typo in help/Makefile that caused the build of
2.12.9.0 to fail in a number of cases. Thanks to a report by
<GitHub user balducci>.
Pass form Makefile variables ${Q}, ${S}, ${E}, ${H} and ${V} down
to all sub-directory Makefiles from the top level Makefile.
The following are the changes from calc version 2.12.8.1 to 2.12.8.2:
Fixed how the *.tar.bz2 are formed. The calc-2.12.8.0.tar.bz2 file
that was formed for calc version 2.12.8.0 was missing most files.
Expanded 'make chk' to also verify that 'make distchk' and 'make
distlist' execute successfully. This will help check a regression
of the bug that produced the bogus calc-2.12.8.0.tar.bz2 file.
Added additional regression tests related 0^(zero_expression)==1.
Calc can now correctly compile without CUSTOM being defined,
thanks to a report by <GitHub user barsnick>.
The following are the changes from calc version 2.12.7.5 to 2.12.8.0:
Fixed a mistake in "help intro" where some inserted text changed
the value of "." and thus made the next result incorrect.
Clarified in "help factor" that 1 is returned if no
factor below the limit was found.
Removed Makefile variable ${MAKEFILE_REV}.
The missing cscript/square.calc file has been restored.
Fixed compiler errors and warnings related to GCC. In particular,
gcc/9.3.1 and gcc/10.2.1 now compile calc without any compiler
errors or warnings, even with -Werror -Wextra -pedantic.
To print out information about the calc compilation
environment, we added the following make rule:
make calcinfo
Improved how 'make debug' operates.
Moved help/contrib to CONTRIB-CODE. The help/contrib file
is now build from a copy of CONTRIB-CODE.
Created a new calc bug report Email address. Created a new
calc question Email address. Created a new calc contribution
Email address. See the BUGS file for details.
Added "help questions" to print the QUESTIONS help file.
If the environment variable $CALCHELP is defined and is non-empty,
then calc help files will be in the directory by the $CALCHISTFILE
environment variable.
If the environment variable $CALCCUSTOMHELP is defined and is
non-empty, then custom calc help files will be in the directory
by the $CALCCUSTOMHELP environment variable.
Fixed a number of typos in text and in source code comments.
The calc-tester mailing list has been retired. See:
* How to submit a calc bug report:
http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
* How to contribute code to calc:
http://www.isthe.com/chongo/tech/comp/calc/calc-contrib.html
* How to submit a question about calc:
http://www.isthe.com/chongo/tech/comp/calc/calc-question.html
The following are the changes from calc version 2.12.7.1 to 2.12.7.5:
Corrected CHANGES notes that were mixed up for TAB, VT, CR &
NL. The code in 2.12.7.0 is correct. The CHANGE notes should
have read:
The following is a partial list of escape sequences recognized
in strings and in printf formats:
\a audible bell byte 0x07 in ASCII encoding
\b backspace byte 0x08 in ASCII encoding
\f form feed byte 0x0c in ASCII encoding
\n newline byte 0x0a in ASCII encoding
\r return byte 0x0d in ASCII encoding
\t tab byte 0x09 in ASCII encoding
\v vertical tab byte 0x0b in ASCII encoding
Fixed a segfault when getpwuid() returned NULL during initialization.
Thanks goes to baratharon GitHub user for reporting this issue.
Requiring calc shell scripts to use -s -f at the end of the
initial #! line.
Fixed /tmp/mersenne example in calc(1) man page.
Added make variable ${ARCH_CFLAGS}. The ${ARCH_CFLAGS} is
added after ${CCMISC} and before ${EXTRA_CFLAGS} when building
the ${CFLAGS} for compiling C code. are ${CC} when compiling
C files. The default value is:
ARCH_CFLAGS= -march=native
which directs C compiler to compile for the native machine.
To disable use of '-march=native', set ARCH_CFLAGS to the empty
string as in:
make all ARCH_CFLAGS=
To make calc RPMs more portable, they are compiled with an
empty ARCH_CFLAGS.
Fixed issues relating to compiling on macOS. Fixed issues
where <unistd.h> is needed.
Fixed typos in help/intro and README.md. <<GitHub guilhermgonzaga>>
Copied missing description lines from help/intro to README.md
"What is calc?" section. <<GitHub guilhermgonzaga>>
GCC 7 added a warning on fall through in case statements. It's
enabled by -Wextra and treated as an error due to -Wall so it
breaks compilation. See -Wimplicit-fallthrough in the GCC
manual. The default value is 3, which means a comment matching
some specific regexes is enough to disable the warning.
Fixed spaces vs tabs and use FALLTHRU as it's used elsewhere.
Fixed one FALLTHRU comment that was inconsistent with others.
<<GitHub jcul>>
Fixed minor typo on help/power. <<GitHub thegithubr>>
By default, the calc history file is located in ~/.calc_history.
Now, if the environment variable $CALCHISTFILE is defined
and is non-empty, then calc history file will be defined
by the $CALCHISTFILE environment variable.
Calc as defined 0^0 as 1. However in the past, 0 raised to
an expression that evaluated to zero returned 1. The result
was that 0^0 was different than 0^(6-6) or even 0^(0).
Now, calc will return 1 for 0^(0) and 0^zero when zero == 0.
The missing cscript/square.calc file has been restored.
The following are the changes from calc version 2.12.6.10: to 2.12.7.0:
Added a patch to replaces the manual search for include files
in $(INCDIR) in the have_*.h targets with compiler invocations.
Thanks goes to Helmut Grohne (helmut at subdivi dot de) who
implemented the patch and posted it to the Debian bug tracker
and Martin Buck (m at rtin-buck dor de) for forwarding it to us.
The check_include make rule was fixed to not assume /usr/include.
The qprintnum() function now takes outdigits as a 3rd argument.
Most of the time, this 3rd argument is just conf->outdigits.
But when it comes to the experimental '%g', this value can
change. This avoids having to modify conf->outdigits.
Fixed a problem where gcc complains about E_FUNC not being defined
for Linux systems as reported by Martin Buck (m at rtin-buck dor de).
Updated the help files help/config, help/display, help/epsilon,
help/fprint, help/printf, and help/strprintf to give more
examples of how display digits and epsilon precision interact
with displaying values.
Added more information about %g in the help file help/printf.
The '\a' is now recognized in a printf format string as the
single byte audible bell character (byte 0x07 in ASCII encoding).
The following is a partial list of escape sequences recognized
in strings and in printf formats:
\a audible bell byte 0x07 in ASCII encoding
\b backspace byte 0x08 in ASCII encoding
\f form feed byte 0x0c in ASCII encoding
\n newline byte 0x0a in ASCII encoding
\r return byte 0x0d in ASCII encoding
\t tab byte 0x09 in ASCII encoding
\v vertical tab byte 0x0b in ASCII encoding
The following are the changes from calc version 2.12.6.9 to 2.12.6.9:
Fixed a number of core dump bugs related to the calculation of
tan(), cot(), sec(), csc(), tanh(), coth(), sech(), and csch(),
asin(), acos(), asinh(), acosh(), where when a call to an
underlying function produced an invalid value. Thanks goes to
github user wuxiuheng for reporting this problem.
A number of trigonometric and hyperbolic functions that incorrectly
returned E_LOGINF, now return a new error code that is more
specific to the trigonometric or hyperbolic function. The
following is a list of these new error codes: E_TAN3 E_TAN4
E_COT3 E_COT4 E_SEC3 E_CSC3 E_TANH3 E_TANH4 E_COTH3 E_COTH4
E_SECH3 E_CSCH3 E_ASIN3 E_ACOS3 E_ASINH3 E_ACOSH3 E_ATAN3 E_ACOT3
E_ASEC3 E_ACSC3 E_ATANH3 E_ACOTH3 E_ASECH3 E_ACSCH3.
Added regression tests 3729 thru 3732 to test E_TAN3, E_COT3,
E_SEC3 and E_CSC3 respectively.
Added experimental %g printf (and strprintf) format implementation
based on pull request from github user 10110111.
Made experimental changes to macOS builds to not require use of
/usr/include. The INCDIR for macOS uses:
INCDIR= $(shell xcrun --show-sdk-path --sdk macosx)/usr/include
to determine the upper path of the /usr/include directory for macOS.
In some rare cases, the Darwin target seems to not automatically detected.
If you are running under macOS, and that happens, you can force
the target to be Darwin:
# for macOS users only, force the target to be darwin
#
make target=Darwin clobber
make target=Darwin all
make target=Darwin chk
make target=Darwin install
The following are the changes from calc version 2.12.6.6 to 2.12.6.8:
For historical purposes, in lucas.cal, gen_v1(1, n) always returns 4.
Fixed some compiler warnings, thanks to a report by Mike
<michael dot d dot ince at gmail dot com>.
Added work around for a gcc warning bug, thanks to a report by Mike
<michael dot d dot ince at gmail dot com>.
Fixed errors in various help files such as:
mat randbit seed srandom types
Removed the MAXSTRING symbol because it was no longer used by calc.
Increased HIST_SIZE (depth of the history stack) from 10k to 32k.
Increased TTYSIZE (reallocation size for terminal buffers) from 100 to 8191.
Increased MAXDEPTH (maximum depth of input stack) from 10 to 255.
Increased interactive input buffer size from 1024 to 256k. This has the
effect of increasing the maximum length of an input line from a tty.
This helps with an interactive bug that was reported by Ruslan Kabatsayev
(b7 dot 10110111 at gmail dot com).
The calc man page indicates that -d also disables the printing of the
leading tilde.
Added information to "help command" about how to silence messages
while reading calc resource files.
Fixed an error message buffer overflow thanks to a report by
Frank Peters <nlp at northernlightsphoto dot biz>.
Replaced all use of the C function sprintf() with snprintf().
Replaced all use of the C funcion vsprintf() with vsnprintf().
Replaced all DONT_HAVE_VSPRINTF with DONT_HAVE_VSNPRINTF.
Replaced all Makefile var ${HAVE_VSPRINTF} with ${HAVE_VSNPRINTF}.
The following are the changes from calc version 2.12.6.4 to 2.12.6.5:
Fixed warning about undefined operations involving the qlink(q)
macro by replacing that macro with an inline-function. Thanks goes
to David Haller <dnh at opensuse dot org> for this fix.
NOTE for Windows 10 users: Pavel Nemec <pane at seznam dot cz>
reported that calc version 2.12.6.4 has been successfully
compiled, installed and running on Windows 10. See README.WINDOWS
for more details.
The following are the changes from calc version 2.12.6.1 to 2.12.6.3:
Improved gen_v1(h,n) in lucas.cal to use an even faster search method.
Improved are checking in lucas.cal. In particular both h and n must be
integers >= 1. In the case of both rodseth_xhn(x, h, n) and gen_v1(h, n)
h must be odd.
Fixed an C code indenting issue that was reported by Thomas Walter
<th dot walter42 at gmx dot de> in zfunc.c.
Fixed a man page warning about ./myfile where the leading dot
was mistook for an nroff macro. Thanks goes to David Haller
<dnh at opensuse dot org> for providing the patch.
Improved gen_v1(h,n) in lucas.cal for cases where h is not a
multiple of 3. Optimized the search for v(1) when h is a
multiple of 3.
Fixed a Makefile problem, reported by Doug Hays <doughays6 at gmail
dot com>, where if a macOS user set BINDIR, LIBDIR, CALC_SHAREDIR
or INCDIR in the top section, their values will be overwritten by
the Darwin specific section.
The following are the changes from calc version 2.12.6.0 to 2.12.6.0:
Added the makefile variable ${COMMON_ADD} that will add flags
to all compile and link commands. The ${COMMON_ADD} flags are
appended to both ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}. This
facility is available to nearly all platforms except those with
very old make commands that do not understand the += operator.
Example on macOS (Darwin), one may invoke clang's -fsanitize
facility by:
make clobber all \
COMMON_ADD='-fsanitize=undefined -fsanitize=address'
Another example. To force C warnings to be treated as errors:
make COMMON_ADD='-Werror'
Created a GitHub repository for calc:
https://github.com/lcn2/calc
NOTE: The calc GitHub repository represents the an active
development stream. While an effort will be made to keep
the master branch of the calc GitHub repository in working
order, that tree may be unstable. Those wishing for more
reliable releases use releases found at calc mirror sites:
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
IMPORTANT NOTE:
On 2017 June 05, the calc GitHub history was re-written.
Anyone who was tracking the calc "pre-release" on GitHub prior
to version 2.12.6.0 should do a:
git reset --hard origin/master
git cleanup -f
Or you may just want to start over:
rm -rf calc
git clone https://github.com/lcn2/calc.git
Sorry about that. The previous GitHub repository was an useful
experiment. Based on what we learned, we decided to rebuild it.
Renamed README to README.FIRST. Added README.md for the
GitHub repository.
Fixed reading from standard input (stdin) when -p is given on
the command line. This now prints hello:
echo hello | calc -p 'stdin = files(0); print fgetline(stdin);'
Added more debugging related to stdin when bit 4 of calc_debug
is set (e.g., running calc with -D16).
Updated the calc(1) man page and 'help file' to explain about
reading from standard input (stdin).
Added some clarifying remarks for 'help ptest' explaining that
the ptest builtin can return 1 is some cases where the test
value is a pseudoprime.
Removed duplicate copyright comments from the help/builtin that
is built.
Fixed a number of typos in the CHANGES file.
The following are the changes from calc version 2.12.5.4 to 2.12.5.6:
Recompile to match current RHEL7.2 libc and friends.
Added fix by Alexandre Fedotov <fedotov at mail dot desy dot de>
to prepend ${T} in front of the CALCPATH path components
${CALC_SHAREDIR} and ${CUSTOMDIR}. Add ${T} in front of ${HELPDIR}
and ${CUSTONHELPDIR} when making conf.h.
Improved the jacobi help page.
Rewrote gen_v1() in the lucas.cal resource file using the method
based on a paper:
"A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
Department of Mathematics, University of Bergen, BIT Numerical
Mathematics. 34 (3): pp 451-454.
http://folk.uib.no/nmaoy/papers/luc.pdf
The improved gen_v1() function is capable of returning a value
for all valid values of h and n. As a result, the trial tables
used by gen_v1() have been changed to a short list of values
to try, in order ot likelihood of success, before doing an
exhaustive search for a v1 value to return.
Removed lucas_tbl.cal calc resource file. This file was made
obsolete by the above rewrite of the lucas.cal resource file.
This file will be removed from the local cal directory and
from CALC_SHAREDIR during a 'make install', 'make clobber',
and 'make uninstall'.
Renamed gen_u0() to gen_u2() in lucas.cal. Provided a gen_u0()
stub function that calls gen_u2() for backward compatibility.
The old gen_v1() method used by the Amdahl 6 group has been
renamed legacy_gen_v1() in lucas.cal. This function is no
longer used by the lucas(h, n) function to test the primality of
h*2^n-1. It is preserved in lucas.cal for historical purposes.
The 'make clobber' rule will attempt to remove all files that
start with libcalc and start with libcustcalc.
The 'man' command is now an alias for the 'help' command.
Fixed extra /'s that were put into CALCPATH because of ${T}.
Fixed extra /'s that were compiled into HELPDIR and CUSTOMHELPDIR.
The fix in 2.12.5.4 to to prepend ${T} in front of the CALCPATH
path components ${CALC_SHAREDIR} and ${CUSTOMDIR} broke the
calc rpm build process. The check-buildroot tool discovered
that the BUILDROOT directory had been improperly put into various
paths and binaries. This has been fixed in 2.12.5.5.
Fixed a crash that showed up on macOS (Darwin) that was reported
by Richard Outerbridge <outer at interlog dot com> and
fixed by Stuart Henderson <stu at spacehopper dot org>.
Thanks goes to both!
The following are the changes from calc version 2.12.5.3 to 2.12.5.3:
Calc version 2.12.5.2 for macOS (Darwin) users, code to installed
calc under /opt/calc. Moreover the CHANGES file did not mention
/opt/calc. Sorry about that!.
A much better tree for macOS (Darwin) users would have been
to install cal under /opt/calc. This release ONLY changes the
macOS (Darwin) install tree to /usr/local.
macOS (Darwin) users who installed calc version 2.12.5.2
should, after installing version 2.12.5.3:
rm -rf /opt/calc
The following are the changes from calc version 2.12.5.1 to 2.12.5.2:
NOTE: calc version 2.12.5.2, for macOS (Darwin) users,
installed under /opt/calc. We neglected to mention this
AND /usr/local would have been a better choice. Sorry!
Fixed in calc version 2.12.5.3.
Removed rules and makefile variables associated with shortened
calc version numbers of less than 4 levels.
Under OS X (Darwin), if /usr/include is missing, warnings
are issued to help the user use xcode-select --install
so that one may properly compile C code.
Lowered REDC levels:
#define MAXREDC 256 /* number of entries in REDC cache */
#define SQ_ALG2 28 /* size for alternative squaring */
config("sq2") == 28 /* was 3388 */
#define MUL_ALG2 28 /* size for alternative multiply */
config("mul2") == 28 /* was 1780 */
#define POW_ALG2 20 /* size for using REDC for powers */
config("pow2") == 20 /* was 176 */
#define REDC_ALG2 25 /* size for using alternative REDC */
config("redc2") == 25 /* was 220 */
The alg_config.cal script appears to be not correctly finding the
best REDC values. While it has been improved, alg_config.cal still
seems to be suspect on how it attempts to find the best values.
Fixed an intro help file mistake found by Roger Hardiman
<roger at rjh dot org dot uk>.
The following are the changes from calc version 2.12.5.0 to 2.12.5.1:
There is a new calc bug report Email address:
NOTE: calc-bug-report Email address no longer in use
This replaces the old calc-bugs Email address.
To be sure we see your Email reporting a calc bug, please use the
following phase in your Email Subject line:
calc bug report
That phrase in your subject line will help ensure your
request will get past our anti-spam filters. You may have
additional words in your subject line.
However, you may find it more helpful to simply subscribe
to the calc-tester mailing list (see above) and then to
send your report to that mailing list as a wider set calc
testers may be able to help you.
The following makefile rules that were related to printing the
upper values of the calc version, rules that were made obsolete
in calc version 2.12.4.14, have been removed:
calc_vers calc_ver calc_ve
vers ver ve
Noted that the hash() builtin function, internally known as
quickhash (used for internal objects such as the associative
arrays as well as other internal processes) uses the deprecated
32-bit FNV-0 hash. The use of this deprecated hash is sufficient
for calc internal purposes. Use of FNV-1a is recommended for
a general non-cryptographic quick hash.
The following are the changes from calc version 2.12.4.14 to 2.12.5.0:
For Apple OS X / Darwin target:
MACOSX_DEPLOYMENT_TARGET is no longer defined
using clang compiler
By default, -install-name is used when forming shared libs.
To force -install-name to not be used, set SET_INSTALL_NAME=no.
The have_stdvs.c test uses <stdlib.h> and fixed va_start() test call
that didn't use last arg.
Fixed math_fmt (printf) in value.c where a LEN (SB32) be printed as %d.
Fixed a significant bug where that resulted in an incorrect
complex number comparison. Thanks goes to David Binderman
<dcb314 at hotmail dot com> for identifying the subtle typo!
Make minor fixes to the make depend rule.
Fixed places were calc defined a reserved identifier that
begin with either __ or _[A-Z]. For example, __FILE_H__ has
been replaced with INCLUDE_FILE_H.
Fixed the addall3 example in the script help file. Thanks for this
fix goes to Igor Furlan <igor dot furlan at gmail dot com>.
We made important fixes to the calc command line history:
Fixed a bug in the command line history where calc would sometimes
crash. There was code that used memcpy() instead of memmove()
that could corrupt the command line history when entering a
into into history that was similar to a previous entry. Thanks
goes to Einar Lielmanis <einars at spicausis dot lv> for first
identifying this mistake.
The calc command line history code, in general was not robust.
We made use a patch from Mathias Buhr <napcode at users dot sf
dot net>, that while it uses a bit more memory: is much more
flexible, readable and robust. This patch replaced the improper
use of memcpy() (see above) with better code. Thanks!
The alg_config.cal calc resource file has been reworked to produce
better diagnostics while attempting to determine the ideal values
for mul2, sq2, and pow2. However, it has been shown that this
code is not correct. Suggestions for a replacement are welcome!
calc -u 'read alg_config; config("user_debug", 2),; best_mul2();'
calc -u 'read alg_config; config("user_debug", 2),; best_sq2();'
calc -u 'read alg_config; config("user_debug", 2),; best_pow2();'
Fixed a number of pedantic compiler warnings.
Removed -W and -Wno-comment from the the CCWARN makefile variable.
Removed no_implicit.arg makefile rule. Removed HAVE_NO_IMPLICIT
makefile variable. Removed no_implicit.c source file.
Added WNO_IMPLICT makefile variable to hold the compiler flag
-Wno-implicit for use on selective compile lines.
Added WNO_ERROR_LONG_LONG makefile variable to hold the compiler flag
-Wno-error=long-long for use on selective compile lines.
Added WNO_LONG_LONG makefile variable to hold the compiler flag
-Wno-long-long for use on selective compile lines.
The makefile variable ${MKDIR_ARG} has been replaced with just -p.
Minor fixes were made to the calc.spec.in file.
The target rpm architecture changed from i686 to x86_64. For those
who do not run machine with x86_64, we continue to release a src
rpm. For those without the ability to process an rpm, we will always
to release src tarball.
When building the libcalc and libcustcalc shared libraries,
ONLY the .so and .so.${VERSION} files are created. The .so is
a symlink to the .so.${VERSION} file. Here ${VERSION} is the
full "w.x.y.z" calc version.
The following are the changes from calc version 2.12.4.11 to 2.12.4.13:
Fixed many typos in comments of the Makefile thanks to the review
work of Michael Somos.
Fixed typo in "help sysinfo".
The Makefile rule, debug, is now more verbose and prints more information
about the calc compiled constants.
Added a more of calc resource files by
Christoph Zurnieden <czurnieden at gmx dot de> including:
infinities.cal - handle infinities symbolically, a little helper file
intnum.cal - implementation of tanh sinh and Gauss-Legendre quadrature
smallfactors.cal - find the factors of a number < 2^32
strings.cal - implementation of isascii() and isblank()
Reformatted some calc resource files. Cleanup in comment the headers
of some calc resource files.
Minor formatting changes to a few help files.
No need to be special picky about the test8900.cal calc resource file.
Added a number of ctype-like builtins:
isalnum - whether character is alpha-numeric
isalpha - whether character is alphabetic
iscntrl - whether character is a control character
isdigit - whether character is a digit character
isgraph - whether character is a graphical character
islower - whether character is lower case
isprint - whether character is a printable
ispunct - whether character is a punctuation
isspace - whether character is a space character
isupper - whether character is upper case
isxdigit - whether character a hexadecimal digit
strcasecmp - compare two strings, case independent
strncasecmp - compare two strings up to n characters, case independent
strtolower - transform an ASCII string to lower case
strtoupper - transform an ASCII string to upper case
For details on these new builtins, see their help messages.
Thanks goes to Inge Zurnieden <inge dot zurnieden at gmx dot de> for
these new builtins.
Calc source code is now picky v2.3 clean using:
picky -s -v file file2 ..
With the exception of:
help/errorcodes.sed
cal/set8700.line
Due to the long lines in those files, we use:
picky -w -s -v help/errorcodes.sed cal/set8700.line
For more information about the picky tool, see:
http://cis.csuohio.edu/~somos/picky.html
Removed functions from strings.cal that have been replaced by
the new ctype-like builtin functions.
Fixed cal/Makefile to include missing intnum.cal file.
Added detail_help_list make target to cal/Makefile.
The detaillist make target in help/Makefile is now
called detail_help_list.
Removed requirement of gen_u0(h, n, v1) in lucas.cal that h
be odd. While still lucas(h, n) converts even h into an odd h
internally by incrementing n, gen_u0(h, n, v1) will output even
when h is even.
The following are the changes from calc version 2.12.4.6 to version 2.12.4.10:
Updated RPM build process to remove use of deprecated flags.
Applied a number of fixes to calc.spec and rpm.mk file.
See calc.spec.in for details. Changed rpm release to 2.1.
Set MACOSX_DEPLOYMENT_TARGET=10.8 as we upgraded all of
our development Mac OS X to 10.8.
Libraries are chmod-ed as 0644 to allow for building rpms
without root.
Silenced annoying warning about unused variable 'intp'
while compiling endian.c under some circumstances.
Fixed typo in re-declaration warnings. Thanks to
Christoph Zurnieden <czurnieden at gmx dot de> for this report.
Added a number of calc resource files by
Christoph Zurnieden <czurnieden at gmx dot de> including:
bernpoly.cal - Computes the nth Bernoulli polynomial at z for any n,z
brentsolve.cal - root-finder implemented with the Brent-Dekker trick
factorial.cal - product of the positive integers
factorial2.cal - variety of integer functions quasi-related to factorial
lambertw.cal - Computes Lambert's W-function at "z" at branch "branch"
lnseries.cal - Calculates a series of natural logarithms at 1,2,3,4...n
specialfunctions.cal - Calculates the value of the beta function
statistics.cal - a wide variety of statistical functions
toomcook.cal - Multiply by way of the Toom-Cook algorithm
zeta2.cal - Calculate the value of the Hurwitz Zeta function
Fixed a makefile bug that prevented the those new calc resource
files from being installed.
Improved the formatting of the output from:
help resource
We replaced COPYING-LGPL with the version that is found at
http://www.gnu.org/licenses/lgpl-2.1.txt because that version
contains some whitespace formatting cleanup. Otherwise the
license is the same.
We fixed a number of places where "the the" was used
when just "the" should be used.
NOTE: Fixes to grammar, spelling and minor formatting
problems are welcome. Please send us your patches!
With the exception of 3 source files, we became "picky" about
line lengths and other issues reported by the picky tool:
cal/test8900.cal
cal/set8700.line
help/errorcodes.sed
The above 3 files now pass picky -w (OK except for line length).
For more information about the picky tool, see:
http://cis.csuohio.edu/~somos/picky.html
The following are the changes from calc version 2.12.4.3 to 2.12.4.5:
Added gvec.cal resource script.
Added calc-symlink make rule to setup symlinks from standard locations
into a tree specified by a non-empty ${T} makefile variable. Added
calc-unsymlink to remove any symlinks that may have been created by
the calc-symlink rule.
If is OK for the calc-symlink make rule to pre-remove a symlink.
Fixed bug was uncovered in calc that caused script failures when calc
is called within a while loop in BASH if the while loop is fed from
stdin due to calc's redirection/inheritance of stdin and no option
to change this behavior. Thanks gores to David C. Rankin
<drankinatty at gmail dot com> for the bug fix and to David Haller
<dnh at opensuse dot org> for helping debug this problem.
The following are the changes from calc version 2.12.4.0 to 2.12.4.2:
Fixed a documentation bug for the sgn() builtin.
Added the 1<<8/2 evaluation example to "help unexpected". That
expression evaluates to 128, not 16 as some C programmers might expect.
Fixed a bug in solve.cal where high was not returned in some situations.
Fixed a bug reported by Paul & Karen Tomlinson (paulnkaz at pktomlinson
dot fsnet dot co dot uk) where calling log multiple times with different
values of epsilon resulted in an incorrect value.
Removed cvd rule from Makefiles.
The Makefile used in the source rpm (calc-*.src.rpm) no longer uses
the -Werror compile flag. This is to help those distributions with
compilers that make produce (hopefully) compilation warnings.
NOTE: For testing and calc build purposes will recommend and will
continue to use the -Werror flag.
Fixed a typo in the Makefile where the make variable ${SAMPLE_OBJ}
was misspelled as ${SAMPLE_OBJS}.
Added prep makefile rule to make is easier to compile calc without
an optimizer. By doing:
make clobber prep
one may build a calc binary that is easier to debug.
Fixed a bug where an certain typos (e.g., calling an unknown
function) would previously cause calc to exit.
Updated the COPYING file to reflect the new filenames associated
with the SHA1 hash function, and removed mention of files related
to the SHA (SHA0, not SHA1) and the MD5 hash functions (which is
no longer supported in calc).
Fixed a bug where a calling vsnprintf() twice created problems.
The thanks for this fix goes to Matthew Miller (mattdm at mattdm
dot org) for this patch.
Michael Penk (mpenk at wuska dot com) reported success in installs
under Windows via Cygwin by making a change to the Cygwin target.
These changes have been folded into the main calc Makefile.
The old recommendation of using 'make win32_hsrc' is no longer
required for Cygwin. See the README.WINDOWS file for details.
Added dms.cal and hms.cal resource files. The dms.cal is a more
functional version of deg.cal. It is a superset except that increment
and decrement is on the arc second level. The hms.cal is for
24-hour cycle instead of the 360 degree cycle of dms.cal.
Changed deg.cal object name from dms to deg so that the more functional
dms.cal can own the dms object name.
Updated 'help obj' to reflect changes to 'show objfunctions' and
resource file example list since 1999.
Fixed problem where CALC_BYTE_ORDER referring to CALC_BIG_ENDIAN
and CALC_LITTLE_ENDIAN instead of BIG_ENDIAN and LITTLE_ENDIAN.
The following are the changes from calc version 2.12.3.0 to 2.12.3.3:
Fixed the Jacobi function where it returned 1 when it should have
returned 0. Thanks goes to Kevin Sopp (baraclese at googlemail dot com)
for discovering the problem and suggesting the nature if the fix.
Calc versions will always be of the form x.y.z.w even when the
MINOR_PATCH (w) is 0. Thus, 2.12.3.0 will be printed as 2.12.3.0
instead of just 2.12.3.
Added MINGW32_NT-5.0 compile target based on a patch from
Brian L. Angus (angus at eng dot utah dot edu).
Removed the use of rpm.release in the Makefile.
Mac OS Darwin targets no longer attempt to use ldconfig. Under the
Darwin target, the LDCONFIG make variable is redefined to be
an empty value. Thanks goes to Ralf Trinler (art at infra dot de)
for reporting this problem.
The ${CALC_INCDIR}/custom is no longer being removed at install time
if it is empty. Now when ${ALLOW_CUSTOM} make variable is empty,
an empty ${CALC_INCDIR}/custom may be left behind.
Fixed a problem where a "make clobber" would remove custom/Makefile
and fail to rebuilt it.
The following are the changes from calc version 2.12.2.3 to 2.12.2.4:
Added OpenBSD target.
Using the -r test instead of the -e test in Makefiles because some
out of date shells still do not have the -e test.
The Makefile now avoids the use of if ! command because some out of
date shells to not support the ! construct.
The following are the changes from calc version 2.12.1.1 to 2.12.2.2:
Added an explicit Solaris target.
Fixed confusion in Makefile where some uses of ${EXT} were misnamed ${EXE}.
Added a "make strip" rule, per suggestion from Igor Furlan <primorec
at sbcglobal dot net>, to allow one to strip previously built binary
executables and libraries.
Under the Darwin / OS X target, ${DARWIN_ARCH} is left empty meaning
that calc is compiled for the native CPU type instead of Universal
Binary (Intel and PPC).
By default, the calc binary that is built for the rpm forces
${LD_SHARE} to be empty. An empty ${LD_SHARE} means that the calc
from the rpm does not set rpath. This in turn causes the default
system path to be searched when looking for libcalc and libcustcalc.
The Makefile shipped with calc still sets ${LD_SHARE} for host targets.
By default, the dynamic shared library search path for all targets
starts with the source directory. Starting the search in the source
directory is convenient for testing and debugging but is not appropriate
for installation on a production system. To get the same effect
as the calc binary in the calc rpm, try:
make clobber
make calc-dynamic-only BLD_TYPE=calc-dynamic-only LD_SHARE=
make install
The libcalc and libcustcalc shared libraries are now tied to
the 4 level calc version instead of just 3 levels. For example,
under Linux calc version 2.12.2.1 uses /usr/lib/libcalc.so.2.12.2.1
instead of just the /usr/lib/libcalc.so.2.12.2 file. This change
was made so that calc produced by 'make clobber; make all install'
is consistent with the calc rpm.
Calc is now releasing the calc-debuginfo rpm for those RPM users who
which to use non-stripped libraries and binaries for debugging
purposes. By default, the calc rpm installed stripped binaries
and libraries.
Added this high priority item to the calc help/todo list:
It is overkill to have nearly everything wind up in libcalc.
Form a libcalcmath and a libcalclang so that an application
that just wants to link with the calc math libs can use them
without dragging in all of the other calc language, I/O,
and builtin functions.
Fixed the wording for the -i flag in the calc man page.
Added some notes to the help/unexpected file regarding calc
and interactive shells.
Fixed bug where a FILEPOS was copied FPOS_POS_BITS octets instead of
FPOS_POS_LEN octets.
Split out ${READLINE_EXTRAS} Makefile variables from ${READLINE_LIB}
to better deal with Fedora rpm requirements.
Bit 8 (0x80) of calc_debug is reserved for custom debugging.
See help/config and custom/HOW_TO_ADD for details.
When the Makefile variable ${ALLOW_CUSTOM} is not defined or empty,
the libcustcalc library is not built or linked against, certain make
rules skip going into the custom sub-directory, the install
rule skips certain custom installation actions, and the common
C flags (${COMMON_CFLAGS}) is given -UCUSTOM. Other make rules such
as "make clean" and "make clobber" still work as before. Also
the Makefile.simple assumes that the Makefile variable ${ALLOW_CUSTOM}
is -DCUSTOM.
Clarified that the calc builtin functions rand() and random()
operate over a half closed interval. The help/rand and help/random
refer to the top of the interval as "beyond" instead of "max".
Releasing source tar balls using bzip2 instead of with gzip. So
what was calc-something.tar.gz is now calc-something.tar.bz2.
To "uncompress" use:
bunzip2 calc-something.tar.bz2
On some systems, one may untar directly by:
tar -jxvf calc-something.tar.bz2
The Makefile variable ${BYTE_ORDER} was replaced by ${CALC_BYTE_ORDER}.
Changed the way the Makefile can force the calc byte order. If you set
the Makefile variable ${CALC_BYTE_ORDER} to be -DCALC_BIG_ENDIAN then
endian.h will force the CPP symbol CALC_BYTE_ORDER to be BIG_ENDIAN.
If you set ${CALC_BYTE_ORDER} to be -DCALC_LITTLE_ENDIAN then endian.h
will force the CPP symbol CALC_BYTE_ORDER to be LITTLE_ENDIAN.
If the Makefile variable ${CALC_BYTE_ORDER} is empty, then the CPP
symbol CALC_BYTE_ORDER will set to the CPP symbol BYTE_ORDER as
defined by some system include file (if the Makefile can find such
an include file), or the Makefile compiling endian.c and hopefully
using that result to set CPP symbol CALC_BYTE_ORDER. Regardless of
how it happens, the CPP symbol CALC_BYTE_ORDER should end up set in
endian_calc.h include file.
The following are the changes from calc version 2.12.1.10 to 2.12.2:
Put back the missing -s flags on the cscripts: mersenne, 4dsphere,
fprodcut, plus, and powerterm. Thanks goes to Bradley Reed
<bradreed1 at gmail dot com> for discovering this problem.
All static variables are now declared with the symbol STATIC.
All extern variables are now declared with the symbol EXTERN.
All static functions are now declared with the symbol S_FUNC.
All extern functions are now declared with the symbol E_FUNC.
The include file decl.h defines these 4 symbols by default
to static, extern, static, and extern respectively. Under
Windows, DLL is also defined according to the _EXPORTING symbol
and is prepended to the EXTERN and E_FUNC symbols. The decl.h
file has replaced the win32dll.h file.
When WITH_TLS is defined, calc attempts to compile with Thread Local
Storage. As of version 2.12.1.12 this mode is extremely experimental.
Calc may not compile when WITH_TLS defined.
Fixed E_FUNC vs EXTERN issues discovered by Mirko Viviani
<mirko at objectlab dot org>.
Removed include of <malloc.h>. The building of the include file
"have_malloc.h" has been removed from the Makefile. One some
systems such as FreeBSD, the file /usr/include/malloc.h exists
and contains an forced error saying that stdlib.h should be used
instead. The Makefile symbol HAVE_MALLOC has been removed.
Moved the sample code in the sample sub-directory up into the
main source level. The sample/many_random.c source file is
now sample_many.c. The sample/test_random.c source file is now
sample_rand.c. The sample Makefile and the sub-directory is no more.
Renamed the following source files:
math_error.h ==> lib_calc.h
string.c ==> str.c
string.h ==> str.h
Renamed the following variables related to calc error processing:
int calc_jmp ==> int calc_use_matherr_jmpbuf
jmp_buf calc_jmp_buf ==> jmp_buf calc_matherr_jmpbuf
int post_init ==> int calc_use_scanerr_jmpbuf
jmp_buf jmpbuf ==> jmpbuf calc_scanerr_jmpbuf
char *calc_error ==> char calc_err_msg[MAXERROR+1]
These values are now declared in the lib_calc.h include file.
The value MAXERROR is now defined in lib_calc.h instead of calc.h.
The calc_err_msg[] buffer is now used for math errors as well
as scan and parse errors.
Parse/scan errors will not be printed if calc_print_scanerr_msg
is zero. By default:
int calc_print_scanerr_msg = 1;
This variable is declared in the lib_calc.h include file. Storage
comes from libcalc.
Parse/scan warnings will not be printed if calc_print_scanwarn_msg
is zero. By default:
int calc_print_scanwarn_msg = 1;
This variable is declared in the lib_calc.h include file. Storage
comes from libcalc.
The last parse/scan error message is stored in the calc_err_msg[]
buffer. This happens even when calc_print_scanerr_msg is zero.
The last parse/scan warning message is stored in the calc_warn_msg[]
buffer. After each parse/scan warning condition is detected,
the value calc_warn_cnt is incremented. This happens even when
calc_print_scanwarn_msg is zero.
The calc_warn_msg[] buffer and calc_warn_cnt variables are declared
in the lib_calc.h include file. Storage comes from libcalc.
See the file, LIBRARY or use the calc command "help libcalc" for
more information on calc error processing. This file has been
updated to reflect the changes noted above in this section.
The make install rule removes std_arg.h, have_malloc.h, math_error.h,
string.h, and win32dll.h from ${INCDIR} if they exist. These calc
include files are no longer supported.
Do reduce the number of special case .o build rules, the
${ALLOW_CUSTOM} make flag is added to ${CFLAGS} by default. This means
that if ALLOW_CUSTOM= -DCUSTOM, then -DCUSTOM is given to the compile
line of most .c files.
Calc -v reports "w/custom functions" or "w/o custom functions" on
the version string depending on if calc was compiled with the
ALLOW_CUSTOM= -DCUSTOM or not.
Replaced the concept of compiler sets in the Makefile with
host target section in the Makefile. Initial host targets are:
Linux
Darwin
FreeBSD
(default) <<== Target does not match any previous target name
Simple
NOTE: If your target is not supported below and the default target
is not suitable for your needs, please send to the:
NOTE: calc-contrib Email address no longer in use
Email address an "ifeq ($(target),YOUR_TARGET_NAME)"
... "endif" set of lines from the Makefile so that
we can consider them for the next release.
The custom/Makefile is now constructed from 3 parts: custom/Makefile.head,
the host target section in Makefile, and the custom/Makefile.tail.
The top level Makefile and the custom/Makefile require a GNU make
(such as gmake) or an equivalently advanced make. On many targets,
the default make is sufficient. On FreeBSD for example, one must
use gmake instead of make.
If your target system does not have GNU make (or equivalent), then
you should try using the Makefile.simple and custom/Makefile.simple
files:
mv Makefile Makefile.gmake
cp Makefile.simple Makefile
mv custom/Makefile custom/Makefile.gmake
cp custom/Makefile.simple custom/Makefile
make all
Added the ability to build calc with dynamic libraries, static
libraries or both. Many thanks goes to Matthew Miller (mattdm
at mattdm dot org) and Mirko Viviani (mirko at objectlab dot
org) for this help, encouragement, and testing of this major change!
Added BLD_TYPE Makefile variable to control how calc is
built. The BLD_TYPE value may be one of:
BLD_TYPE= calc-dynamic-only
BLD_TYPE= calc-static-only
Each host target establishes a default BLD_TYPE value. Of course
one can override the host target BLD_TYPE on the make command line:
make clobber
make calc-dynamic-only BLD_TYPE=calc-dynamic-only
make clobber
make calc-static-only BLD_TYPE=calc-static-only
NOTE: It is a very good idea to first clobber (remove) any previously
built .o, libs and executables before switching the build
between static and dynamic.
which have the same effect as make all with a given build phase set.
For Linux and Darwin, the default BLD_TYPE is calc-dynamic-only.
For the simple case, BLD_TYPE is calc-static-only. For the
default target (the target does not match any of the previous
defined targets), BLD_TYPE is calc-static-only.
Added ${CSFLAGS} make variable to hold the {$CC} flags for compiling
without shared library. By default, ${CFLAGS} is ${CSFLAGS} with
${CC_SHARE} added to it.
Added ${CC_SHARE}, ${LIBCALC_SHLIB}, ${LIBCUSTCALC_SHLIB}, and
${LD_SHARE} to the remaining compiler sets.
Fixed make depend and make uninstall rules. Performed various
makefile syntax cleanups.
Removed ${PROGS} and ${STATIC_PROGS} Makefile variables due to
the new BLD_TYPE system (see above).
Added missing help for cp, calcpath, and stoponerror.
Noted that calc fails the regression test (and will crash at
various times) when compiled with gcc v4.1.0. This problem was
first reported under Fedora Core 5 by Christian Siebert.
Set the LESSCHARSET to iso8859 so that less will not confuse or
upset the col utility with Invalid or incomplete multi-byte or wide
characters.
Updated the Free Software Foundation postal address and updated
the COPYING-LGPL from http://www.fsf.org/licensing/licenses/lgpl.txt
on 2007-Mar-14. Calc is using the same Version 2.1 of the LGPL,
only the postal address of the Free Software Foundation has
been updated. All source files were updated to RCS level 30.
Thanks goes to Martin Buck (m at rtin-buck dor de) for this patch.
Added printf arg checking for GNU C compilers that helps check
printf-style functions in calc. Thanks goes to Martin Buck (m at
rtin-buck dor de) for this patch.
Fixed issues where the argument of a printf-like did not match the
format type.
Removed build function md5(). The MD5 hash has been compromised to
such a degree that is it no longer advisable to use this function.
Removed build function sha(). The SHA hash has been compromised to
such a degree that is it no longer advisable to use this function.
Note that the SHA-1 hash has not been compromised to the same degree
and so this hash function remains.
Renamed shs1.c to sha1.c. Renamed shs1.h to sha1.h.
Added custom registers. The custom register function:
custom("register", 3)
returns the value of custom register 3. Custom registers, initialized
with 0, may take on any calc value:
custom("register", regnum, value)
Added REGNUM_MAX to the sysinfo custom function to return the maximum
register number:
custom("sysinfo", "REGNUM_MAX")
which defaults to 31. The first custom register is 0 and thus the
default number of custom registers is 32.
Added E_OK #define in calc.h to indicate no error (0).
Renamed C function powivalue() in value.c to powvalue() because it
now handles raising NUMBER or COMPLEX to a NUMBER or COMPLEX power.
The powervalue() function in value.c may be given a NULL epsilon
which will cause to the builtin epsilon value to be used.
Calc supports both real and complex exponentiation bases and exponents.
For a ^ b and a ** b, "a" and "b" can be a real value or a complex value:
2^3 3i^4
2.5 ^ 3.5 0.5i ^ 0.25
2.5 ^ 2.718i 3.13145i ^ 0.30103i
Fixed typos in the calc man page thanks to a Debian bug report
by A. Costa <agcosta at gis dot .net> that was kindly forwarded
to us by Martin Buck <m at rtin-buck dot de>.
The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
Fixed calc cscripts that contained comments that were not valid calc
comments. Improved calc comment documentation in "help unexpected"
to help other avoid similar mistakes. Calc comments are of the form:
/* c style comments */
/*
* multi-line
* comments
*/
## two or more #-signs
### in a row
### Note that # along is a calc unary and binary operator
Added "help pound" or "help #' to document the # operator, comments,
and the first line of cscript files.
Documented these help commands in "help help":
help ->
help *
help .
help %
help //
help #
The usage help file is now formed from the contents of the calc man page.
So "help usage" prints the version of the calc man page. Added ${COL}
makefile symbol to support the formation of the calc.usage file from
calc.1 via the CALCPAGER (less) or NROFF (if NROFF is non-empty).
The "help calc" command is now equivalent to "help help".
The "help define" command is now equivalent to "help command".
Fixed calc command line usage message.
Fixed missing README.src file in RPM src and tgz src tarball.
Removed HAVE_SNPRINTF test in version.c. We now assume that
all systems come with the standard snprintf() library function.
Make does not assume that DONT_HAVE_VSPRINTF must be defined in
order to test for varargs (via have_varvs.c). Instead it uses the
${HAVE_VSPRINTF} to determine if the vsprintf() and vsnprintf()
should be tested to assumed to exist or not exist.
Tests for the existence of vsprintf() now also require the existence
of vsnprintf(). Test for the existence of vsnprintf() now also
require the existence of vsprintf().
The #define CALC_SIZE_T was never used except when memmove() was
not found. This symbol was renamed to MEMMOVE_SIZE_T. Calc
requires that size_t must be a known type.
Calc and cscripts are installed mode 0755 instead of 0555 to
make rpmlint happy.
Make clobber cleanup as suggested by Martin Buck <m at rtin-buck dot de>.
The clobber rule now depends on the clean rule.
The following are the changes from calc version 2.12.1.6 to 2.12.1.7:
Added the calc builtin function, usertime(), to return the amount of
user CPU time used by the current process. Unlike the old runtime()
builtin, the CPU time reported for long running processes will not
wrap around to 0 after only a few months.
Added the calc built0in function, systime(), to return the amount of
kernel CPU time used by the current process.
The runtime() builtin function now returns the total amount of CPU
time used by the current process. This time includes both user mode
and kernel mode time. Unlike the old runtime() builtin, the builtin
includes time spent executing operating system code on behalf of
the current process.
Fixed runtime() so that the CPU time reported for long running
processes will wrap around to 0 for a long time.
Added config("hz") to return the clock tick rate. This is
a read-only configuration value.
Added regression tests for recently added config() parameters.
Fixed the #define symbols that were created in have_strdup.h.
Previously this file looked as if have_rusage.h has been
included already.
Restored the function of "help" (without any args) printing the
default help file. Thanks for this fix goes to Silvan Minghetti
<bullet at users dot sourceforge dot net>.
Fixed a problem where some old MS environments failed some of the
regression tests because "read -once foo.cal" was not behaving
correctly due to how the _fullpath() was being called. Thanks for
this fix goes to Anatoly <notexistent-anb at yandex dot ru>.
Documented the mis-feature about how calc parses if, for, while
and do statements in an unexpected way. For example:
This works as expected:
if (expr) {
...
}
However this WILL NOT WORK AS EXPECTED:
if (expr)
{
...
}
because calc will parse the if being terminated by
an empty statement followed by a
if (expr) ;
{
...
}
See also "help statement", "help unexpected", "help todo", and
"help bugs".
The following are the changes from calc version 2.12.1 to 2.12.1.5:
Fixed minor typos in the 'version 2.12.0 to 2.12.0.8' section below.
Made minor formatting changes as well.
Changed use of ${Q} in the Makefile to avoid an make "feature"
related to OpenBSD. Added ${RM} make variable for make tools that
do not have builtin defined terms.
Removed the ECHO_PROG Makefile variable. Also removed it from
the sysinfo() custom function.
Improved the support for cross-compiled environments by using
make symbols for all non-shell commands executed by Makefiles.
Fixed a problem with the make chk awk script which failed under
OS X 10.4.7.
Fixed a few minor variables that were not set to default values in
lower level Makefiles.
Fixed a reference to a non-existent make variable in HOWTO.INSTALL.
The following are the changes from calc version 2.12.0 to 2.12.0.8:
Fixed ellip.cal to deal with a calc syntax change that happened
many ages ago but was never applied to this file until now.
This bug was fixed by Ernest Bowen <ebowen at une dot edu dot au>.
Fixed a problem where comments using # followed by a !, newline or
another # works. This bug was fixed by Ernest Bowen <ebowen at une
dot edu dot au>.
The show builtins display for functions with long descriptions
is now broken into multi-line descriptions.
The str functions, such as strcpy(s1, s2), will now copy as many
characters as possible from s2 to s1, treating '\0' like any other
character until the end of s2 is reached. If s2 is shorter than s1,
a '\0' is inserted.
The strcmp(s1, s2) builtin, for strings s1, s2: strcmp(s1, s2) == 0 now
means the same as s1 == s2.
The str(s) builtin has been changed so that it will return only the
string formed by the characters of 's' up to the first '\0'.
The substr(s, start, num) builtin has been changed so that '\0' characters
are treated like any other.
Fixed a bug where strcpy("", "a") used to cause a segmentation fault.
This bug was fixed by Ernest Bowen <ebowen at une dot edu dot au>.
Make minor change to natnumset.cal in how the tail variable is initialized.
Fixed bugs in the strcmp, strncmp, strcpy, and strncpy help files.
This bug was fixed by Ernest Bowen <ebowen at une dot edu dot au>.
Added cal/screen.cal which Defines ANSI control sequences providing
(i.e., cursor movement, changing foreground or background color,
etc.) for VT100 terminals and terminal window emulators (i.e., xterm,
Apple OS/X Terminal, etc.) that support them. For example:
; read screen
; print green:"This is green. ":red:"This is red.":black
Fixed a bug where too many open files returned E_FOPEN3. Now
a new error symbol F_MANYOPEN is used for too many open files.
Added the builtin function fpathopen() to open a file while
searching along a path:
; fd2 = fpathopen("tmp/date", "r", ".:~:~sc:/tmp:/var/tmp:/var")
; print fd2
"/var/tmp/date"
By default, fpathopen() searches along CALCPATH.
Added the calcpath() builtin function to return the current value
of CALCPATH.
Fixed prompt characters in the EXAMPLE section of help files.
Fixed problems related to the protect function and its documentation.
This bug was reported by David Gilham <davidgilham at gmail dot com>.
This bug was fixed by Ernest Bowen <ebowen at une dot edu dot au>.
Raised the limit of exponent in exponential notation. It was set to
arbitrary 1000000 (making 1e1000001 in invalid exponential notation
value). The exponent for exponential notation is now int(MAXLONG/10).
On 32 bit machines, this means a limit of 214748364. On 64 bit
machines, this means 922337203685477580. Of course, you may not
have enough memory to hold such huge values, but if you did you can
now express such values in exponential notation.
Added log() builtin for base 10 logarithm.
Fixed problems where internal use of libc strcpy() might have caused
a buffer overflow. Calc now only uses libc strcpy() when the source
string is a constant.
The calc STRING and STRINGHEAD now use the standard size_t (an unsigned
type) length. Calc mostly uses size_t in dealing with string lengths
and object sizes when possible.
Added ${CCWERR} make variable to allow one to force compiler warnings
to be treated as errors. The ${CC} make variable now uses ${CCWERR}
however the ${LCC} (used by the Makefile test code for building hsrc
files) does not use ${CCWERR}. By default, ${CCWERR} is empty.
In development Makefiles, we set CCWERR= -Werror to force us to
address compiler warnings before the next release.
The calc make variable, CALCPAGER, now defaults to CALCPAGER= less
because the less utility is now very common. Set CALCPAGER= more
if you do not have less.
Calc source had two styles of switch indentation. Converted the
style where case statements were indented with respect to the switch
statement into the style where the case statements are at the same
level. When comparing with older source, one may use the -b argument
of the diff command to ignore changes in amount of white space:
diff -b -r -u calc-2.11.11 calc-2.12.0
The read, write, and help commands use the value of global string
variable if the symbol name starts with a $. For example:
global x = "lucas.cal";
read $x; /* same as read lucas.cal or read "lucas.cal" */
Added dotest.cal resource. Based on a design by Ernest Bowen
<ebowen at une dot edu dot au>, the dotest evaluates individual
lines from a file. The dotest() function takes 1 to 3 arguments:
dotest(dotest_file [,dotest_code [,dotest_maxcond]])
dotest_file
Search along CALCPATH for dotest_file, which contains lines that
should evaluate to 1. Comment lines and empty lines are ignored.
Comment lines should use ## instead of the multi like /* ... */
because lines are evaluated one line at a time.
dotest_code
Assign the code number that is to be printed at the start of
each non-error line and after **** in each error line.
The default code number is 999.
dotest_maxcond
The maximum number of error conditions that may be detected.
An error condition is not a sign of a problem, in some cases
a line deliberately forces an error condition. A value of -1,
the default, implies a maximum of 2147483647.
Global variables and functions must be declared ahead of time because
the dotest scope of evaluation is a line at a time. For example:
; read dotest.cal
; read set8700.cal
; dotest("set8700.line");
Updated the todo / wish list items. The top priority now is to
convert calc to GNU autoconf / configure to build the calc.
; help todo
Added missing help file for the stoponerror() builtin.
Corrected and improved the help documentation for factor and lfactor.
Fixed a problem where some error messages that should have been
written to a file or string, went to stderr instead. This bug was
fixed by Ernest Bowen <ebowen at une dot edu dot au>.
Corrected the documentation relating to the calc -c command line option.
The -c relates to scan/parse errors only, not execution errors.
Corrected a stack overflow problem where the math_fmt() in zio.c
could be induced to overflow the stack. This problem was independently
reported by Chew Keong Tan of Secunia Research <vuln at secunia dot com>.
Corrected a stack overflow problem where the scanerror() in token.c
could be induced to overflow the stack by a malformed token.
Made math_error() in math_error.c more robust against a error
message constant that is too long.
Made read_bindings() in hist.c more robust against very long bindings
config lines.
Made listsort() in listfunc.c and matsort() matfunc.c more robust
against sorting of impossibly huge lists and matrices.
Warnings about an undefining a builtin or undefined function, a
constant before the comma operator, and an unterminated comment is
now processed by scanerrors (not simply written directly to stderr).
These warnings file and line number in which the "error" occurred
as well as a more precise message than before. If using -c on the
calc command line or if stoponerror(-1), then assuming there are
no other compile errors, only the unterminated comment will stop
completion of the function being defined.
The cal/regress.cal now reads most of the calc resource files.
The issq() test had a slight performance boost. A minor note
was added to the help/issq file.
Improved the documentation of the mul2, sq2, pow2, and redc2 config
parameters in help/config.
Added config("baseb"), a read-only configuration value to return
the number of bits in the fundamental base in which calculations
are performed. This is a read-only configuration value.
Calc now will allow syntax such as ++*p-- and ++*----*++p----
where p is an lvalue; successful evaluation of course require the
successive operations to be performed to have operands of appropriate
types; e.g. in *A, A is usually an lvalue whose current value is a
pointer. ++ and -- act on lvalues. In the above examples there are
implied parentheses from the beginning to immediately after p. If
there are no pre ++ or -- operations, as in **p++. The implied
parentheses are from immediately before p to the end.
Improved the error message when && is used as a prefix operator.
Changed the help/config file to read like a builtin function help file.
One can no longer set to 1, or to a value < 0, the config()
parameters: "mul2", "sq2", "pow2", and "redc2". These values
in the past would result in improper configuration of internal
calc algorithms. Changed cal/test4100.cal to use the minimal
value of 2 for "pow2", and "redc2".
Changed the default values for the following config() parameters:
config("mul2") == 1780
config("sq2") == 3388
config("pow2") == 176
These values were determined established on a 1.8GHz AMD 32-bit
CPU of ~3406 BogoMIPS by the new resource file:
cal/alg_config.cal
Regarding the alg_config.cal resource file:
The best_mul2() function returns the optimal value of config("mul2").
The best_sq2() function returns the optimal value of config("sq2").
The best_pow2() function returns the optimal value of config("pow2").
The other functions are just support functions.
By design, best_mul2(), best_sq2(), and best_pow2() take a few
minutes to run. These functions increase the number of times a
given computational loop is executed until a minimum amount of CPU
time is consumed. To watch these functions progress, one can set
the config("user_debug") value.
Here is a suggested way to use the alg_config.cal resource file:
; read alg_config
; config("user_debug",2),;
; best_mul2(); best_sq2(); best_pow2();
; best_mul2(); best_sq2(); best_pow2();
; best_mul2(); best_sq2(); best_pow2();
NOTE: It is perfectly normal for the optimal value returned
to differ slightly from run to run. Slight variations due to
inaccuracy in CPU timings will cause the best value returned to
differ slightly from run to run.
See "help resource" for more information on alg_config.cal.
Updated the "help variable" text to reflect the current calc
use of ` (backquote), * (star), and & (ampersand).
Removal of some restrictions on the use of the same identifier
for more than one of parameter, local, static or global variable.
For example, at command level, one could use:
for (local x = 0; x < 10; x++) print sqrt(x);
At the beginning of a statement, "(global A)" is a way of
indicating a reference to the variable A, whereas "global A"
would be taken as a declaration. Parentheses are not required in
"++global A" or "global A++" when "global" is used in this way.
The patch extends this "specifier" (or "qualifier") feature
to static variables, but such that "static A" refers only
to a static variable at the current file and function scope
levels. (If there is already a static variable A at the current
file and function levels, a declaration statement "static A"
would end the scope of that variable and define a new static
variable with identifier A. A "global A" declaration is more
drastic in that it ends the scope of any static variable A at
the same or higher scope levels.)
Unlike a static declaration in which an "initialization" occurs at
most once, in the specifier case, "static A = expr" is simply an
assignment which may be repeated any number of times. An example
of its use is:
define np() = static a = nextprime(a);
For n not too large, the n-th call to this function will
return the n-th prime. The variable a here will be private to
the function.
Because one can use "global", "local" or "static" to specify a
type of variable, there seems little point in restricting the
ways identifiers that can be used in more than one of these
or as parameters. Obviously, introducing A as a local variable
when it is being used as a parameter can lead to confusion and a
warning is appropriate, but if it is to be used only occasionally,
it might be convenient to be able to refer to it as "local A"
rather than introducing another identifier. While it may be
silly to use the same identifier for both a parameter and local
variable, it should not be illegal.
Added warnings for possibly questionable code in function definitions.
Added config("redecl_warn", boolean) to control if calc issues
warnings about variables being declared. The config("redecl_warn")
value is TRUE by default.
Added config("dupvar_warn", boolean) to control if calc issues
warnings about when variable names collide. The config("dupvar_warn")
value is TRUE by default. Examples of variable name collisions
include when:
* both local and static variables have the same name
* both local and global variables have the same name
* both function parameter and local variables have the same name
* both function parameter and global variables have the same name
Fix of a bug which causes some static variables not to be correctly
unscoped when their identifiers are used in a global declaration.
Change of "undefine" from a command-level keyword to statement level and
introduction of an "undefine static A" statement to end the scope of a
static variable A at the current file/function levels.
Change/restored the syntax rules for "for" and "while" loops to
recognize an unescaped newline in top-level command-level statements.
Updated help/avg, help/define, help/fprintf, help/gcd, help/hash,
help/hmean, help/lcm, help/max, help/min, help/null, help/poly,
help/printf, help/ssq, help/strcat, help/strprintf, help/sum,
help/xor.
Changed the definition of the function ssq() to enable list arguments
to be processed in the same way as in sum(). For example:
ssq(1,2, list(3,4,list(5,6)), list(), 7, 8)
returns the value of 1^2 + 2^2 + ... + 8^2 == 204.
Added the calc resource sumtimes.cal, to give the runtimes for
various ways of evaluating sums, sums of squares, etc, for large
lists and matrices. For example:
read sumtimes
doalltimes(1e6)
Calc now ignores carriage returns (\r), vertical tabs (\v), and
form feeds (\f) when token parsing. Thus users on Windows systems
can write files using their \r\n format and users on non-Windows
systems can read them without errors.
The quomod() builtin function now takes an optional 5th argument
which controls the rounding mode like config("quomod") does, but
only for that call. Now quomod() is in line with quo() and mod()
in that the final argument is an optional rounding mode.
Added a "make uninstall" rule which will attempt to remove everything
that was installed by a "make install".
Changed the copyright line in the rpm spec file to a "License" line
as per new rpm v4.4 syntax.
The quomod() builtin function does not allow constants for its 3rd
and 4th arguments. Updated the "help quomod" file and added more
quomod regression tests.
Added patch from Ernest Bowen <ebowen at une dot edu dot au> to
add the builtin: estr(). The estr(x) will return a representation
of a null, string, real number, complex number, list, matrix,
object. block, named block, error as a string.
Added patch from Ernest Bowen <ebowen at une dot edu dot au> to
add the builtin: fgetfile(). The fgetfile(x) will return the rest
of an open file as a string.
Improved help files for fgetfield, fputs, name, or quomod.
The following are the changes from calc version 2.11.10.1 to 2.11.11:
Fixed a bug reported by the sourceforge user: cedars where:
ln(exp(6)) == 3 /* WRONG!!! */
incorrectly returned 1. This bug was fixed by Ernest Bowen
<ebowen at une dot edu dot au>. The regression test
was expanded to cover this issue.
Added minor improvements to hash regression testing of pi().
Fixed "help script" and the calc man page regarding the requirement
of -f to be the last -flag in shell script mode. Further clarified
the meaning and placement of the -f flag.
Moved issues with chi.cal intfile.cal into a "mis-features" section
of the BUGS file. See "help bugs" or the BUGS source file for details.
Added the bug about:
calc 'read ellip; efactor(13*17*19)'
to the BUGS file. See "help bugs" or the BUGS source file for details.
Anyone want to track down and fix this bug?
Fixed typo in the "help mat" example and improved the mat_print example.
Renamed most COMPLEX C function names to start with c_ to avoid
conflicts with new C standard functions. Note that the calc
builtin function names remain the same. The C function names
inside the C source that calc is written in changed. This means
that code that linked to libcalc.a will need to change in order
to call calc's functions instead of the C standard functions.
See cmath.h, comfunc.c, and commath.c for details. See also
http://www.opengroup.org/onlinepubs/009695399/basedefs/complex.h.html
for names of the new C standard functions.
Changed the calc man page to note that using -- in the command will
separate calc options from arguments as in:
calc -p -- -1 - -7
Noted how Apple OS X can make use of readline in the Makefile.
In particular:
# For Apple OS X: install fink from http://fink.sourceforge.net
# and then do a 'fink install readline' and then use:
#
READLINE_LIB= -L/sw/lib -lreadline -lhistory -lncurses
Added linear.cal as a calc standard resource file.
The following are the changes from calc version 2.11.10 to 2.11.10:
The cygwin config value is correctly tested while doing comparisons
between config states.
Added config("compile_custom") to determine if calc was compiled
with -DCUSTOM. By default, the Makefile uses ALLOW_CUSTOM= -DCUSTOM
so by default, config("compile_custom") is TRUE. If, however,
calc is compiled without -DCUSTOM, then config("compile_custom")
will be FALSE. NOTE: The config("compile_custom") value is only
affected by compile flags. The calc -D runtime command line option
does not change the config("compile_custom") value. This is a
read-only configuration value.
Added config("allow_custom") to determine if the use of custom
functions are allowed. To allow the use of custom functions, calc
must be compiled with -DCUSTOM (which it is by default) AND calc run
be run with the -D runtime command line option (which it is not by
default). If config("allow_custom") is TRUE, then custom functions
are allowed. If config("allow_custom") is FALSE, then custom
functions are not allowed. This is a read-only configuration value.
Correctly hash config state for windows and cygwin values. The value
of config("compile_custom") and config("allow_custom") also affect
the hash of the config state.
Fixed the custom/argv.cal test code to avoid use of a reserved
builtin function name.
Fixed custom/*.cal scripts to conform better with the cal/*.cal
resource files.
Removed the Makefile variables ${LONGLONG_BITS}, ${HAVE_LONGLONG},
and ${L64_FORMAT}. Removed longlong.c and longlong.h. The use
of HAVE_LONGLONG=0 was problematic. The lack of complaints about
the HAVE_LONGLONG=0 shows that the 'long long' type is wide spread
enough to warrant not trying to support compilers without 'long long'.
Removed the SVAL and SHVAL macros from zrand.c, zrand.h, and zmath.h
as they were causing too many broken C pre-processors and C checkers
to become confused.
Added a 'make splint' rule to use the splint statically checking
tool on the calc source.
Removed support of the BSDI platform. The BSDI platform is no longer
directly supported and we lost our last BSDI machine on which we
could test calc. Best wishes to the former BSDI folk and thanks
for breaking important ground in the Open Source Movement!
Fixed several typos found in the documentation and builtin
function output by C Smith <smichr at hotmail dot com>.
Fixed -d so that:
calc -d 2/3
will print 0.66666666666666666667 without the leading tilde as
advertised in the man page.
Added a missing help file for the display builtin function as
requested by Igor Furlan <primorec at sbcglobal dot net>.
Changed the "help environment" file to reflect modern default
values of CALCPATH and CALCRC.
Added missing variables for printing by the "make env" rule.
Added EXT Makefile variable so that Cygwin can install calc as
calc.exe. By default, EXT is empty so that calc is calc on most
modern operating systems. Thanks goes to Ullal Devappa Kini <wmbfqj
at vsnl dot net> for helping identify this problem and testing our fix.
Added custom function:
custom("pmodm127", q)
to compute 2^(2^127-1) mod q. While currently slower than just
doing pmod(2,2^127-1,q), it is added to give an example of a
more complex custom function. Call calc with the -C flag to
use custom functions.
Made slight changes to the custom/HOW_TO_ADD documentation.
Fixed some \ formatting man page problems as reported by Keh-Cheng
Chu <kehcheng at quake dot Stanford dot edu>.
Fixed some comparison between signed and unsigned in md5.c
that was reported for the PowerMac G5 2GHz MacOS 10.3 by
Guillaume VERGNAUD <vergnaud at via dot ecp dot fr>.
Fixed a number of pending issues with help files filling in
missing LIMITS, LINK LIBRARY, and SEE ALSO information,
The following are the changes from calc version 2.11.9 to 2.11.9.3:
Fixed calc man page examples to move -f to the end of the line.
Thanks goes to Michael Somos for pointing this out.
Linux and gcc now compiled with -Wall -W -Wno-comment.
Fixed a post increment that was reported by R. Trinler <trinler at
web dot de> and fixed by Ernest Bowen <ernie at turing dot une dot
edu dot au>.
Fixed pi.cal to not depend on the buggy pre-2.11.9 post increment
behavior.
Added config("cygwin") to determine if calc was compiled under Cygwin.
The config("cygwin") is a read-only configuration value that is 1
when calc was compiled under Cygwin and 0 otherwise. Regression
tests 949 and 950 are skipped when config("cygwin") is true.
The Makefile variable HAVE_NO_IMPLICIT is empty by default so that
the Makefile will test if the compiler has a -Wno-implicit flag.
Added HAVE_UNUSED Makefile variable. If HAVE_UNUSED is empty,
then the Makefile will run the have_unused program to determine
if the unused attribute is supported. If HAVE_UNUSED is set to
-DHAVE_NO_UNUSED, then the unused attribute will not be used.
The Makefile builds have_unused.h which defines, if the unused
attribute is supported:
#define HAVE_UNUSED /* yes */
#define UNUSED __attribute__((unused)) /* yes */
or defines, if the unused is not supported (or if the Makefile
variable is HAVE_UNUSED= -DHAVE_NO_UNUSED):
#undef HAVE_UNUSED /* no */
#define UNUSED /* no */
Fixed numerous warnings about comparison between signed and unsigned
value warnings and unused parameter warnings in version.c, zrand.c,
string.c, shs1.c, shs.c, qtrans.c, qmath.c, qfunc.c, md5.c, matfunc.c,
hist.c, file.c, const.c, blkcpy.c, seed.c, opcodes.c, func.c, qio.c,
zrandom.c, custom/c_argv.c, custom/c_devnull.c, custom/c_help.c,
custom/c_sysinfo.c, addop.c and calc.c.
Fixed some typos in this file.
By default, compile with -O3 -g3. The Makefile comments on how some
distributions might need to use -O2 -g or -O -g.
The following are the changes from calc version 2.11.8.0 to 2.11.8.1:
Updated HOWTO.INSTALL to reflect the new RPM files.
Clarify that the internal hash as well as the hash builtin
function used by calc, while based on the Fowler/Noll/Vo
hash is NOT an FNV hash.
Made slight performance improvements to calc by an optimization of how
calc's internal hash is computed. The "make chk" regression test
runs about 1.5% faster (when compiled with -O3 on an AMD Athlon)
NO_HASH_CPU_OPTIMIZATION is not defined. Calc's internal hash values
have not changed. By default, NO_HASH_CPU_OPTIMIZATION is NOT defined
and the slightly faster expression is used.
A slight modification of what was known as the "calc new standard"
configuration (calc -n or config("all", "newstd")) is now the default
calc configuration. The flag:
calc -O
was added to get the old classic calc configuration. The flag command
line flag, -n, now does nothing. Use of -n is deprecated and may go
away / be used for something else in the future.
The following table gives the summary of these changes:
pre v2.11.8 v2.11.8
default pre v2.11.8 -O & oldstd v2.11.8
and oldstd -n & newstd classic cfg default
--------------------------------------------------------
epsilon 1e-20 1e-10 1e-20 1e-20
quo 2 2 2 2
outround 2 24 2 24
leadzero 0 1 0 1
fullzero 0 1 0 0
prompt > ; > ;
more >> ;; >> ;;
With the exception of epsilon being 1e-20, and fullzero being unset,
the new default calc config is like it was (pre-2.11.8) with calc -n /
config("all", "newstd").
The new default config is the old classic config with outround being
24, leadzero being set, and the prompts being ;'s.
Fixed a bug in the evaluation of tanh(1e-23) with an epsilon(1e-100).
Thanks goes to Dmitry G. Baksheyev <bd at nbsp dot nsk dot su>
for reporting the problem, and thanks goes to Ernest Bowen
<ernie at turing dot une dot edu dot au> for the fix.
The following are the changes from calc version 2.11.7.0 to 2.11.7.1:
Added support to build calc RPMs thanks to Petteri Kettunen
<petterik at users dot sourceforge dot net>.
Added rpm rule to Makefile to build rpm set. The rpm rule
uses the rpm.mk Makefile and the calc.spec.in spec template.
The default Makefile is now the Makefile used during rpm
creation. This Makefile assumes that system has readline,
ncurses (-lreadline -lhistory -lncurses), and less.
It compiled with a high gcc optimization level (-O3 -g3).
The Makefile used during rpm creation is the Makefile
that appears in the calc-src rpm as well.
The Makefile shipped with the old style gziped tarball
is still the same generic Makefile.
The Makefile now uses ${MKDIR} ${MKDIR_ARG} when creating
directories during installation. By default, it does
a mkdir -p when forming directories.
Fixed attributes on include and lib calc-devel files.
Adjusted the interaction between rpm.mk, and the calc.spec.in.
Release number now comes from calc.spec.in only.
Renamed calc and calc-devel RPMs to use .i686 instead of .i386.
The following are the changes from calc version 2.11.6.3 to date:
Fixed a bug in deg.cal where fixdms() was being called with
the wrong type of argument.
Changed the value of digits(1) and digits(0) to be 1. Now digits()
returns number of digits in the standard base-b representation
when x is truncated to an integer and the sign is ignored.
To be more precise: when abs(int(x)) > 0, this function returns
the value 1 + ilog(x, b). When abs(int(x)) == 0, then this
function returns the value 1.
As the result of the above digits() change, the repeat.cal
resource file script was modified to remove the special
case for repeating a value of 1. Also the regress tests
#715, #977 and #978 were changed.
Made a minor improvement to the "help places" documentation.
Fixed dms_neg(a) in deg.cal thanks to a bug report by kaa
<kaa76 at pochtamt dot ru>.
The following are the changes from calc version 2.11.6.0 to 2.11.6.2:
Clarified remark in lucas.cal about use of n mod 2^n == 0.
Fixed help typos reported by Marc Mezzarobba <mm at mm dot ovh dot org>.
Forced system("") to return 0 under Windows.
The direct.h include file is not used when compiling under Cygwin.
Fixed bug where random(10,11) caused calc to dump core when issued
the 2nd time.
Moved the setting of the Makefile variable ${CALC_INCDIR} to
the section where things like ${BINDIR} and ${LIBDIR} are set.
Idea from Clifford Kite <kite_public1 at ev1 dot net>.
The Makefile is shipped mode 0644 since a number of folks
edit it (to build and check calc) as a non-root user and later
on su to root to install. Idea from Clifford Kite <kite_public1
at ev1 dot net>.
Added base2() builtin function to calc. Normally calc prints
values according to base(). Frequently some users want to see
a value in two bases. Flipping back and forth between to bases
is a bit of a pain. With base2(), calc will output a value twice:
; 234567
234567
; base2(16),
; 234567
234567 /* 0x39447 */
; 131072
131072 /* 0x20000 */
; base2(0),
; 131072
131072
By default, base2() is disabled. Calling base2(0) will also turn
off the double base mode. Thanks goes to Erik Anggard
<erik dot anggard at packetfront dot com> for his idea and
his initial patch.
Added repeat.cal as a calc resource file script:
repeat(digit_set, repeat_count)
Return the value of the digit_set repeated repeat_count times.
Both digit_set and repeat_count must be integers > 0.
For example repeat(423,5) returns the value 423423423423423,
which is the digit_set 423 repeated 5 times.
Makefile no longer makes a direct reference to Red Hat 6.0.
Added missing math_setmode2() prototype to zmath.h.
Fixed some implicit declarations of functions by either making
them explicit or by including the proper system .h files.
Makefile no longer uses -Wno-implicit flag, by default, for
gcc based compiles on calc source. Makefile now attempts to
compile no_implicit.c with an explicit -Wno-implicit arg in an
effort to determine of -Wno-implicit is a valid compiler flag.
If no_implicit.c is compiled with -Wno-implicit, then
the file no_implicit.arg is created with the contents
of the -Wno-implicit flag. Otherwise no_implicit.arg
is created as an empty file.
Added the Makefile variable ${HAVE_NO_IMPLICIT}, which if
not set to YES will prevent no_implicit.c from being
compiled and prevent the -Wno-implicit flag from being used.
If ${HAVE_NO_IMPLICIT} is not YES, then an empty no_implicit.arg
file is created and no_implicit.c is not compiled.
The seed.c file, because the pseudo_seed() function contains
calls to a number of various system functions, attempts to
compile with the -Wno-implicit flag (if allowed by the
formation of the no_implicit.arg file).
Misc make depend fixes and cleanup.
Fixed formation of the custom/.all file.
Fixed repeat(1, repeat_count) bug.
The following are the changes from calc version 2.11.5.5 to 2.11.5.9:
Now using version numbers of one of these forms:
x.y.z.w
x.y.z
x.y
Changed the READLINE_LIB Makefile variable to not link with -lreadline
by default. If you do have readline, we recommend that you use it.
If you can install the GNU readline:
http://freshmeat.net/projects/gnureadline/
http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
we recommend it. But if not, you should set the USE_READLINE,
READLINE_LIB, and READLINE_INCLUDE Makefile variables to empty.
NOTE: See the BUGS file for a Linux issue when compiling calc
with -O (or -O2 or -O3) AND with -g (or -g3) AND with readline.
Removed an obsolete reference to TOPDIR. This was fixed thanks to
a bug report by Clifford Kite <kite_public1 at ev1 dot net>.
Fixed other inconsistencies related to things like BINDIR.
Fixed calc man page so that is refers to -f instead of the old -S flag.
Fixed thanks to Clifford Kite <kite_public1 at ev1 dot net> for
point this out.
All for loops end with /dev/null to avoid any problems related
to systems that cannot grok empty for loops.
Changed the libcalc functions creal and cimag to c_real and c_imag
to about conflicts with new libc such as those used by gcc v3.
Thanks Eli Zaretskii <eliz at is dot elta dot co dot il> and
Martin Buck <m at rtin-buck dot de> for alerting us to this conflict.
The Makefile no longer hard code's /usr/include. Instead it uses
the ${INCDIR} Makefile variable. Thanks goes to Eli Zaretskii
<eliz at is dot elta dot co dot il> for pointing out this inconsistency.
Added mods to support compilation under DJGPP. DJGPP runs on 386
and newer PCs running DOS or dos-compatible operating systems.
See http://www.delorie.com/djgpp/. Thanks goes to Eli Zaretskii
<eliz at is dot elta dot co dot il> for sending in these mods.
Updated README.WINDOWS to include information on building with DJGPP.
The pld folks are building RPMs based on our calc distributions.
See: ftp://ftp.pld.org.pl/dists/ra/PLD/i686/PLD/RPMS or
http://ftp.pld.org.pl/dists/ra/PLD/i686/PLD/RPMS more information.
We appreciate their work in this regard. In the next release, we
plan to also build and release our own RPMs based on their efforts.
Changed the Makefile variable CUSTOMLIBDIR to CUSTOMCALDIR.
Changed the Makefile variable CSHAREDIR to CALC_SHAREDIR.
Changed the Makefile variable INCDIRCALC to CALC_INCDIR.
Removed the Makefile variable SHAREDIR.
Updated the HOWTO.INSTALL and README.WINDOWS files.
Fixed definition of MAXUFULL. Thanks to a bus report from
Jill Poland <jpoland at cadence dot com>.
The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4:
Updated dependency rules in Makefiles.
NOTE: -DSRC, as used in 2.11.5t4.1 was renamed -DCALC_SRC
in a later version.
Calc include files use #include "foo.h" to include other calc
header files if -DCALC_SRC. Otherwise they use <calc/foo.h>.
The -DCALC_SRC symbol is defined by default in calc's Makefile
and so it uses the header files from within the calc src tree.
If an external non-calc program includes an installed calc
header file (from under /usr/include), and it does NOT define
CALC_SRC, then it will obtain the calc header files from the
correct system location (such as /usr/include/calc/foo.h).
Added calc builtin function: version() which returns the calc
version string.
Added subject requirements for the calc-tester-request and
calc-bugs-mail Email aliases. See:
http://www.isthe.com/chongo/tech/comp/calc/email.html
for details.
Corrected a bug that incorrectly set the default calc path
back in version 2.11.5t4. The default CALCPATH is now:
.:./cal:~/.cal:/usr/share/calc:/usr/share/calc/custom
and the default CALCRC is now:
/usr/share/calc/startup:~/.calcrc:./.calcinit
This fixes the missing bindings error and it places the calc
resource files into the default path.
If you are using the GNU readline then the Makefile recommends that
you link with the ncurses library.
Applied Makefile, cscript/Makefile and custom/Makefile patches to
fix install mode problems, to deal with sorting and dates in I18n
environments (such as Japanese), to fix some problems with calc.spec
and to fix the cscript #! header lines. Thanks goes to KAWAMURA Masao
(kawamura at mlb.co.jp) for the bug report and patch!
Fixed headers on fproduct.calc powerterm.calc 4dsphere.calc so
that they are correctly changed on installation.
Added ${GREP} Makefile variable.
The top level Makefile now sets LANG=C and passes it down to
lower level Makefiles.
Updated URLs in cal/lucas.cal comments.
Now shipping calc.spec, inst_files, spec-template and Makefile.linux
with the standard calc source distribution. Note that the standard
Makefile has not changed. The Makefile.linux only in minor ways
needed to build calc rpms.
Added $T Makefile variable. $T is the top level directory under
which calc will be installed. The calc install is performed under $T,
the calc build is performed under /. The purpose for $T is to allow
someone to install calc somewhere other than into the system area.
For example when forming the calc rpm, the Makefile is called with
T=$RPM_BUILD_ROOT. If $T is empty, calc is installed under /.
Removed all echo_XYZ rules except for echo_inst_files from lower
level makefile. The calc.spec will use a make install rule
with T=$RPM_BUILD_ROOT.
Updated LIBRARY file with instructions related to -DCALC_SRC,
the new default include file location and -lcustcalc.
The following are the changes from calc version 2.11.5t3 to 2.11.5t4:
The Makefile will now send both stdout and stderr to /dev/null
when compiling hsrc intermediates.
The config("verbose_quit") value was restored to a default
value of FALSE.
Added the cscript:
powerterm [base_limit] value
to write the value as the sum (or difference) of powers <= base_limit
where base_limit by default is 10000.
Applied a bug fix by Dr.D.J.Picton <dave at aps5.ph.bham.ac.uk>
to have help with no args print the default help file.
Renamed lavarand to LavaRnd.
Added rules to build a calc rpm.
All installed files are first formed as foo.new, and then moved
into place as foo via a atomic rename.
During installation, only files that are different are installed.
If the built file and the installed file are the same, no
installation is performed.
Calc has new default installation locations:
Makefile var old location new location
------------ ------------ ------------
TOPDIR /usr/local/lib <<no longer used>>
BINDIR /usr/local/bin /usr/bin
SHAREDIR <<not set>> /usr/share
INCDIR /usr/local/include /usr/include
LIBDIR /usr/local/lib/calc /usr/lib
CSHAREDIR <<not set>> /usr/share/calc
HELPDIR /usr/local/lib/calc/help /usr/share/calc/help
INCDIRCALC /usr/local/include/calc /usr/include/calc
CUSTOMLIBDIR /usr/local/lib/calc/custom /usr/share/calc/custom
CUSTOMHELPDIR /usr/local/lib/calc/help/custhelp /usr/share/calc/custhelp
CUSTOMINCDIR <<not set>> /usr/include/calc/custom
SCRIPTDIR /usr/local/bin/cscript /usr/bin/cscript
MANDIR <<not set>> /usr/share/man/man1
CATDIR <<not set>> <<not set>>
The Makefile variable ${TOPDIR} is no longer used. In some places
it has been replaced by a new Makefile variable ${SHAREDIR}. Some
of the old TOPDIR functionality has been replaced by ${CSHAREDIR}.
The install rules no longer remove old obsolete files. We assume
that these old files have long since vanished! :-)
Reduced the amount of output when doing a make all where nothing
needs to be made.
Reduced the amount of output when doing a make install where nothing
needs to be installed.
If you install using the new default locations, you can remove
old calc files installed in the old default location by doing:
make olduninstall
The following are the changes from calc version 2.11.5t2 to 2.11.5t2.1:
Fixed a bug, reported by Ernest Bowen <ernie at turing dot
une dot edu dot au> that caused command lines to be echoed in
interactive mode. Fixed a bug that sometimes left the terminal
in a non-echoing state when calc exited.
Renamed error codes E_FGETWORD1 and E_FGETWORD2 symbols to
E_FGETFIELD1 and E_FGETFIELD2.
Made a minor format change to the top of the calc man page.
The findid() function in file.c 2nd argument changed. The argument
is now mostly a writable flag. This function now finds the file
I/O structure for the specified file id, and verifies that
it is opened in the required manner (0 for reading or 1 for writing).
If the 2nd argument is -1, then no open checks are made at all and
NULL is then returned if the id represents a closed file.
The calc builtin function, fopen(), now allows one to specify
opening files in binary modes. On POSIX / Linux / Un*x-like systems,
text file is the same as a binary file and so 'b' to an fopen has
no effect and is ignored. However on systems such as MS Windows
the 'b' / binary mode has meaning. See 'help fopen' for details.
On systems (such as MS Windows), calc will produce a different error
message when it attempts to open /dev/tty. This will condition
will occur in things like calc scripts when they switch from ``batch
processing'' commands from and want to start interactive mode.
Regression tests fopen in binary mode in a few places where a
difference between text and binary string lengths matter.
The intfile calc resource file also uses binary mode.
Changed the rand() builtin and its related functions srand() and
randbit() to use the Subtractive 100 generator instead of the
additive 55 generator. This generator as improved random properties.
As a result, of this change, the values produced by rand(),
rand() and randbit() are now different.
Updated regression tests for new rand() and randbit() output.
Applied a bug fix from Ernest Bowen <ernie at turing dot une dot
edu dot au> dealing with one-line "static" declaration like:
static a = 1, b;
Added regression test 8310 to test for the static bug fix.
The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
Fixed a compile problem with Linux 2.4 / Debian. Thanks goes
to Martin Buck <m at rtin-buck dot de> for help with this issue.
Fixed a bug in how L64_FORMAT (it determined if "%ld" or "%lld"
is appropriate for printing of 64 bit long longs) was determined.
Thanks goes to Martin Buck <m at rtin-buck dot de> for reporting
this bug and testing the fix.
An effort was made to make calc easier to build under Windows
using the Cygwin project (http://sources.redhat.com/cygwin/).
Thanks to the work of Thomas Jones-Low (tjoneslo at softstart
dot com), a number of #if defined(_WIN32)'s have been added
to calc source. These changes should not effect Windows
free system such as GNU/Linux, Solaris, POSIX-like, etc ...
Added windll.h to deal with Windows related DLL issues.
Using the convention of 'extern DLL' instead of 'DLL extern'
to deal with symbols that export to or import from a DLL.
Added HAVE_MALLOC_H, HAVE_STDLIB_H, HAVE_STRING_H, HAVE_TIMES_H,
HAVE_SYS_TIMES_H, HAVE_TIME_H, HAVE_SYS_TIME_H, HAVE_UNISTD_H
and HAVE_URANDOM to the Makefile. If these symbols are empty,
then the Makefile looks for the appropriate system include file.
If they are YES, then the Makefile will assume they exist.
If they are NO, then the Makefile will assume they do not exist.
Changed HAVE_URANDOM to match the empty, YES, NO values.
If HAVE_URANDOM is empty, then the Makefile will look for /dev/urandom.
If HAVE_URANDOM is YES, then the Makefile will assume /dev/urandom exists.
If HAVE_URANDOM is NO, then the Makefile will assume /dev/urandom does
not exist.
If TERMCONTROL is -DUSE_WIN32, then the Windows terminal control
(no TERMIOS, no TERMIO, no SGTTY) will be assumed.
Added a win32_hsrc Makefile rule to create hsrc files appropriate
for a Windows system using Cygwin gcc environment. Added win32.mkdef
which is used by the win32_hsrc rule to set the Windows specific
Makefile values to build hsrc files. The hsrc files are built
under the win32 directory.
Added FPOS_POS_BITS, OFF_T_BITS, DEV_BITS and INODE_BITS Makefile
symbols to allow one to force the size of a file position, file
offset, dev and inode value. Leaving these values blank will
Makefile to determine their size.
Fixed a bug in the way file offsets, device and inode values are copied.
Added chi.cal for a initial stab as a Chi^2 function. The chi_prob()
function does not work well with odd degrees of freedom, however.
Added big 3 to config("resource_debug"). Calc resource file scripts
check for config("resource_debug") & 8 prior to printing internal debug
statements. Thus by default they do not print them.
Added intfile.cal as a calc resource file script:
file2be(filename)
Read filename and return an integer that is built from the
octets in that file in Big Endian order. The first octets
of the file become the most significant bits of the integer.
file2le(filename)
Read filename and return an integer that is built from the
octets in that file in Little Endian order. The first octets
of the file become the most significant bits of the integer.
be2file(v, filename)
Write the absolute value of v into filename in Big Endian order.
The v argument must be on integer. The most significant bits
of the integer become the first octets of the file.
le2file(v, filename)
Write the absolute value of v into filename in Little Endian order.
The v argument must be on integer. The least significant bits
of the integer become the last octets of the file.
Added the following help aliases:
copy blkcpy
read command
write command
quit command
exit command
abort command
cd command
show command
Added the cscript:
fproduct filename term ...
to write the big Endian product of terms to a filename. Use - for stdout.
Fixed calc path in help/script.
Added read-only parameter, config("windows") to indicate if the system
is MS Windows WIN32 like system.
Configuration values that used to return "true" or "false" now return
1 (a true value) or 0 (a false value). Thus one can do:
if (config("tab")) { ... } else { ... }
The configuration values that now return 1 or 0 are:
config("tilde")
config("tab")
config("leadzero")
config("blkverbose")
config("verbose_quit")
config("windows")
Now shipping a win32 sub-directory that contains hsrc .h files
that have been attempted to be built for Windows.
The following are the changes from calc version 2.11.4t1 to 2.11.4t2:
Added missing test8600.cal test file.
Fixes cscript files to deal with the -S flag being replaced by
-f and possibly other flags.
Added regression tests for builtin functions bernoulli, catalan,
euler, freeeuler, and sleep. Added non-base 10 regression tests
for digit, digits and places.
The bernoulli.cal script now just calls the bernoulli() builtin
function. It remains for backward compatibility.
The Makefile now builds have_fpos_pos.h to determine if the
a non-scalar FILEPOS has a __pos structure element. If it does,
the FILEPOS_BITS is taken to be the size of just the __pos element.
Misc fixes related to non-scalar (e.g., structure) FILEPOS. Fixed
a compile problems where non-scalar FILEPOS were incorrectly assigned.
Fixed make depend rule.
Return an error on malloc / realloc failures for bernoulli and
euler functions.
Added MAKEFILE_REV make variable to help determine Makefile version.
Fixed the way the env rule reports Makefile values.
The following are the changes from calc version 2.11.3t0 to 2.11.4:
Increased the maximum number of args for functions from 100 to 1024.
Increased calc's internal evaluation stack from 1024 to 2048 args.
Added test8600.cal to the regression suite to test these new limits.
Updated and fixed misc typos in calc/README.
Clarified in the COPYING file that ALL calc source files, both
LGPL covered and exceptions to the LGPL files may be freely used
and distributed.
Added help files or updated for: bernoulli, calc_tty, catalan,
digit, digits, euler, freeeuler, places and sleep.
A collection of 18 patches from Ernest Bowen
<ernie at turing dot une dot edu dot au>:
(1) A new flag -f has been defined which has the effect of a read
command without the need to terminate the file name with a semicolon
or newline. Thus:
calc "read alpha; read beta;"
may be replaced by:
calc -f alpha -f beta
Quotations marks are recognized in a command like
calc -f 'alpha beta'
in which the name of the file to be read includes a space.
(2) Flags are interpreted even if they are in a string, as in:
calc "-q -i define f(x) = x^2;"
which has the effect of:
calc -q -i "define f(x) = x^2;"
To achieve this, the use of getopts() in calc.c has been dropped in
favor of direct reading of the arguments produced by the shell.
In effect, until a "--" or "-s" or a calc command (recognized
by not starting with '-') is encountered, the quotation signs in
command lines like the above example are ignored. Dropping getopts()
permits calc to specify completely the syntax rules calc will apply
to whatever it is given by the shell being used.
(3) For executable script (also called interpreter) files with first
line starting with "#!", the starting of options with -S has been
replaced by ending the options with -f. For example, the first line:
#! full_pathname_for_calc -S -q -i
is to be replaced by:
#! full_pathname_for_calc -q -i -f
Thus, if the pathname is /usr/bin/calc and myfile contains:
#!/usr/bin/calc -q -i -f
global deg = pi()/180;
define Sin(x) = sin(x * deg);
and has been made executable by:
chmod u+x myfile
myfile would be like a version of calc that ignored any startup
files and had an already defined global variable deg and a function
Sin(x) which will return an approximation to the sine of x degrees.
The invocation of myfile may be followed by other options (since
the first line in the script has only flagged options) and/or calc
commands as in:
./myfile -c read alpha '; define f(x) = Sin(x)^2'
(The quotation marks avoid shell interpretation of the semicolon and
parentheses.)
(4) The old -S syntax for executable scripts implied the -s flag so that
arguments in an invocation like
./myfile alpha beta
are passed to calc; in this example argv(0) = 'alpha', argv(1) =
'beta'. This has been changed in two ways: an explicit -s is required
in the first line of the script and then the arguments passed in the
above example are argv(0) = 'myfile', argv(1) = 'alpha', argv(1) = 'beta'.
In an ordinary command line, "-s" indicates that the shell words
after the one in which "-s" occurred are to be passed as arguments
rather than commands or options. For example:
calc "-q -s A = 27;" alpha beta
invokes calc with the q-flag set, one command "A = 27;", and two arguments.
(5) Piping to calc may be followed by calc becoming interactive.
This should occur if there is no -p flag but -i is specified, e.g.:
cat beta | calc -i -f alpha
which will do essentially the same as:
calc -i -f alpha -f beta
(6) The read and help commands have been changed so that several
files may be referred to in succession by separating their names
by whitespace. For example:
; read alpha beta gamma;
does essentially the same as:
; read alpha; read beta; read gamma;
This is convenient for commands like:
calc read file?.cal
when file?.cal expands to something like file1.cal file2.cal file3.cal:
myfiles='alpha beta gamma'
calc read $myfiles
or for C-shell users:
set myfiles=(alpha beta gamma)
calc read $myfiles
(7) The -once option for read has been extended to -f. For example,
calc -f -once alpha
will ignore alpha if alpha has been read in the startup files. In a
multiple read statement, -once applies only to the next named file.
For example
; read -once alpha beta -once gamma;
will read alpha and gamma only if they have not already been read,
but in any case, will read beta.
(8) A fault in the programming for the cd command has been corrected
so that specifying a directory by a string constant will work. E.g:
; cd "my work"
should work if the current directory has a directory with name "my work".
(9) new functions bernoulli(n) and euler(n) have been defined to
return the Bernoulli number and the Euler number with index n.
After evaluation for an even positive n, this value and these for
smaller positive even n are stored in a table from which the values
can be reread when required. The memory used for the stored values
can be freed by calling the function freebernoulli() or freeeuler().
The function catalan(n) returns the catalan number with index n.
This is evaluated using essentially comb(2*n, n)/(n+1).
(10) A function sleep(n) has been defined which for positive n calls
the system function sleep(n) if n is an integer, usleep(n) for other
real n. This suspends operation for n seconds and returns the null
value except when n is integral and the sleep is interrupted by a
SIGINT, in which case the remaining number of seconds is returned.
(11) The effect of config("trace", 8) which displays opcodes of
functions as they are successfully defined has been restricted to
functions defined with explicit use of "define". Thus, it has been
deactivated for the ephemeral functions used for evaluation of calc
command lines or eval() functions.
(12) The functions digit(), digits(), places() have been extended to
admit an optional additional argument for an integral greater-than-one
base which defaults to 10. There is now no builtin limit on the
size of n in digit(x, n, b), for example, digit(1/7, -1e100) which
would not work before can now be handled.
(13) The function, digits(x), which returns the number of decimal
digits in the integer part of x has been changed so that if abs(x) <
1, it returns 0 rather than 1. This also now applies to digits(x,b).
(14) Some programming in value.c has been improved. In particular,
several occurrences of:
vres->v_type = v1->v_type;
...
if (v1->v_type < 0) {
copyvalue(v1, vres);
return;
}
have been replaced by code that achieves exactly the same result:
vres->v_type = v1->v_type;
...
if (v1->v_type < 0)
return;
(15) Some operations and functions involving null-valued arguments
have been changed so that they return null-value rather than "bad
argument-type" error-value. E.g. null() << 2 is now null-valued
rather than a "bad argument for <<" error-value.
(16) "global" and "local" may now be used in expressions. For example:
; for (local i = 0; i < 5; i++) print i^2;
is now acceptable, as is:
; define f(x = global x) = (global x = x)^2;
which breaks wise programming rules and would probably better be handled
by something like:
; global x
; define f(t = x) = (x = t)^2;
Both definitions produce the same code for f. For non-null t, f(t)
returns t^2 and assigns the value of t to x; f() and f(t) with null t
return x^2.
Within expressions, "global" and "local" are to be followed by just one
identifier. In "(global a = 2, b)" the comma is a comma-operator; the
global variable a is created if necessary and assigned the value 2, the
variable b has to already exist. The statement "global a = 2, b" is
a declaration of global variables and creates both a and b if they
don't already exist.
(18) In a config object, several components have been changed from
long to LEN so that they will now be 32 bit integers for machines with
either 32 or 64-bit longs. In setting such components, the arguments
are now to less than 2^31. Before this change:
; config("mul2", 2^32 + 3)
would be accepted on a 64-bit machine but result in the same as:
; config("mul2", 3)
The following are the changes from calc version 2.11.2t0 to 2.11.2t1.0:
Fixed a bug whereby help files are not displayed correctly on
systems such as NetBSD 1.4.1. Thanks to a fix from Jakob Naumann.
Changed Email addresses to use asthe.com. Changed URLs to use
www.isthe.com. NOTE: The Email address uses 'asthe' and the web
site URL uses 'isthe'.
NOTE: calc-bugs Email address no longer in use
NOTE: calc-contrib Email address no longer in use
NOTE: calc-tester-request Email address no longer in use
Replaced explicit Email addresses found this file with the <user at
site dot domain> notation to reduce the potential for those folks
to be spammed.
The Makefile attempts to detect the existence of /dev/urandom with -e
instead of the less portable -c.
Misc Makefile fixes.
The following are the changes from calc version 2.11.1t3 to 2.11.1t4:
Removed non-portable strerror() tests (3715, 3724 and 3728) from
calc/regress.cal.
Fixed missing strdup() from func.c problem.
Fixed a problem that would have come up on a very long #! command line
if the system permitted it.
The following are the changes from calc version 2.11.1 to 2.11.1t2.2:
Placed calc under version 2.1 of the GNU Lesser General Public License.
The calc commands:
help copyright
help copying
help copying-lgpl
should display the generic calc copyright as well as the contents
of the COPYING and COPYING-LGPL files.
Those files contain information about the calc's GNU Lesser General
Public License, and in particular the conditions under which you
are allowed to change it and/or distribute copies of it.
Removed the lint facility from the Makefile. Eliminated Makefile
variables: ${LCFLAGS}, ${LINT}, ${LINTLIB} and ${LINTFLAGS}.
Removed the lint.sed file.
Cleaned up help display system. Help file lines that begin with
'##' are not displayed.
Calc source and documentation now uses these terms:
*.cal files calc resource file
*.a files calc binary link library
#! files calc shell script
Renamed 'help stdlib' to 'help resource'. The 'help stdlib' is
aliased to 'help resource' for arg compatibility.
Renamed config("lib_debug") to config("resource_debug").
The config("lib_debug") will have the same effect as
config("resource_debug") for backward compatibility.
Renamed the source sub-directory lib to cal. The default $CALCPATH
now uses ./cal:~/cal (instead of ./lib:~/lib). Changed LIB_PASSDOWN
Makefile variable to CAL_PASSDOWN.
Fixed misc compile warnings and bugs.
Fixed problem of incorrect paths in the formation of installed
calc shell scripts.
Changed the recommended Comqaq cc compile to be -std0 -fast -O4 -static.
Fixed a problem related to asking for help for a non-existent file.
Added ./.calcinit to the default calcrc.
Added cscript/README and help cscript to document the calc shell
script supplied with calc.
The following are the changes from calc version 2.11.0t10 to 2.11.0t11:
Misc code cleanup. Removed dead code. Removed trailing whitespace.
Fixed whitespace to make the best use of 8 character tabs.
Fixed some bugs relating to '// and %' in combination with some
of the rounding modes based on a patch from Ernest Bowen
<ernie at turing dot une dot edu dot au>.
A patch from Klaus Alexander Seistrup <klaus at seistrup dot dk>, when
used in combination with the GNU-readline facility, will prevent
it from saving empty lines.
Minor typos fixed in regress.cal
Added 8500 test series and test8500.cal to perform more extensive
tests on // and % with various rounding modes.
The 'unused value ignored' messages now start with Line 999: instead
of just 999:.
Fixed the long standing issue first reported by Saber-C in the
domul() function in zmil.c thanks to a patch by Ernest Bowen
<ernie at turing dot une dot edu dot au>.
Added zero dimensional matrices. A zero dimensional matrix is defined as:
mat A[] or A = mat[]
Updated the help/mat file to reflect the current status of matrices
including zero dimensional matrices.
Added indices() builtin function as written by Ernest Bowen <ernie
at turing dot une dot edu dot au> developed from an idea of Klaus
Seistrup <klaus at seistrup dot dk>. See help/indices for details.
Fixed a number of insure warnings as reported by Michel van der List
<vanderlistmj at sbphrd dot com>.
Fixed a number of help file typos discovered by Klaus Alexander
Seistrup <klaus at seistrup dot .dk>.
Removed REGRESS_CAL as a Makefile variable.
Added calcliblist and calcliblistfmt utility Makefile rules to allow
one to print the list of distribution files that are used (but not
built) to form either the libcalc.a or the libcustcalc.a library.
Added a patch from <Randall.Gray at marine dot csiro dot au> to make
^D terminate, but *only* if the line it is on is completely empty.
Removed lib/altbind and removed the CALCBINDINGS Makefile variable.
A new config("ctrl_d") value controls how the ``delete_char'', which
by default is bound to ^D (Control D), will or will not exit calc:
config("ctrl_d", "virgin_eof")
If ^D is the only character that has been typed on a line,
then calc will exit. Otherwise ^D will act according to the
calc binding, which by default is a Emacs-style delete-char.
This is the default mode.
config("ctrl_d", "never_eof")
The ^D never exits calc and only acts according calc binding,
which by default is a Emacs-style delete-char.
Emacs purists may want to set this in their ~/.calcrc startup file.
config("ctrl_d", "empty_eof")
The ^D always exits calc if typed on an empty line. This
condition occurs when ^D either the first character typed,
or when all other characters on the line have been removed
(say by deleting them).
Users who always want to exit when ^D is typed at the beginning
of a line may want to set this in their ~/.calcrc startup file.
Note that config("ctrl_d") apples to the character bound to each
and every ``delete_char''. So if an alternate binding it setup,
then those char(s) will have this functionality.
Updated help/config and help/mode, improved the readability and
fixed a few typos. Documented modes, block formats and block bases
("mode", "blkfmt" & "blkbase") that were previously left off out of
the documentation.
The config("blkbase") and config("blkfmt") values return strings
instead of returning integers. One cannot use integers to set
these values, so returning integers was useless.
Applied the dangling name fix from Ernest Bowen
<ernie at turing dot une dot edu dot au>.
Show func prints function on order of their indices, and with
config("lib_debug") & 4 == 4 some more details about the functions
are displayed.
Fixed another ``dangling name'' bug for when the object types list
exceeded 2000.
Fixed a bug related to opening to a calc session:
define res_add(a,b) = obj res {r} = {a.r + b.r};
...
obj res A = {1,2}. obj res B = {3,4}
A hash of an object takes into account the object type. If X and Y
are different kinds of objects but have the same component values,
they will probably return different rather than the same values for
hash(X) and hash(Y).
Added support for config("ctrl_d") to the GNU-readline interface
as written by Klaus Alexander Seistrup <klaus at seistrup dot dk>.
Currently, the config("ctrl_d", "virgin_eof") is not fully
supported. Under GNU-readline, it acts the same way as
config("ctrl_d", "empty_eof"). Emacs users may find this
objectionable as ``hi^A^D^D^D'' will cause calc to exit due to
the issuing of one too many ^D's.
Emacs users may want to put:
config("ctrl_d", "never_eof"),;
into their ~/.calcrc startup files to avoid this problem.
Made misc documentation fixes.
Fixed the make depend rule.
Applied Ernest Bowen's <ernie at turing dot une dot edu dot au>
complex function power(), exp() and transcendental function patch:
Calc will return a "too-large argument" error-value for exp(x,
epsilon) if re(x) >= 2^30 or if an estimate indicates that the
result will have absolute value greater than 2^2^30 * epsilon.
Otherwise the evaluation will be attempted but may fail due to
shortage of memory or may require a long runtime if the result
will be very large.
The power(a, b, epsilon) builtin will return a "too-large result"
if an estimate indicates that the result will have absolute value
that is > 2^2^30 * epsilon. Otherwise the evaluation will be
attempted but may fail due to shortage of memory or may require
a long runtime if the result will be very large.
Changes have been made to the algorithms used for some special
functions sinh(), cosh(), tanh(), sin(), cos(), etc., that make
use of exp(). In particular tanh(x) is now much faster and
doesn't run out of memory when x is very large - the value to
be returned is then 1 to a high degree of accuracy.
When the true value of a transcendental function is 1, as is
cos(x) for x == 0, calc's version of the function will now return
1 rather than the nearest multiple of epsilon. E.g. cos(0, 3/8)
no longer returns 9/8.
The restriction of abs(n) < 1000000 on scale(x, n) has been
removed. The only condition n now has to satisfy for calc to
attempt the operation is n < 2^31, the same as for calc to
attempt x << n and x^n.
Changed root(x,n) so that when x is negative and n is odd it
returns the principal complex n-th root of x rather than -1, e.g.
root(-1,3) now returns -.5+.8660...i.
Changed power(a,b) to permit a to be negative when b is real.
E.g. power(-2,3) will now return 8 rather than cause a "negative
base" error.
Fixed several improper free and link problems in the comfunc.c code.
Removed BOOL_B64 symbol from Makefile.
The following config values return "true" or "false" strings:
tilde tab leadzero fullzero blkverbose verbose_quit
These config values can still be set with same boolean strings
("on", "off", "true", "false", "t", ...) as well as via the
numerical values 0 (for "false") and non-0 (for "true"), however.
Added -s to the calc command line. The -s flag will cause unused
args (args after all of the -options on the command line) to remain
as unevaluated strings.
If calc is called with -s, then the new function argv() will return
the number of strings on the command line. Also argv(n) will return
the n-th such string or null is no such string exists.
Calc now handles calc shell scripts. A calc shell script is an
executable file that starts with:
#!/usr/local/bin/calc -S
Where ``/usr/local/bin/calc'' is the path to the calc binary.
Additional -options may be added to the line, but it MUST
start with -S. For example, the executable file ``plus''
contain the following:
#!/usr/local/bin/calc -S -e
/*
* This is a simple calc shell script to add two values
*/
print eval(argv(0)) + eval(argv(1));
then the following command:
./plus 23 'pi(1e-5)'
will print:
26.14159
If calc is called with -S as the first arg, then calc will assume that
it is being called from a #! calc shell script file. The -S implies
the -s flag. If -i is not given, -S also implies -d and -p.
Fixed the problem with non-literal string type checking for the
C printf-like functions. Able to determine if "%ld" or "%lld"
is appropriate for printing of 64 bit long longs by way of the C
symbol L64_FORMAT in the longlong.h header file.
The following lines are treated as comments by calc:
#! this is a comment
# this is a comment
# this is a comment
#
# The lone # above was also a comment
## is also a comment
Improved how calc makes changes to file descriptor interactive state.
Moved state changing code to calc_tty() and orig_tty() in lib_calc.c.
The libcalc_call_me_last() function will restore all changed descriptor
states that have not already been restored.
Added the following read-only config values:
config("program") path to calc program or calc shell script
config("basename") basename of config("program")
config("version") calc version string
The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5:
The config("verbose_quit") will control the printing of the message:
Quit or abort executed
when a non-interactive ABORT, QUIT or EXIT is encountered. By default,
config("verbose_quit") is TRUE and the message is printed. If one does:
config("verbose_quit", 0)
the message is disabled.
Added 8400 regression test set and test8400.cal to test the new
quit and config("verbose_quit") functionality.
Fixed the BigEndian BASEB==16 regression bugs by correctly swapping
16 bit HALFs in a 64 bit value (such as a 64 bit file pointer).
Added calclevel() builtin to calculation level at which it is called.
Added help/calclevel and help/inputlevel help files.
Removed regression tests 951 and 5984 so that the regress test will
run in non-interactively / without a TTY such as under Debian's
build daemon.
The eval(str) builtin will return an error-value rather than cause
an execution error str has a scan-error.
Declarations are permitted to end with EOF as well as a newline or ';'.
When prompt() occurs while reading a file, it will take input from
the terminal rather than taking it from a file. For example:
/* This demonstrates the use of prompt() and some other things */
config("verbose_quit", 0);
define getnumber() {
local x;
for (;;) {
x = eval(prompt(">>> "));
if (isnum(x))
return x;
print "Not a number! Try again";
}
}
print "This will display the sqrt of each number you enter";
print "Enter quit to stop";
for (;;) {
print sqrt(getnumber());
}
print "Good bye";
Comments entered at input terminal level may be spread over several
lines. For example:
/*
* Assume that this calc script is called: comment.cal
* Then these commands now work:
* cat comment.cal | calc
* calc < comment.cal
*/
print "Hello";
Added:
-D calc_debug[:lib_debug:[user_debug]]
to set the initial value of config("calc_debug"), config("lib_debug")
and config("user_debug").
The : separated strings of -D are interpreted as signed 32 bit values.
After an optional leading sign a leading zero indicates octal
conversion, and a leading ``0x'' or ``0X'' hexadecimal conversion.
Otherwise, decimal conversion is assumed.
Reordered the config structure moving calc_debug ahead of lib_debug.
Added bits 4 and 5 to config("calc_debug"):
4 Report on changes to the state of stdin as well as changes
to internal variables that control the setting and restoring
of stdin.
5 Report on changes to the run state of calc.
Fixed portability issue in seed.c relating to /dev/urandom and ustat.
Added a fix from Martin Buck <mb at netwings dot ch> to detect when
calc aborts early instead of completing the regression test.
Now 'make chk' will require the last line of calc output to
end in the string ``Ending regression tests''.
Added a patch from Martin Buck <mb at netwings dot ch> to allow use of
GNU-readline. Note that GNU-readline is not shipped with calc.
His patch only provides the hooks to use it. One must comment out:
USE_READLINE=
READLINE_LIB=
READLINE_INCLUDE=
and comment in:
USE_READLINE= -DUSE_READLINE
READLINE_LIB= -lreadline -lhistory
READLINE_INCLUDE= -I/usr/include/readline
in addition to pre-installing GNU-readline in your system to use
this facility.
Changed the "object already defined" math_error to a scanerror message.
Removed the limit on the number of object types.
Calc tarballs are now named calc-version.tar.gz and untar into
a sub-directory called calc-version.
Made a small change to declarations of static variables to reduce
the internal opcodes needed to declare them.
Fixed a permission problem on ranlib-ed *.a files that was reported
by Michael Somos <somos at grail dot cba dot csuohio dot edu>.
Added patch by Klaus Alexander Seistrup <klaus at seistrup dot dk>
related to GNU-readline:
+ enable calc specific bindings in ~/.inputrc
+ save a copy of your session to disk and reload them next
time you're using calc
+ only add a line to the history if it is different from
the previous line
Added the Makefile symbol HAVE_GETRUSAGE to determine if the
system supports the getrusage() system call.
Fixed the make depend code in the custom and sample Makefiles.
Fixed how the help/builtin file is formed. The help/Makefile is
now given the name of the native C compiler by the top level Makefile.
The include files are installed under INCDIRCALC (a new Makefile variable)
which by default is ${INCDIR}/calc. The INCDIR (also a new Makefile var)
by default is /usr/local/include. Include files previously installed
directly under ${LIBDIR} will be removed.
Added the piforever() function to lib/pi.cal. It was written by
Klaus Alexander Seistrup <klaus at seistrup dot dk> and was inspired by
an algorithm conceived by Lambert Meertens. (See also the ABC
Programmer's Handbook, by Geurts, Meertens & Pemberton, published
by Prentice-Hall (UK) Ltd., 1990.) The piforever() function prints
digits of pi for as long as your memory and system uptime allows. :-)
Fixed the URLs found throughout the source and documentation which did
not and in /, but should for performance and server load reasons.
Cleaned up and improved handling of "mat" and "obj". The comma in:
mat A[2], B[3];
is changed to whatever is appropriate in the context:
+ comma operator
+ separator of arguments in a function call
+ separator of arguments in a definition
etc.
The expression (mat A[2]), B[3] returns B[3], assuming B already
exists as something created by a statement like: global mat B[4].
What used to be done by the expression:
mat A[2], B[3]
will now require something like:
mat A[2], mat B[3] or A = mat[2], B = mat[3]
For example, if obj point and obj pair are known types, the
following is now allowed:
L = list(mat[2], mat[3], obj point, obj pair)
As another example, the following is allowed:
define f(a = mat[2] = {3,4}) = 5 * a;
as well as the following:
obj point {x,y}, PP = obj pair {A,B} = {obj point, obj point}
which creates two object types at compile time and when executed,
assigns a pair-object value to a variable PP.
Fixed a bug whereby a for loop would behave incorrectly. For example:
config("trace", 2),
global x;
define f() {for ( ; x > 0; x--) {print x;}}
x = 5, f()
will stop after printing 1 instead of looping forever.
Added values l_format, which when CHECK_L_FORMAT is defined ahead
of including longlong.h will help detect when a system can deal with
'long long' but not '%lld' in printf. If a system with 'long long'
uses '%ld' to print a 64 bit value, then l_format will be > 0;
otherwise if "%lld" is required, l_format will be < 0.
Added HAVE_STRDUP Makefile variable as well as the have_strdup.c
program that forms the have_strdup.h file. The have_strdup.h file
will define HAVE_STRDUP is the system has strdup(). If HAVE_STRDUP
is not defined, then calc will use calc_strdup() to simulate
the real strdup() function.
Calc no longer makes use of sys_errlist and sys_nerr. Some systems
no longer support these values (even though they should from a
legacy prospective). Calc now relies on the fact that strerror()
will return NULL of no such system error exists. System errors >=
10000 will be considered calc errors instead. The Makefile symbol
ERRNO_DECL has gone away as well as calc_errno.c and calc_errno.h.
System errors that are are not known to to the libc strerror()
function, will now print (via the strerror() calc builtin function)
something such as:
Unknown error 9999
Fixed some insure code inspection tool issues that were discovered
and investigated by Michel van der List <vanderlistmj at sbphrd dot com>.
Made an effort to ensure that the v_subtype of VALUES are initialized
to V_NOSUBTYPE through out the source code.
Established a separate calc-bugs address from the calc-tester
mailing list. Using anti-spam address forms in order to try and
stay under the radar of spammers as much as one can do so.
The following are the changes from calc version 2.11.0t8 to 2.11.0t8.9:
Moved 'wishlist' enhancements from the help/todo file to a new
help/wishlist file. Ordered, by priority, help/todo items into
Very High, High and Medium priority items.
The BUGS file now has a 'bugs' section as well as a 'mis-features'
section.
Improved how calc internally dealt with reading EOF or '\0' characters.
Calc now allows multiple defines to occur on the same line:
(Thanks goes to Ernest Bowen <ernie at turing dot une dot edu dot au>)
define f8300(x) = x^2; define g8300(x) = 1 - x;
Improved calc's ability to deal with and recover from errors.
Added inputlevel() builtin to return the input processing level.
In an interact mode, inputlevel() returns 0. When directly reading
a calc script, inputlevel() returns 1. When reading a script which
in turn reads another script, inputlevel() returns 2. etc...
If $CALCRC has more than one file as in file1:file2 and an error
occurs in file1, then calc -c will not read file2.
Fixed some of the old Email addresses found in calc documentation.
Added HAVE_USTAT, HAVE_GETSID, HAVE_GETPGID, HAVE_GETTIME, HAVE_GETPRID
and HAVE_URANDOM symbols to the Makefile. These symbols, along with
have_ustat.c, have_getsid.c, have_getpgid.c, have_gettime.c and
have_getprid.c form: have_ustat.h, have_getsid.h, have_getpgid.h,
have_gettime.h, have_getprid.h and have_urandom.h which in turn
are used by pseudo_seed() in seed.c to determine what types of
system services can be used to form a pseudo-random seed.
Fixed the way calc -c will continue processing $CALCRC when errors
are encountered. Unless -d is also given, calc -c will report
when calc is unable to open a $CALCRC file.
Fixed the lower level make depend rules.
Misc cleanup on the have_*.c support source files.
Misc source file cleanup for things such as } else { style consistency.
Fixed the basis for FNV-1 hashes. Prior to this fix, the hash()
builtin produced FNV hash values that did not match the FNV-1
algorithm as specified in:
http://www.isthe.com/chongo/tech/comp/fnv/index.html
Removed an unused argument in the function getbody() in codegen.c.
Encountering of EOF in getbody() will cause a scanerror rather then
stop activity. This will now result in a scanerror:
echo 'define f(x) { ' > myfile
calc -i read myfile
A '{' at the start of a command and a later matching '}' surrounding zero
or more statements (and possibly newlines) results in a function body to
be "evaluated". This permits another command to follow on the same
line as the '}' as in:
{display(5)} read something;
and:
{static a = 5} define f(x) = a + x;
String constants can now be concatenated. For example:
s = "curds" ' and ' "whey";
Added FNV hash to the regression test suite.
Added Ernest Bowen's <ernie at turing dot une dot edu dot au> fix for the
FNV regression test of the hash() builtin function.
Added Ernest Bowen's <ernie at turing dot une dot edu dot au> patch to
improve the way config("calc_debug"). Now the lower 4 bits of the
config("calc_debug") parameter have the following meaning:
n Meaning of bit n of config("calc_debug")
0 Outputs shell commands prior to execution.
1 Outputs currently active functions when a quit instruction
is executed.
2 Some details of shs, shs1 and md5 hash states are included
in the output when these are printed.
3 When a function constructs a block value, tests are
made that the result has the properties required for use of
that block, e.g. that the pointer to the start of the
block is not NULL, and that its "length" is not negative.
A failure will result in a runtime error.
Changed the meaning of (config("calc_debug") & 1) from only printing
the shell commands (and pausing) while displaying help files into
the printing of any shell command prior to execution.
Documented the meaning of config("lib_debug"):
n Meaning of bit n of config("lib_debug")
0 When a function is defined, redefined or undefined at
interactive level, a message saying what has been done
is displayed.
1 When a function is defined, redefined or undefined during
the reading of a file, a message saying what has been done
is displayed.
The value for config("lib_debug") in both oldstd and newstd is
3, but if calc is invoked with the -d flag, its initial value
is zero. Thus, if calc is started without the -d flag, until
config("lib_debug") is changed, a message will be output when a
function is defined either interactively or during the reading
of a file.
Changed the calc lib files to reflect the new config("lib_debug")
bit field meaning. Calc lib files that need to print extra information
should now do something such as:
if (config("lib_debug") & 3) {
print "obj xyz defined";
print "funcA([val1 [, val2]]) defined";
print "funcB(size, mass, ...) defined";
}
Fixed the help/custom_cal, help/new_custom, and help/copy files so
that they contain the correct contents instead of the 'usage' file.
Fixed problem with loss of bindings when calc -i args runs into
an error while processing 'args' and drops into interactive mode
without the terminal bindings being set.
Added patch from Ernest Bowen to establish the abort command as
well as to clarify the roles of quit and exit. See the help/command
file for details.
Updated to some extend, the help/statement and help/command help
files with new information about SHOW, QUIT, EXIT and ABORT.
Added show sizes to pzasusb8.cal.
Updated calc man page and help/usage file to reflect recent
command line changes.
Fixed a bug, reported by Michael Somos <somos at grail dot cba dot
csuohio dot edu>, which prevented calc -m from being used.
Fixed misc compiler warnings.
The following are the changes from calc version 2.11.0t7 to 2.11.0t7.5:
Calc has some new command line flags / command line meaning:
(Thanks goes to Ernest Bowen <ernie at turing dot une dot edu dot au>)
-i Go into interactive mode if possible.
-c Continue reading command lines even after an execution
error has caused the abandonment of a line
To understand the -i and -c effects, consider the following
file (call it myfile.cal) which has deliberate errors in it:
print 1;
mat A[1] = {2,3};
print 2;
epsilon(-1);
print 3;
calc read myfile
Reports an error on the 2nd line and exits; prints 1 only.
calc -c read myfile
Report errors on the 2nd and 4th lines and exits; prints 1,2 and 3.
calc -i read myfile
Report errors on the 2nd and gives you a prompt; prints 1 only.
calc -i -c read myfile
Report errors on the 2nd and 4th and gives you a prompt;
prints 1, 2 and 3.
cat myfile | calc
Reports an error on the 2nd line and exits; prints 1 only.
cat myfile | calc -c
Report errors on the 2nd and 4th lines and exits; prints 1,2 and 3.
Note that continuation refers to command lines, not to statements. So:
calc -c 'print "start"; mat A[1] = {2,3}; print "end";'
since it contains no newline, the whole string is compiled,
but execution is abandoned when the error is encountered and
the string ``end'' is not printed.
You can use your shell to supply newlines in your command line
arguments. For example in sh, ksh, bash:
calc -c 'print "start";
mat A[1] = {2,3};
print "end";'
will print both ``start'' and ``end''. C-shell users can do:
calc -c 'print "start"; \
mat A[1] = {2,3}; \
print "end";'
however sh, ksh, bash will not see ``end'' printed because their
shell will remove the internal newlines.
Added display(n) builtin which does almost the same as config("display",n)
except that rather than causing an execution with an out-of-range or
bad-type argument type, it simply writes a message to stderr. This
also now happens to the errmax() builtin.
Added qtime.cal to the standard calc library.
Added another command line flag to calc:
-d Disable display of the opening title and config("lib_debug",0)
The command:
calc 'read qtime; qtime(2)'
will output something like:
qtime(utc_hr_offset) defined
It's nearly ten past six.
whereas:
calc -d 'read qtime; qtime(2)'
will just say:
It's nearly ten past six.
A call of errmax(-1) will prevent errcount from aborting calc.
Add the function stoponerror(n) which, as the name implies, controls
if calc stop on an error based on the value of n:
n > 0 stop on error even if -c was given on the command line
n == 0 if -c, continue, without -c, stop
n < 0 continue on error, even if -c was given on the command line
Calc compilation now stops at the first scanerror.
Restored the feature where -p disables the printing of leading tabs
as of config("tab",0) had been executed. So using calc in a pipe:
calc -p 2+17 | whey
will write '19' instead of '\t19' to the whey command.
Updated calc man page and help/usage file to reflect recent
command line changes.
Converted start_done into a general calc run state enum called
run_state within the calc source.
Removed README.OLD.
Added the Makefile variable ${LCC} to invoke the local c compiler.
By default, ${CC} also run the ${LCC} compiler. The distinction is
useful when using something such as purify. In the case of ${LCC},
only the local C compiler is invoked. In the case of ${CC} a purify
compile is invoked. Only the source that must be compiled and run
on the local machine use ${LCC}; everything else uses ${CC}.
Fixed memory buffer related problem in eatstring() in token.c.
Fixed memory leaks related to putenv().
Fixed memory leaks related to srandom().
Fixed compilation warnings and problems on BSDI.
Removed ${CCMAIN} as a variable from the Makefile. Now files
use either ${CFLAGS} for general C source and ${ICFLAGS} for
intermediate C source (e.g., special code for building hsrc files).
The main calc URL is now:
http://www.isthe.com/chongo/tech/comp/calc/
Misc calc man page fixes.
The following are the changes from calc version 2.11.0t1 to 2.11.0t6.3:
Removed the makefile symbol MAIN. Now forcing all functions to correctly
be declared main. To satisfy some old broken compilers, a return 0;
(instead of an exit(0);) is used at the end of main().
A few of files that were added to calc used 4 character indentation
whereas most of calc uses 8 character indentation. These imported
sources have been changed to conform better with the calc style.
Added the program calc_errno.c and the Makefile symbol ERRNO_DECL.
If ERRNO_DECL is empty, calc_errno.c will try various ways to
declare errno, sys_errlist and sys_nerr. On success or when
it gives up, calc_errno will output the middle of the calc_errno.h
header file. If ERRNO_DECL is -DERRNO_NO_DECL, or -DERRNO_STD_DECL
or -DERRNO_OLD_DECL then the Makefile will build the middle
of the calc_errno.h header file without calc_errno.c's help.
The func.c file now includes the constructed header file calc_errno.h
to ensure that errno, sys_errlist and sys_nerr are declared correctly.
Changed check.awk to be more 'old awk' friendly.
Made some of the source a little more ++ friendly. We are NOT
porting calc to C++! We will NOT support C++ compilation of calc.
Calc will written ANSI C. We just compiled with a suggestion from
Love-Jensen, John <jlove-jensen at globalmt dot com> to make calc's version
of C a little more to C++ compilers. We are simply avoiding symbols
such as new or try for example.
Renamed README to README.OLD. Renamed README.FIRST to README.
Updated README, lib/README and BUGS to reflect new URLs and addresses.
Added a HOWTO.INSTALL file.
Reordered cc Makefile variable sets in the main Makefile.
Fixed a bug in hnrmod() and applied a fix that was reported by Ernest
Bowen <ernie at turing dot une dot edu dot au>. Added regression tests
1103 to 1112 to confirm the fix.
Fixed a bug in version.c related to MINOR_PATCHs in both the
empty and non-empty MINOR_PATCH cases.
Fixed malloc and bad storage issues reported by Michel van der List
<vanderlistmj at sbphrd dot com>.
Fixed some problems related to path processing while opening files.
Under extreme cases, an excessively long filename or CALCPATH value
could create problems. Placed guards in opensearchfile() function
in input.c to catch these cases.
Fixed cases were malloc failures were silently ignored in input.c.
Eliminated the PATHSIZE limit and the PATHSIZE symbol.
Added MAX_CALCRC to limit the length of the $CALCRC environment
variable to 1024 chars.
Fixed the magic number relating to the initial number of constants
declared by initconstants(). It is now related to the length
of the initnumbs[] NUMBER array.
Added a 'Dec Alpha / Compaq Tru64 cc (non-gnu) compiler set'
section to the main Makefile.
Fixed a string handling bug discovered by Dr.D.J.Picton
<dave at aps5 dot ph dot bham dot ac dot uk> in the custom demo code.
Fixed a bug in the hnrmod() builtin that was discovered by
Ernest Bowen <ernie at turing dot une dot edu dot au>.
Added FORCE_STDC symbol. When defined it will force __STDC__ like
conditions. Thus for compilers with as the Solaris cc compiler
that are ANSI-like but still define __STDC__ as 0, one can use
-DFORCE_STDC and make use of ANSI-like features.
Removed the CCSHS symbol from the Makefile. The shs.c and shs1.c
files are now compiled with full ${CFLAGS}.
The custom.c file is now compiled with full ${CFLAGS}.
Rewrote command line / argument processing code. Calc is now
using getopt(3) argument processing.
Fixed a memory leak related to converting strings to numbers
in the str2q() function in qio.c.
Fixed a problem with reading uninitialized memory in the
v_subtype of a VALUE in the copyvalue() function in value.c.
Fixed problems in func.c where temporary VALUEs were not
having their v_type elements initialized.
Fixed a memory leak in qpi() in qtrans.c.
Fixed a memory leak in math_getdivertedio() in zio.c.
Fixed a problem with points going beyond the end of allocated
memory in addstring() in string.c.
Fixed a memory leak in zgcdrem(), f_putenv(), zlog() and
zlog10() in zfunc.c.
Fixed a memory leak in zdiv() and zshift() in zmath.c.
Fixed memory leaks in zsrand() in zrand.c.
Fixed a memory leak in zsrandom1() in zrandom.c. Fixed memory
leaks associated with replacing the internal random state with
another random state.
Added seed() builtin to return a 64 bit seed for a
pseudo-random generator.
Added functionality from Ernest Bowen <ernie at turing dot une dot
edu dot au> to permit nested "= {...}" assignments for lists as well
as matrices and objects. Now one can have a list, matrix or object,
some of whose elements are lists, matrices or objects, to any depth
of recursion, and assign values to any number of particular elements
by an appropriate "initialization" expression. For example:
A = mat[2] = {list(1,2), list(3,4,list(5,6))};
and then assign values to the 6 number elements by:
A = {{7,8}, {9,10,{11,12}}};
Closed files that were previously left open from test4600.cal
as executed by regress.cal and from opening /dev/null by
regress.cal itself.
Fixed memory leaks from f_strprintf() and f_putenv() in func.c.
The regress.cal test suite calls freeredc(), freestatics() and
freeglobals() at the end of the test suite to free storage
consumed during the regression.
Added custom function custom("pzasusb8", n) and lib/pzasusb8.cal based on
Ernest Bowen's diagnostic patch.
Thanks to the efforts of Ernest Bowen <ernie at turing dot une dot
edu dot au> and Dr.D.J.Picton <dave at aps5 dot ph dot bham dot ac
dot uk>, a nasty endian-ness bug in the sha and sha1 hash functions
that showed up on machines such as the Sparc was fixed.
Added functionality from Ernest Bowen <ernie at turing dot une
dot edu dot au> to give arguments as well as function names after
definitions when config("lib_debug") >= 0.
Removed if (config("lib_debug") >= 0) { ... } the ends of most
of the calc library scripts because it was redundant with the
new config("lib_debug") >= 0 functionality. Some of the calc
library still has a partial section because some useful
additional information was being printed:
chrem.cal deg.cal lucas_tbl.cal randrun.cal
mfactor.cal mod.cal poly.cal seedrandom.cal
surd.cal varargs.cal
Fixed ellip.cal so that its defined function does not conflict with
the factor() builtin function.
Fixed mod.cal so that a defined function does not conflict with
the mod() builtin function.
The regression test suite now reads in most calc libs. A few
libs are not read because they, by design, produce output
when read even when config("lib_debug") is set to -1.
Increased the maximum number of object types that one can define
from 10 to 128.
Added a patch from Ernest Bowen <ernie at turing dot une dot edu
dot au> to correctly hash a V_STR value-type that has an \0 byte
inside it.
A patch from Ernest Bowen <ernie at turing dot une dot edu dot au> now
defines special meaning to the first 2 bits of config("lib_debug"):
bit 0 set => messages printed when input is from a terminal
bit 1 set => messages printed when reading from a file
The lib/regress.cal regression suite does:
config("lib_debug", -4);
to eliminate lib messages (both bit 0 and bit 1 are not set).
Fixed misc compile warnings and notices.
The following are the changes from calc version 2.10.3t5.38 to 2.11.0t0:
Fixed a few compile problems found under Red Hat 6.0 Linux.
The following are the changes from calc version 2.10.3t5.38 to 2.11.3t5.46:
Fixed a bug discovered by Ernest Bowen related to matrix-to-matrix copies.
Bitwise operations on integers have been extended so that negative
integers are treated in the same way as the integer types in C.
Some changes have been made to lib/regress.cal and lib/natnumset.cal.
Removed V_STRLITERAL and V_STRALLOC string type constants and
renumbered the V_protection types.
Added popcnt(x, bitval) builtin which counts the number of
bits in x that match bitval.
Misc compiler warning fixes.
Fixed improper use of putchar() and printf() when printing rationals
(inside qio.c).
Fixed previously reported bug in popcnt() in relation to . values.
Calc man page changes per suggestion from Martin Buck
<Martin-2.Buck at student dot uni-ulm dot de>. The calc man page is
edited with a few more parameters from the Makefile.
Misc Makefile changes per Martin Buck <Martin-2.Buck at student dot
uni-ulm dot de>.
Removed trailing blanks from files.
Consolidated in the Makefile, where the debug and check rules are found.
Fixed the regress.cal dependency list.
Make chk and check will exit with an error if check.awk detects
a problem in the regression output. (Martin Buck)
Fixed print line for test #4404.
Moved custom.c and custom.h to the upper level to fix unresolved symbols.
Moved help function processing into help.c.
Moved nearly everything into libcalc.a to allow programs access to
higher level calc objects (e.g., list, assoc, matrix, block, ...).
Renamed PATCH_LEVEL to MAJOR_PATCH and SUB_PATCH_LEVEL to MINOR_PATCH.
Added integers calc_major_ver, calc_minor_ver, calc_major_patch
and string calc_minor_patch to libcalc.a. Added CALC_TITLE to hold
the "C-style arbitrary precision calculator" string.
The function version(), now returns a malloced version string
without the title.
Consolidated multiple SGI IRIX -n32 sections (for r4k, r5k and r10k)
into a single section.
The following are the changes from calc version 2.10.3t5.34 to 2.10.3t5.37:
Per request from David I Bell, the README line:
I am allowing this calculator to be freely distributed for personal uses
to:
I am allowing this calculator to be freely distributed for your enjoyment
Added help files for:
address agd arrow dereference free freeglobals freeredc freestatics
gd isptr mattrace oldvalue saveval & * -> and .
Fixed blkcpy() and copy() arg order and processing. Now:
A = blk() = {1,2,3,4}
B = blk()
blkcpy(B,A)
blkcpy(B,A)
will result in B being twice as long as A.
Since "make chk" pipes the regression output to awk, we cannot
assume that stdout and stderr are ttys. Tests #5985 and #5986
have been removed for this reason. (thanks to Martin Buck
<Martin-2.Buck at student dot uni-ulm dot de> for this report)
Fixed the order of prints in regress.cal. By convention, a print
of a test line happens after the test. This is because function
parsed messages occur after the function is parsed. Also the
boolean test will verify before any print statements. Therefore
a non-test line is tested and printed as follows:
y = sha();
print '7125: y = sha()';
The perm(a,b) and comb(a,b) have been extended to arbitrary real a and
integer b.
Fixed a bug in minv().
Moved string.c into libcalc.a.
The NUMBER union was converted back into a flat structure. Changes
where 'num' and 'next' symbols were changed to avoid #define conflicts
were reverse since the #define's needed to support the union went away.
Removed trailing blanks from files.
Ernest Bowen <ernie at turing dot une dot edu dot au> sent in the
following patch which is described in the next 34 points:
(0) In the past:
A = B = strcat("abc", "def");
would store "abc" and "def" as literal strings never to be freed, and
store "abcdef" once each for both A and B. Now the "abc" and "bcd"
are freed immediately after they are concatenated and "abcdef" is stored
only once, just as the number 47 would be stored only once for
A = B = 47;
The new STRING structure that achieves this stores not only the
address of the first character in the string, but also the "length"
with which the string was created, the current "links" count, and
when links == 0 (which indicates the string has been freed) the
address of the next freed STRING. Except for the null string "",
all string values are "allocated"; the concept of literal string
remains for names of variables, object types and elements, etc.
(1) strings may now include '\0', as in A = "abc\0def". In normal printing
this prints as "abc" and strlen(A) returns 3, but its "real" length
of 7 is given by size(A). (As before there is an 8th zero character
and sizeof(A) returns 8.)
(2) If A is an lvalue whose current value is a string of size n, then
for 0 <= i < n, A[i] returns the character with index i as an addressed
octet using the same structure as for blocks, i.e. there is no
distinction between a string-octet and a block-octet. The same
operations and functions can be used for both, and as before, an octet
is in some respects a number in [0,256) and in others a one-character
string. For example, for A = "abc\0def" one will have both A[0] == "a"
and A[0] == 97. Assignments to octets can be used to change
characters in the string, e.g. A[0] = "A", A[1] = 0, A[2] -= 32,
A[3] = " " will change the above A to "A\0C def".
(3) "show strings" now displays the indices, links, length, and some or all
of the early and late characters in all unfreed strings which are values
of lvalues or occur as "constants" in function definitions,
using "\n", "\t", "\0", "\252", etc. when appropriate. For example,
the string A in (1) would be displayed as in the definition there.
Only one line is used for each string. I've also changed the
analogous "show numbers" so that only some digits of numbers that
would require more than one line are displayed.
(4) "show literals" is analogous to "show constants" for number "constants"
in that it displays only the strings that have been introduced by
literal strings as in A = "abc". There is a major difference between
strings and numbers in that there are operations by which characters
in any string may be changed. For example, after A = "abc",
A[0] = "X" changes A to "Xbc". It follows that if a literal string
is to be constant in the sense of never changing, such a character-
changing operation should never be applied to that string.
In this connection, it should be noted that if B is string-valued, then
A = B
results in A referring to exactly the same string as B rather than to
a copy of what is in B. This is like the use of character-pointers in
C, as in
char *s1, *s2;
s1 = "abc";
s2 = s1;
To achieve the effect of
s2 = (char *) malloc(4);
strcpy(s2, s1);
I have extended the str() function to accept a string as argument. Then
A = str(B);
will create a new string at a different location from that of B but
with the same length and characters. One will then have A == B,
*A == *B, but &*A != &*B, &A[0] != &B[0].
To assist in analyzing this sort of thing, I have defined a links()
function which for number or string valued argument returns the number
of links to the occurrence of that argument that is being referred to.
For example, supposing "abc" has not been used earlier:
; A = "abc"
; links(A)
2
; links(A)
1
The two links in the first call are to A and the current "oldvalue";
in the second call, the only link is to A, the oldvalue now being 2.
(5) strcat(S1, S2, ...) works as before; contribution of a string stops when
'\0' is encountered. E.g.
strcat("abc\0def", "ghi")
will return "abcghi".
(6) For concatenation of full strings I have chosen to follow
some other languages (like Java, but not Mathematica which uses "<>")
and use "+" so that, e.g.
"abc\0def" + "ghi"
returns the string "abc\0defghi". This immediately gives obvious
meanings to multiplication by positive integers as in
2 * "abc" = "abc" + "abc" = "abcabc",
to negation to reverse as string as in
- "abc" = "cba",
to multiplication by fractions as in
0.5 * "abcd" = "ab",
(where the length is int(0.5 * size("abcd")), and finally, by combining
these to
k * A and A * k
for any real number k and any string A. In the case of k == 1, these
return a new string rather than A itself. (This differs from
"" + A and A + "" which return A.)
(7) char(x) has been changed so that it will accept any integer x or octet
as argument and return a string of size one with character value
x % 256. In the past calc has required 0 <= x < 256; now negative
x is acceptable; for example, 1000 * char(-1) will now produce the
same as 1000 * "\377" or 1000 * "\xff".
(8) For a string s, test(s) now returns zero not only for the null string
"" but also for a string all of whose characters are '\0'.
(9) Similarly <, <=, etc. now compare all characters including occurrences
of '\0' until a difference is encountered or the end of a string is
reached. If no difference is encountered but one string is longer than
the other, the longer string is considered as greater even if the
remaining characters are all '\0'.
(10) To retain the C sense of comparison of null-terminated strings I have
defined strcmp(S1, S2), and then, for completeness, strncmp(S1, S2, n).
For similar reasons, strcpy(S1, S2) and strncpy(S1, S2, n) have been
defined.
(11) For strings, I have defined | and & as bitwise "or" and "and"
functions, with S1 | S2 having the size of the larger of S1 and S2,
S1 & S2 having the size of the smaller of S1 and S2. By using, say,
4-character strings, one can simulate a C integral type so far as the
| and & operations are concerned. It then seemed appropriate to
use the operator ~ for a "bitwise complement" as in C. Thus I have
defined ~s for a string s to be the string of the same size as s
with each character being complemented by the C ~ operation.
(12) For boolean algebra work on strings it is convenient also to have
the bitwise xor and setminus binary operations. Using C's '^' for xor
would be confusing when this is used elsewhere for powers, so I
decided to use ~. For setminus, I adopted the commonly used '\'.
Strings of fixed size n can now be used for a boolean algebra
structure with 8 * n elements. The zero element is n * char(0),
the unity is n * char(-1), and one have all of the usual laws like
A & (B | C) == A & B | A * C, A \ B = A & ~B, etc.
(13) Having extended the bitwise operations for strings, it was appropriate
to do the same for integers. Definitions of the binary ~ and \
operations for non-negative integers are straightforward. For
the unary ~ operation, I decided to do what C does with integer
types, and defined ~N to be -N - 1. With the appropriate extensions of
|, &, \ and the binary ~, one gets in effect the boolean algebra of
finite sets of natural numbers and their complements, by identifying
the set with distinct integer elements i_1, i_2, ... with the integer
2^i_1 + 2^i_2 + ...
For ~N for non-integer real N, I have simply used -N. There is some
logic in this and it is certainly better than an error value.
I have not defined the binary operations |, &, ~, \ for non-integral
arguments.
The use of ~N in this way conflicts with calc's method of displaying
a number when it has to be rounded to config("display") decimals.
To resolve this, my preference would be to replace the printing of
"~" as a prefix by a trailing ellipsis "...", the rounding always
being towards zero. E.g. with config("display", 5), 1/7 would print
as ".14285..." rather than "~.14285". The config("outround")
parameter would determine the type of rounding only for the
equivalent of config("tilde", 0).
(14) For objects, users may create their own definitions for binary |,
&, ~ and \ with xx_or, xx_and, xx_xor, xx_setminus functions.
For unary ~ and \ operations, I have used the names xx_comp and
xx_backslash.
(15) For the obviously useful feature corresponding to cardinality of a
set, I have defined #S for a string S to be the number of nonzero bits
in S. For a degree of consistency, it was then appropriate to
define #N for a nonnegative integer N to be the number of nonzero bits
in the binary representation of N. I've extended this to arbitrary
real N by using in effect #(abs(num(N))). I feel it is better to make
this available to users rather than having #N invoke an error message
or return an error value. For defining #X for an xx-object X, I
have used the name xx_content to suggest that it is appropriate for
something which has the sense of a content (like number of members of,
area, etc.).
(16) Having recognized # as a token, it seemed appropriate to permit its
use for a binary operation. For real numbers x and y I have defined
x # y to be abs(x - y). (This is often symbolized by x ~ y, but it
would be confusing to have x ~ y meaning xor(x,y) for strings and
abs(x-y) for numbers.) Because '#' is commonly called the hash symbol,
I have used xx_hashop to permit definition of x # y for xx-objects.
(17) For a similar reason I've added one line of code to codegen.c so that
/A returns the inverse of A.
(18) Also for a list L, +L now returns the sum of the elements of L. For
an xx object A, +A requires and uses the definition of xx_plus.
(19) I have given the unary operators ~, #, /, \, and except at the
beginning of an expression + and -, the same precedence with
right-to-left associativity. This precedence is now weaker than
unary * and &, but stronger than binary & and the shift and power
operators. One difference from before is that now
a ^ - b ^ c
evaluates as a ^ (- (b ^ c)) rather than a ^ ((- b) ^ c).
(20) For octets o1, o2, I've defined o1 | o2, o1 & o2, o1 ~ o2, ~o1 so
that they return 1-character strings. #o for an octet o returns the
number of nonzero bits in o.
(21) For substrings I've left substr() essentially as before, but
for consistency with the normal block/matrix indexing, I've extended
the segment function to accept a string as first argument. Then
segment(A, m, n)
returns essentially the string formed from the character with index m
to the character with index n, ignoring indices < 0 and indices >=
len(A); thus, if m and n are both in [0, size(A))
the string is of length abs(m - n) + 1, the order of the characters
being reversed if n < m. Here the indices for a list of size len are
0, 1, ..., len - 1. As it makes some sense, if 0 <= n < size(A),
segment(A, n)
now returns the one-character string with its character being that with
index n in A. (I've made a corresponding modification to the segment
function for lists.) Some examples, if A = "abcdef",
segment(A,2,4) = "cde",
segment(A,4,2) = "edc",
segment(A,3) = "d",
segment(A, -2, 8) = "abcdef",
segment(A,7,8) = "".
(22) As essentially particular cases of segment(), I've defined
head(A, n) and tail(A, n) to be the strings formed by the first
or last abs(n) characters of A, the strings being4]5O~? reversed '
if n is negative. I've changed the definitions of head and tail for
lists to be consistent with this interpretation of negative n.
(23) Similarly I've left strpos essentially as at present, but search
and rsearch have been extended to strings. For example,
search(A, B, m, n)
returns the index i of the first occurrence of the string B in A
if m <= i < n, or the null value if there is no such occurrence.
As for other uses of search, negative m is interpreted as
size(A) + m, negative n as size(A) + n. For a match in this
search, all size(B) characters, including occurrences of '\0',
in B must match successive characters in A.
The function rsearch() behaves similarly but searches in reverse order
of the indices.
(24) A string A of length N determines in obvious ways arrays of M = 8 * N
bits. If the characters in increasing index order are c_0, c_1, ...
and the bits in increasing order in c_i are b_j, b_j+1, ..., b_j+7
where j = 8 * i, I've taken the array of bits determined by A to be
b_0, b_1, ..., b_M-1
For example, since "a" = char(97) and 97 = 0b01100001, and
"b" = char(98) = 0b01100010, the string "ab" determines the 16-bit
array
1000011001000110
in which the bits in the binary representations of "a" and "b" have
been reversed.
bit with index n in this array. This is consistent with the use of
bit for a number ch in [0,256), i.e. bit(char(ch), n) = bit(ch, n).
For n < 0 or n >= size(A), bit(A,n) returns the null value.
(25) For assigning values to specified bits in a string, I've defined
setbit(A, n) and setbit(A, n, v). The first assigns the value 1 to
bit(A, n), the second assigns test(v) to bit(A, n).
(26) For consistency with the corresponding number operations, the shift
operations A << n and A >> n have been defined to give what look
like right- and left-shifts, respectively. For example, "ab" << 2
returns the 16-bit array
0010000110010001
in which the array for "ab" has been moved 2 bits to the right.
(27) To achieve much the same as the C strcpy and strncpy functions for
null-terminated strings, strcpy(S1, S2) and strncpy(S1, S2, n) have
been defined. Unlike the blkcpy() and copy() functions, the copying
for these is only from the beginning of the strings. Also, unlike C,
no memory overflow can occur as the copying ceases when size(S1) is
reached. Note that these overwrite the content of S1 (which affects
all strings linked to it) as well as returning S1. Examples:
S = strcpy(6 * "x", "abc") <=> S = "abc\0xx"
S = strcpy(3 * "x", "abcdef") <=> S = "abc"
S = strncpy(6 * "x", "abcd", 2) <=> S = "ab\0xxx"
S = strncpy(6 * "x", "ab", 4) <=> S = "ab\0\0xx"
S = strncpy(6 * "x", "ab", 20) <=> S = "ab\0\0\0\0"
If a new string S not linked to S1 is to be created, this can be
achieved by using str(S1) in place of S1. For example, the strcpy in
A = "xxxxxx"
S = strcpy(str("xxxxxx"), "abc")
would not change the value of A.
(28) I've extended the definitions of copy(A, B, ssi, num, dsi) and
blkcpy(B, A, num, ssi, dsi) to allow for string-to-string copying
and block-to-string copying, but num is now an upper bound for the
number of characters to be copied - copying will cease before num
characters are copied if the end of the data in the source A or the
end of the destination B is reached. As with other character-changing
operations, copying to a string B will not change the locations of
B[0], B[1], ... or the size of B.
In the case of copying a string to itself, characters are copied in
order of increasing index, which is different from block-to-block
copying where a memmove is used. This affects only copy from a
string to itself. For example,
A = "abcdefg";
copy(A, A, , , 2);
will result in A == "abababa". If the overwriting that occurs here
is not wanted, one may use
A = "abcdefg";
copy(str(A), A, , , 2);
which results in A == "ababcde".
(29) perm(a,b) and comb(a,b) have been extended to accept any real a and
any integer b except for perm(a, b) with integer a such that b <= a < 0
which gives a "division by zero" error. For positive b, both functions
are polynomials in a of degree b; for negative b, perm(a,b) is a
rational function (1/((a + 1) * (a+2) ...) with abs(b) factors in the
denominator), and comb(a,b) = 0. (An obvious "todo" is to extend this
to complex or other types of a.)
(30) Although it is not illegal, it seems pointless to use a comma operator
with a constant or simple variable as in
; 2 * 3,14159
14159
; a = 4; b = 5;
; A = (a , b + 2);
; A
7
I have added a few lines to addop.c so that when this occurs a
"unused value ignored" message and the relevant line number are
displayed. I have found this useful as I occasionally type ','
when I mean '.'.
There may be one or two other changes resulting from the way I have
rewritten the optimization code in addop.c. I think there was a bug
that assumed that PTR_SIZE would be the same as sizeof(long). By
the way, the new OP_STRING is now of index rather than pointer type.
It follows that pointers are now used in opcodes only for global
variables. By introducing a table of addresses of global variables
like those used for "constants" and "literal strings", the use of
pointers in opcodes could be eliminated.
(31) When calc has executed a quit (or exit) statement in a function or
eval evaluation, it has invoked a call to math_error() which causes
a long jump to an initial state without freeing any data on the
stack, etc. Maybe more detail should be added to math_error(), but
to achieve the freeing of memory for a quit statement and at the same
time give more information about its occurrence I have changed the
way opcodes.c handles OP_QUIT. Now it should free the local variables
and whatever is on the stack, and display the name and line-number,
for each of the functions currently being evaluated. The last
function listed should be the "top-level" one with name "*".
Strings being eval-ed will have name "**".
Here is a demo:
; global a;
;
; define f(x) {local i = x^2; a++;
;; if (x > 5) quit "Too large!"; return i;}
f() defined
; define g(x) = f(x) + f(2*x);
g() defined
; g(2)
20
; g(3)
Too large!
"f": line 3
"g": line 0
"*": line 6
; eval("g(3)")
Too large!
"f": line 3
"g": line 0
"**": line 1
"*": line 7
; a
6
(32) I've made several small changes like removing
if (vp->v_type == V_NUM) {
q = qinv(vp->v_num);
if (stack->v_type == V_NUM)
qfree(stack->v_num);
stack->v_num = q;
stack->v_type = V_NUM;
return;
}
from the definition of o_invert. Presumably these lines were intended
to speed up execution for the common case of numerical argument.
Comparing the runtimes with and without these lines for inverting
thousands of large random numbers in a matrix suggest that execution
for real numbers is slightly faster without these lines.
Maybe this and other similar treatment of "special cases" should be
looked at more closely.
(33) The new lib script lib/natnumset.cal demonstrates how the new
string operators and functions may be used for defining and
working with sets of natural numbers not exceeding a
user-specified bound.
The following are the changes from calc version 2.10.3t5.28 to 2.10.3t5.33:
Added hnrmod(v, h, n, r) builtin to compute:
v % (h * 2^n + r), h>0, n>0, r = -1, 0 or 1
Changed lucas.cal and mersenne.cal to make use of hnrmod().
A number of changes from Ernest Bowen:
(1) introduction of unary & and * analogous to those in C;
For an lvalue var, &var returns what I call a
value-pointer; this is a constant which may be assigned to
a variable as in p = &var, and then *p in expressions has
the same effect as var. Here is a simple example of their use:
; define s(L) {local v=0; while (size(L)) v+= *pop(L);return v;}
s() defined
; global a = 1, b = 2;
; L = list(&a, &b);
; print s(L)
3
; b = 3;
; print s(L)
4
Octet-pointers, number-pointers, and string-pointers in
much the same way, but have not attempted to do much with
the latter two.
To print a pointer, use the "%p" specifier.
Some arithmetic operations has been defined for corresponding
C operations. For example:
; A = mat[4];
; p = &A[0];
; *(p+2) == A[2]
; ++p
; *p == A[1]
There is at present no protection against "illegal" use of &
and *, e.g. if one attempts here to assign a value to *(p+5),
or to use p after assigning another value to A.
NOTE: Unlike C, in calc &A[0] and A are quite different things.
NOTE: If the current value of a variable X is an octet,
number or string, *X may be used to to return the value of
X; in effect X is an address and *X is the value at X.
Added isptr(p) builtin to return 0 is p is not a pointer,
and >0 if it is a pointer. The value of isptr(p) comes from
the V_XYZ #define (see the top of value.h) of the value to
which p points.
To allow & to be used as a C-like address operator, use of it
has been dropped in calls to user-defined functions. For the
time being I have replaced it by the back-quote `. For example:
; global a
; define f(a,b) = a = b
; f(&a,5)
; print a
0
; f(`a,5)
; print a
5
However, one may use & in a similar way as in:
; define g(a,b) = *a = b
; g(&a, 7)
; print a
7
There is no hashvalue for pointers. Thus, like error values,
they cannot be used as indices in an association.
The -> also works in calc. For example:
; obj xy {x,y}
; obj uvw {u, v, w}
; obj xy A = {1,2}
; obj uvw B = {3,4,5}
; p = &A
; q = &B
; p->x
1
; p->y = 6
; A
obj xy {1, 6}
; q -> u
3
; p->y = q
; A
obj xy {1, v-ptr: 1400474c0}
; p->y->u
3
; p->y->u = 7
; B
obj uvw {7, 4, 5}
; p -> y = p
; A
obj xy {1, v-ptr: 140047490}
; p -> y -> x
1
; p->y->y
v-ptr: 140047490
; p->y->y-> x
1
; p->y->y->x = 8
; A
obj xy {8, v-ptr: 140047490}
(2) a method of "protecting" variables;
For the various kinds of "protection", of an l_value var,
bits of var->v_subtype, of which only bits 0 and 1 have been
used in the past to indicate literal and allocated strings.
This has meant initialization of var->v_subtype when a new var
is introduced, and for assignments, etc., examination of the
appropriate bits to confirm that the operation is to be permitted.
See help/protect for details.
(3) automatic "freeing" of constants that are no longer required.
For the "freeing" of constants, the definition of a NUMBER
structure so that a NUMBER * q could be regarded as a
pointing to a "freed number" if q->links = 0.
The old q->num was changed to a union q->nu which had a pointer
to the old q->num if q->links > 0 and to the next freed number
if q->links = 0. The old "num" is #defined to "nu->n_num".
The prior method calc has used for handling "constants" amounted
to leakage. After:
; define f(x) = 27 + x;
; a = 27;
It is of course necessary for the constant 27 to be stored, but
if one now redefines f and a by:
; define f(x) = 45 + x;
; a = 45;
There seems little point in retaining 27 as a constant and
therefore using up memory. If this example seems trivial,
replace 27 with a few larger numbers like 2e12345, or better,
-2e12345, for which calc needs memory for both 2e12345 and
-2e12345!
Constants are automatically freed a definition when a
function is re- or un-defined.
The qalloc(q) and qfree(q) functions have been changed so
that that q->links = 0 is permitted and indicates that q
has been freed. If a number has been introduced as a
constant, i.e. by a literal numeral as in the above
examples, its links becoming zero indicates that it is no
longer required and its position in the table of constants
becomes available for a later new constant.
(4) extension of transcendental functions like tan, tanh, etc.
to complex arguments
(5) definition of gd(z) and agd(z), i.e. the gudermannian and
inverse gudermannian
(6) introduction of show options for displaying information about
current constants, global variables, static variables, and cached
redc moduli.
To help you follow what is going on, the following show
items have been introduced:
show constants ==> display the currently stored constants
show numbers ==> display the currently stored numbers
show redcdata ==> display the currently stored redc moduli
show statics ==> display info about static variables
show real ==> display only real-valued variables
The constants are automatically initialized as constants and
should always appear, with links >= 1, in in the list of constants.
The show command:
show globals
has been redefined so that it gives information about all
current global and still active static variables.
(7) definition of functions for freeing globals, statics, redc values
To free memory used by different kinds of variable, the following
builtins have been added:
freeglobals(); /* free all globals */
freestatics(); /* free all statics */
freeredc(); /* free redc moduli */
free(a, b, ...); /* free specific variables */
NOTE: These functions do not "undefine" the variables, but
have the effect of assigning the null value to them, and so
frees the memory used for elements of a list, matrix or object.
See 10) below for info about "undefine *".
(8) enhancement of handling of "old value": having it return an
lvalue and giving option of disabling updating.
Now, by default, "." return an lvalue with the appropriate
value instead of copying the old value.
So that a string of commands may be given without changing
the "oldvalue", the new builtin:
saveval(0)
function simply disables the updating of the "." value.
The default updating can be resumed by calling:
saveval(1)
The "." value:
; 2 + 2
4
; .
4
can now be treated as an unnamed variable. For example:
; mat x[3,3]={1,2,3,4,5,6,7,8,9}
; x
; print .[1,2]
6
(9) for a list L defining L[i] to be same as L[[i]]
(10) extending undefine to permit its application to all user-defined
functions by using "undefine *".
The command:
undefine *
undefines all current user-defined functions. After
executing all the above freeing functions (and if
necessary free(.) to free the current "old value"), the
only remaining numbers as displayed by:
show numbers
should be those associated with epsilon(), and if it has been
called, qpi().
(11) storing the most recently calculated value of qpi(epsilon)i and
epsilon so that when called again with the same epsilon it
is copied rather than recalculated.
(12) defining trace() for square matrices
(13) expression in parentheses may now be followed by a qualifier
computable with its type
When an expression in parentheses evaluates to an lvalue
whose current value is a matrix, list or object, it may
now be followed by a qualifier compatible with its type.
For example:
; A = list(1,2,4);
; B = mat[2,2] = {5,6,7,8};
; define f(x) = (x ? A : B)[[1]];
; print f(1), f(0)
2 6
; obj xy {x,y}
; C = obj xy = {4,5}
; p = &C
; *p.x
Not indexing matrix or object
; (*p).x
4
(14) swap(a,b) now permits swapping of octets in the same or different
blocks.
For example:
; A = blk() = {1,2,3}
; B = blk() = {4,5,6}
; swap(A[0], B[2])
; A
chunksize = 256, maxsize = 256, datalen = 3
060203
A few bug fixes from Ernest Bowen:
B1: qcmpi(q, n) in qmath.c sometimes gave the wrong result if
LONG_BITS > BASEB, len = 1 and nf = 0, since it then
reduces to the value of (nf != q->num.v[1]) in which
q->num.v[1] is not part of the size-1 array of HALFs for
q->num. At present this is used only for changing opcodes
for ^2 and ^4 from sequences involving OP_POWER to
sequences using OP_SQUARE, which has no effect on the
results of calculations.
B2: in matdet(m) in matfunc.c, a copy of the matrix m was not freed
when the determinant turned out have zero value.
B3: in f_search() in func.c, a qlinking of the NUMBER * storing the
the size of a file was not qfreed.
B4: in comalloc() in commath.c the initial zero values for real and
imag parts are qlinked but not qfreed when nonzero values are
assigned to them. Rather than changing
the definition of comalloc(), I have included any relevant
qfrees with the calls to comalloc() as in
c = comalloc();
qfree(c->real);
c->real = ...
B5: in calls to matsum(), zeros are qlinked but not qfreed. Rather
than changing addnumeric(), I have changed the definition
of matsum(m) so that it simply adds the components of m,
which requires only that the relevant additions be defined,
not that all components of m be numbers.
Simple arithmetic expressions with literal numbers are evaluated
during compilation rather than execution. So:
define f(x) = 2 + 3 + x;
will be stored as if defined by:
define f(x) = 5 + x;
Fixed bug with lowhex2bin conversation in lib_util.c. It did not
correctly convert from hex ASCII to binary values due to a table
loading error.
Fixed porting problem for NetBSD and FreeBSD by renaming the
qdiv() function in qmath.c to qqdiv().
Improved the speed of mfactor (from mfactor.cal library) for
long Mersenne factorizations. The default reporting loop
is now 10000 cycles.
SGI Mips r10k compile set is specified for IRIX6.5 with v7.2
compilers. A note for pre-IRIX6.5 and/or pre-v7.2 compilers
is given in the compile set.
Added regression tests related to saveval(), dot and pointers.
The following are the changes from calc version 2.10.3t5.11 to 2.10.3t5.27:
The todo help file as been updated with the in-progress items:
xxx - block print function is not written yet ...
Expanded the role of blk() to produce unnamed blocks as in:
B = blk(len, chunk)
and named blocks as in:
B = blk(str, len, chunk)
A block may be changed (with possible loss of data only if len is less
than the old len) by:
C = blk(B, len, chunk)
For an unnamed block B, this creates a new block C and copies
min(len, oldlen) octets to it, B remaining unchanged. For a named
block, the block B is changed and C refers to the same block as B,
so that for example, C[i] = x will result in B[i] == x. Thus, for a
named block, "B = " does nothing (other than B = B) in:
B = blk(B, len, chunk)
but is necessary for changing an unnamed block.
Renamed rmblk() to blkfree().
The builtin function blkfree(val) will free memory allocated to block.
If val is a named block, or the name of a named block, or the
identifying index for a named block, blkfree(val) frees the
memory block allocated to this named block. The block remains
in existence with the same name, identifying index, and chunksize,
but its size and maxsize becomes zero and the pointer for the start
of its data block null.
The builtin function blocks() returns the number of blocks that
have been created but not freed by the blkfree() function. When called
as blocks(id) and the argument id less than the number of named
blocks that have been created, blocks(id) returns the named block
with identifying index id.
Removed the artificial limit of 20 named blocks.
Added name() builtin to return the name of a type of value
as a string.
Added isdefined() to determine of a value is defined.
Added isobjtype() to determine the type of an object.
The isatty(v) builtin will return 1 if v is a file that associated
with a tty (terminal, xterm, etc.) and 0 otherwise. The isatty(v)
builtin will no longer return an error if v is not a file or
is a closed file.
The isident(m) builtin will return 1 if m is a identity matrix
and 0 otherwise. The isident(m) builtin will no longer return an
error if m is not a matrix.
Added extensive testing of isxxx() builtins and their operations
on various types.
Added md5() builtin to perform the MD5 Message-Digest Algorithm.
Renamed isset() to bit().
Blocks will expand when required by the copy() builtin function:
; f = fopen("help/full", "r")
; B = blk()
; B
chunksize = 256, maxsize = 256, datalen = 0
; copy(B, f)
; B
chunksize = 256, maxsize = 310272, datalen = 310084
2a2a2a2a2a2a2a2a2a2a2a2a2a0a2a20696e74726f0a2a2a2a2a2a2a2a2a...
NOTE: Your results will differ because changes to help/full.
The blkcpy() builtin args now more closely match that
of memcpy(), strncpy:
blkcpy(dst, src [, num [, dsi [, ssi]]])
The copy() builtin args now more closely match that the cp command:
copy(src, dst [, num [, ssi [, dsi]]])
but otherwise does the same thing as blkcpy.
Fixed lint problems for SunOS.
Added have_memmv.c and HAVE_MEMMOVE Makefile variable to control
use of memmove(). If empty, then memmove() is tested for and if
not found, or if HAVE_MEMMOVE= -DHAVE_NO_MEMMOVE then an internal
version of memmove() is used instead.
Added regression tests for sha, sha1 and md5 builtin hash functions.
Added xx_print to to the list of object routines are definable.
Added xx_print.cal to the library to demo this feature.
Moved blkcpy() routines have been moved to blkcpy.[ch].
The blkcpy() & copy() builtins can not copy to/from numbers.
For purposes of the copy, only the numerator is ignored.
Resolved a number of missing symbols for libcalc users.
Added lib_util.{c,h} to the calc source to support users of
libcalc.a. These utility routines are not directly used by
calc but are otherwise have utility to those programmers who
directly use libcalc.a instead.
Added sample sub-directory. This sub-directory contains a few
sample programs that use libcalc.a. These sample programs are
built via the all rule because they will help check to see that
libcalc.a library does not contain external references that
cannot be resolved. At the current time none of these sample
programs are installed.
Added a libcalc_call_me_last() call to return storage created
by the libcalc_call_me_first() call. This allows users of libcalc.a
to free up a small amount of storage.
Fixed some memory leaks associated with the random() Blum generator.
Fixed fseek() file operations for SunOS.
Fixed convz2hex() fencepost error. It also removes leading 0's.
Plugged a memory leak relating to pmod. The following calculation:
pmod(2, x, something)
where x was not 2^n-1 would leak memory. This has been fixed.
The following are the changes from calc version 2.10.3t5.1 to 2.10.3t5.10:
Misc printf warning bug fixes.
Calc now permits chains of initializations as in:
obj point {x,y} P = {1,2} = {3,4} = {5,6}
Here the initializations are applied from left to right. It may
look silly, but the 1, 2, ... could be replaced by expressions with
side effects. As an example of its use suppose A and B are
expressions with side effects:
P = {A, B}
has the effect of P.x = A; P.y = B. Sometimes one might want these in
the reverse order: P.y = B; P.x = A. This is achieved by:
P = { , B} = {A}
Another example of its use:
obj point Q = {P, P} = {{1, 2}, {3, 4}}
which results in Q having Q.x.x = 1, Q.x.y = 2, etc.
The role of the comma in has been changed. Expressions such as:
mat A[2], B[3]
are equivalent to:
(mat A[2]), (mat B[3])
Now, expr1, expr2 returns type of expr2 rather than EXPR_RVALUE. This
permits expressions such as:
(a = 2, b) = 3
Also, expr1 ? expr2 : expr3 returns type(expr2) | type(expr3).
This will make the result an lvalue (i.e. EXPR_RVALUE bit not set)
For example, if both expr2 and expr3 are lvalues. Then:
a ? b : c = d
has the effect of b = d if a is "nonzero", otherwise c = d.
This may be compared with
d = a ? b : c
which does d = b if a is "nonzero", otherwise d = c.
And now, expr1 || expr2 and expr1 && expr2 each return
htype(expr1)| type(expr2). So for example:
a || b = c
has the effect of a = c if a is "nonzero", otherwise b = c.
And for example:
a && b = c
has the effect of a = c if a is "zero", otherwise b = c.
At top level, newlines are neglected between '(' and the matching
')' in expressions and function calls. For example, if f() has been
already defined, then:
a = (
2
+
f
(
3
)
)
and
b = sqrt (
20
,
1
)
will be accepted, and in interactive mode the continue-line prompt
will be displayed.
When calc sees a "for", "while", "do", or "switch", newlines will be
ignored (and the line-continuation prompt displayed in interactive mode)
until the expected conditions and statements are completed.
For example:
s = 0;
for (i = 0; i < 5; i++)
{
s += i;
}
print s;
Now 's' will print '10' instead of '5'.
Added more regression tests to regress.cal. Changed the error
counter from 'err' to 'prob'. The errmax() is set very high and
the expected value of errcount() is kept in ecnt.
Added the 'unexpected' help file which gives some unexpected
surprises that C programmers may encounter.
Updated the 'help', 'intro' and 'overview' to reflect the
full list of non-builtin function help files. Reordered the
'full' help file.
The blkalloc() builtin has been renamed blk().
Only a "fixed" type of BLOCK will be used. Other types of
blocks in the future will be different VALUE types.
Introduced an undefine command so that
undefine f, g, ...
frees the memory used to store code for user-defined functions f,
g, ..., effectively removing them from the list of defined
functions.
When working from a terminal or when config("lib_debug") > 0 advice
that a function has been defined, undefined, or redefined is
displayed in format "f() defined".
Some experimental changes to block and octet handling, so that after:
B = blk(N)
B[i] for 0 <= i < N behaves for some operations like an lvalue for
a USB8 in B.
xx_assign added to object functions to permit the possibility of
specifying what A = B will do if A is an xx-object. Normal
assignment use of = is restored by the command: undefine
xx_assign.
For error-value err, errno(err) returns the error-code for err and
stores this in calc_errno; error(err) returns err as if
error(errno(err)) were called.
Anticipating probable future use, names have been introduced for
the four characters @, #, $, `. This completes the coverage of
printable characters on a standard keyboard.
Added sha() builtin to perform the old Secure Hash Algorithm
(SHS FIPS Pub 180).
Added sha1() builtin to perform the new Secure Hash Standard-1
(SHS-1 FIPS Pub 180-1).
Added ${LD_DEBUG} Makefile variable to allow for additional
libraries to be compiled into calc ... for debugging purposes.
In most cases, LD_DEBUG= is sufficient.
Added ${CALC_ENV} makefile variable to allow for particular
environment variables to be supplied for make {check,chk,debug}.
In most cases, CALC_ENV= CALCPATH=./lib is sufficient.
Added ${CALC_LIBS} to list the libraries created and used to
build calc. The CALC_LIBS= custom/libcustcalc.a libcalc.a
is standard for everyone.
Improved how 'make calc' and 'make all' rules work with respect
to building .h files.
Added 'make run' to only run calc interactively with the
${CALC_ENV} calc environment. Added 'make cvd', 'make dbx'
and 'make gdb' rules to run debug calc with the respective
debugger with the ${CALC_ENV} calc environment.
Added cvmalloc_error() function to lib_calc.c as a hook for
users of the SGI Workshop malloc debugging library.
Cut down on places where *.h files include system files.
The *.c should do that instead where it is reasonable.
To avoid symbol conflicts, *.h files produced and shipped
with calc are enclosed that as similar to the following:
#if !defined(__CALC_H__)
#define __CALC_H__
..
#endif /* !__CALC_H__ */
Added memsize(x) builtin to print the best approximation of the
size of 'x' including overhead. The sizeof(x) builtin attempts
to cover just the storage of the value and not the overhead.
Because -1, 0 and 1 ZVALUES are static common values, sizeof(x)
ignores their storage. Also sizeof(x) ignores the denominator of
integers, and the imaginary parts of pure real numbers. Added
regression tests for memsize(), sizeof() and size().
The following are the changes from calc version 2.10.3t4.16 to 2.10.3t5.0:
The calc source now comes with a custom sub-directory which
contains the custom interface code. The main Makefile now
drives the building and installing of this code in a similar
way that it drives the lib and help sub-directories. (see below)
Made minor edits to most help files beginning with a thru e.
The errno(n) sets a C-like errno to the value n; errno() returns
the current errno value. The argument for strerror() and error()
defaults to this errno.
Added more error() and errno() regression tests.
The convention of using the global variable lib_debug at the
end of calc library scripts has been replaced with config("lib_debug").
The "lib_debug" is reserved by convention for calc library scripts.
This config parameter takes the place of the lib_debug global variable.
By convention, "lib_debug" has the following meanings:
<-1 no debug messages are printed though some internal
debug actions and information may be collected
-1 no debug messages are printed, no debug actions will be taken
0 only usage message regarding each important object are
printed at the time of the read (default)
>0 messages regarding each important object are
printed at the time of the read in addition
to other debug messages
The "calc_debug" is reserved by convention for internal calc routines.
The output of "calc_debug" will change from release to release.
Generally this value is used by calc wizards and by the regress.cal
routine (make check). By convention, "calc_debug" has the following
meanings:
<-1 reserved for future use
-1 no debug messages are printed, no debug actions will be taken
0 very little, if any debugging is performed (and then mostly
in alpha test code). The only output is as a result of
internal fatal errors (typically either math_error() or
exit() will be called). (default)
>0 a greater degree of debugging is performed and more
verbose messages are printed (regress.cal uses 1).
The "user_debug" is provided for use by users. Calc ignores this value
other than to set it to 0 by default (for both "oldstd" and "newstd").
No calc code or shipped library will change this value other than
during startup or during a config("all", xyz) call.
The following is suggested as a convention for use of "user_debug".
These are only suggestions: feel free to use it as you like:
<-1 no debug messages are printed though some internal
debug actions and information may be collected
-1 no debug messages are printed, no debug actions will be taken
0 very little, if any debugging is performed. The only output
are from fatal errors. (default)
>0 a greater degree of debugging is performed and more
verbose messages are printed
Added more code related to the BLOCK type.
Added blkalloc() builtin.
Split NAMETYPE definition out into nametype.h.
Added OCTET type for use in processing block[i].
Added free, copy, cmp, quickhash and print functions for
HASH, BLOCK and OCTET.
Added notes to config.h about what needs to be looked at when
new configuration items are added.
The null() builtin now takes arguments.
Given the following:
obj point {x,y}
obj point P, Q
will will now create P and Q as obj point objects.
Added xx_or, xx_and, xx_not and xx_fact objfuncs.
Added the custom() builtin function. The custom() builtin
interface is designed to make it easier for local custom
modification to be added to calc. Custom functions are
non-standard or non-portable code. For these reasons, one must can
only execute custom() code by way of an explicit action.
By default, custom() returns an error. A new calc command line
option of '-C' is required (as well as ALLOW_CUSTOM= -DCUSTOM
Makefile variable set) to enable it.
Added -C as a calc command line option. This permits the
custom() interface to be used.
Added ALLOW_CUSTOM Makefile variable to permanently disable
or selective enable the custom builtin interface.
The rm() builtin now takes multiple filenames. If the first
arg is "-f", then 'no-such-file' errors are ignored.
Added errcount([count]) builtin to return or set the error
counter. Added errmax([limit]) to return or set the error
count limiter.
Added -n as a calc command line option. This has the effect
of calling config("all", "newstd") at startup time.
Added -e as a calc command line option to ignore all environment
variables at startup time. The getenv() builtin function will
still return values, however.
Added -i as a calc command line option. This has the effect
ignoring when errcount() exceeds errmax().
Changed the config("maxerr") name to config("maxscan"). The
old name of "maxerr" is kept for backward compatibility.
Using an unknown -flag on the calc command like will
generate a short usage message.
Doing a 'help calc' displays the same info as 'help usage'.
The 'make check' rule now uses the -i calc command line flag
so that regress.cal can continue beyond when errcount exceeds
errmax. In regress.cal, vrfy() reports when errcount exceeds
errmax and resets errmax to match errcount. This check
and report is independent of the test success of failure.
Fixed missing or out of order tests in regress.cal.
Misc Makefile cleanup in lib/Makefile and help/Makefile.
The default errmax() value on startup is now 20.
The custom() interface is now complete. See help/custom and
custom/HOW_TO_ADD files, which show up as the custom and new_custom
help files, for more information.
The help command will search ${LIBDIR}/custhelp if it fails to find
a file in ${LIBDIR}. This allows the help command to also print
help for a custom function. However if a standard help file and a
custom help file share the same name, help will only print the
standard help file. One can skip the standard help file and print
the custom help file by:
help custhelp/name
or by:
custom("help", "name")
Added minor sanity checks the help command's filename.
Added show custom to display custom function information.
Added the contrib help page to give information on how
and where to submit new calc code, modes or custom functions.
Added comment information to value.h about what needs to be
checked or modified when a new value type is added.
Both size(x) and sizeof(x) return information on all value types.
Moved size and sizeof information from func.c and into new file: size.c.
Added custom("devnull") to serve as a do-nothing interface tester.
Added custom("argv" [,arg ...]) to print information about args.
Added custom("sysinfo", "item") to print an internal calc #define
parameter.
The make depend rule also processes the custom/Makefile.
Added xx_max and xx_min for objfuncs.
The max(), min() builtins work for lists.
The following are the changes from calc version 2.10.3t3 to 2.10.3t4.15:
The priority of unary + and - to that of binary + and - when they are
applied to a first or only term. Thus:
-16^-2 == -1/256
-7^2 == -49
-3! == -6
Running ranlib is no longer the default. Systems that need RANLIB
should edit the Makefile and comment back in:
RANLIB=ranlib
Dropped support of SGI r8k.
Added support for the SGI r5k.
Added support for SGI Mips compiler version 7.1 or later.
Removed "random" as a config() option.
Removed CCZPRIME Makefile variable.
Added zsquaremod() back into zmod.c to be used by the Blum-Blum-Shub
generator for the special case of needing x^2 mod y.
Moved the Blum-Blum-Shub code and defines from zrand.c and zrand.h
into zrandom.c and zrandom.h. Now only the a55 generator resides
in zrand.c and zrand.h.
Added random, srandom and randombit help files.
Added random(), srandom() and randombit() builtin functions. The
cryptographically strong random number generator is code complete!
Removed cryrand.cal now that a Blum-Blum-Shub generator is builtin.
Improved the speed of seedrandom.cal. It now uses the 13th
builtin Blum-Blum-Shub seed.
The randmprime.cal script makes use of the Blum-Blum-Shub generator.
Added randombitrun.cal and randomrun.cal calc library files.
These are the Blum-Blum-Shub analogs to the randbitrun.cal
and randrun.cal a55 tests.
Improved hash.c interface to lower level hash functions. The hash
interface does not yet have a func.c interface ... it is still
under test.
Added randombitrun.cal to test the Blum-Blum-Shub generator.
Added calc.h, hash.h, shs.h and value.h to LIB_H_SRC because some
of the libcalc.a files need them.
In the original version, each call to newerror(str) created a new
error-value. Now a new value will be created only if str has not
been used in a previous call to newerror(). In effect, the string
serves to identify the error-value; for example:
return newerror("Non-integer argument");
can be used in one or more functions, some of which may be
repeatedly called, but after it has been called once, it will
always return the same value as if one had initially used the
assignment:
non_integer_argument_error = newerror("Non-integer argument")
and then in each function used:
return non_integer_argument_error;
The new definition of newerror() permits its freer use in cases like:
define foo(a) {
if (!isint(a))
return newerror("Non-integer argument");
...
}
One might say that "new" in "newerror" used to mean being different
from any earlier error-value. Now it means being not one of the
"original" or "old" error-values defined internally by calc.
As newerror() and newerror("") specify no non-null string, it has
been arranged that they return the same as newerror("???").
Added "show errors" command analogous to "show functions" for
user-defined functions. One difference is that whereas the
functions are created by explicit definitions, a new described
error is created only when a newerror(...) is executed.
Fixed macro symbol substitution problem uncovered by HPUX cpp bug in
HVAL and related zrand.h macros.
Added +e to CCMISC for HP-UX users.
Fixed the prompt bug.
Eliminated the hash_init() initialization function.
The 'struct block' has been moved from value.c to a new file: block.h.
Added "blkmaxprint" config value, which limits the octets to print
for a block. A "blkmaxprint" of 0 means to print all octets of a
block, regardless of size. The default is to print only the first
256 octets.
The "blkverbose" determines if all lines, including duplicates
should be printed. If TRUE, then all lines are printed. If false,
duplicate lines are skipped and only a "*" is printed in a style
similar to od. This config value has not meaning if "blkfmt" is
"str". The default value for "blkverbose" is FALSE: duplicate
lines are not printed.
The "blkbase" determines the base in which octets of a block
are printed. Possible values are:
"hexadecimal" Octets printed in 2 digit hex
"hex"
"octal" Octets printed in 3 digit octal
"oct"
"character" Octets printed as chars with non-printing
"char" chars as \123 or \n, \t, \r
"binary" Octets printed as 0 or 1 chars
"bin"
"raw" Octets printed as is, i.e. raw binary
"none"
The default "blkbase" is "hex".
The "blkfmt" determines for format of how block are printed:
"line" print in lines of up to 79 chars + newline
"lines"
"str" print as one long string
"string"
"strings"
"od" print in od-like format, with leading offset,
"odstyle" followed by octets in the given base
"od_style"
"hd" print in hex dump format, with leading offset,
"hdstyle" followed by octets in the given base, followed
"hd_style" by chars or '.' if no-printable or blank
The default "blkfmt" is "hd".
Fixed a bug in coth() when testing acoth using coth(acoth(x)) == x
within the rounding error.
Assignments to matrices and objects has been changed. The assignments in:
A = list(1,2,3,4);
B = makelist(4) = {1,2,3,4};
will result in A == B. Then:
A = {,,5}
will result in A == list(1,2,5,4).
Made minor edits to most help files beginning with a thru d.
Fixed error in using cmdbuf("").
The following are the changes from calc version 2.10.3t0 to 2.10.3t2:
Bumped to version 2.10.3 due to the amount of changes.
Renamed qabs() to qqabs() to avoid conflicts with stdlib.h.
Fixed a casting problem in label.c.
A lot of work was performed on the code generation by Ernest Bowen
<ernie at turing dot une dot edu dot au>. Declarations no longer
need to precede code:
define f(x) {
local i = x^2;
print "i = ":i;
local j = i;
...
}
The scope of a variable extends from the end of the declaration (including
initialization code for the variable) at which it is first created
to the limit given by the following rules:
local variable: to the end of the function being defined
global variable: to the end of the session with calc
static within a function definition: to the first of:
an end of a global, static or local declaration (including
initialization code) with the same identifier
the end of the definition
static at top level within a file: to the first of:
the next static declaration of the identifier at top level
in the file,
the next global declaration of the identifier at top level
in the file or in any function definition in the file,
the next global declaration of the identifier at any level
in a file being read as a result of a "read" command,
the end of the file.
The scope of a top-level global or static variable may be
interrupted by the use of the identifier as a parameter or local or
static variable within a function definition in the file being
read; it is restored (without change of value) after the definition.
For example, The two static variables a and b are created,
with zero value, when the definition is read; a is initialized
with the value x if and when f(x) is first called with a positive
even x, b is similarly initialized if and when f(x) is first called
positive odd x. Each time f(x) is called with positive integer x,
a or b is incremented. Finally the values of the static variables
are assigned to the global variables a and b, and the resulting
values displayed. Immediately after the last of several calls to
f(x), a = 0 if none of the x's have been positive even, otherwise
a = the first positive even x + the number of positive even x's,
and b = 0 if none of the x's have been positive odd, otherwise
b = the first positive odd x + the number of positive odd x's:
define f(x) {
if (isint(x) && x > 0) {
if (iseven(x)) {
static a = x;
a++;
} else {
static b = x;
b++;
}
}
global a = a, b = b;
print "a =",a,"b =",b;
}
Fixed some faults in the handling of syntax errors for the matrix
and object creation operators mat and obj. In previous versions of calc:
mat; <- Bad dimension 0 for matrix
mat A; <- Bad dimension 0 for matrix
global mat A; <- Bad dimension 0 for matrix
mat A[2], mat B[3] <- Semicolon expected
global mat A[2], mat B[3] <- Bad syntax in declaration statement
Now:
this statement has the same effect as
-------------- ----------------------
mat A[2], B[3] (A = mat[2]), B[3]
global mat A[2], B[3] global A, B; A = mat[2]; B = mat[3];
Initialization remains essentially as before except that for objects,
spaces between identifiers indicate assignments as in simple variable
declarations. Thus, after:
obj point {x,y};
obj point P, Q R = {1,2}
P has {0,0}, Q and R have {1,2}. In the corresponding expression with
matrices commas between identifiers before the initialization are ignored.
For example:
this statement has the same effect as
-------------- ----------------------
mat A, B C [2] = {1,2} A = B = C = (mat[2] = {1,2})
One can also do things like:
L = list(mat[2] = {1,2}, obj point = {3,4}, mat[2] = {5,6})
A = mat[2,2] = {1,2,3,4}^2
B = mat[2,2] = {1,2,3,4} * mat[2,2] = {5,6,7,8}
where the initialization = has stronger binding than the assignment = and
the * sign.
Matrices and objects can be mixed in declarations after any simple
variables as in:
global a, b, mat A, B[2] = {3,4}, C[2] = {4,5}, obj point P = {5,6}, Q
Fixed some bugs related to global and static scoping. See the
5200 regress test and lib/test5200.cal for details.
Optimized opcode generator so that functions defined using '=' do not
have two unreached opcodes. I.e.,:
define f(x) = x^2
show opcodes f
Also unreachable opcodes UNDEF and RETURN are now not included at
the end of any user-defined function.
Changed the "no offset" indicator in label.c from 0 to -1; this
permits goto jumps to the zero opcode position.
Changed the opcode generation for "if (...)" followed by
"break", "continue", or "goto", so that only one jump opcode is
required.
A label can now be immediately by a right-brace. For example:
define test_newop3(x) {if (x < 0) goto l132; ++x; l132: return x;}
The LONG_BITS make variable, if set, will force the size of a long
as well as forcing the USB8, SB8, USB16, SB16, USB32, SB32,
HAVE_B64, USB64, SB64, U(x) and L(x) types. If the longbits
program is given an arg (of 32 or 64), then it will output
based on a generic 32 or 64 bit machine where the long is
the same size as the wordsize.
Fixed how the SVAL and HVAL macros were formed for BASEB==16 machines.
Dropped explicit Makefile support for MIPS r8k since these processors
no longer need special compiler flags.
SGI 6.2 and later uses -xansi.
The following are the changes from calc version 2.10.2t33 to 2.10.2t34:
Fixed a bug related to fact().
Thanks to Ernest Bowen <ernie at turing dot une dot edu dot au>,
for two or three arguments,
search(x, val, start);
rsearch(x, val, start);
and for matrix, list or association x:
search(f, str, start);
rsearch(f, str, start);
for a file stream f open for reading, behave as before except for a few
differences:
(1) there are no limits on the integer-valued start.
(2) negative values of start are interpreted as offsets from the size of
x and f. For example,
search(x, val, -100)
searches the last 100 elements of x for the first i for which
x[[i]] = val.
(3) for a file f, when start + strlen(str) >= size(f) and
search(f, str, start) returns null, i.e. str is
not found, the file position after the search will be
size(f) - strlen(str) + 1
rather than size(f).
For four arguments:
search(a, b, c, d)
rsearch(a, b, c, d),
a has the role of x or f, and b the role of val or str as described
above for the three-argument case, and for search(), c is
essentially "start" as before, but for rsearch() is better for c
and d to be the same as for search(). For a non-file case, if:
0 <= c < d <= size(a),
the index-interval over which the search is to take place is:
c <= i < d.
If the user has defined a function accept(v,b), this is used rather
than the test v == b to decide for matrix, list, or association
searches when a "match" of v = a[[i]] with b occurs. E.g. after:
define accept(v,b) = (v >= b);
then calling:
search(a, 5, 100, 200)
will return, if it exists, the smallest index i for which
100 <= i < 200 and a[[i]] >= 5. To restore the effect of
the original "match" function, one would then have to:
define accept(v,b) == (v == b).
Renamed the calc symbol BYTE_ORDER to CALC_BYTE_ORDER in order
to avoid conflict.
Added beer.cal and hello.cal lib progs in support of: :-)
http://www.ionet.net/~timtroyr/funhouse/beer.html
http://www.latech.edu/~acm/HelloWorld.shtml
The following are the changes from calc version 2.10.2t25 to 2.10.2t32:
Eliminated use of VARARG and <varargs.h>. Calc supports only
<stdarg.h>. The VARARGS Makefile variable has been eliminated.
Source is converted to ANSI C. In particular, functions
will now have ANSI C style args. Any comments from old K&R
style args have been moved to function comment section.
Removed prototype.h. The PROTO() macro is no longer needed
or supported.
Added mfactor.cal to find the smallest factor of a Mersenne number.
The built .h file: have_times.h, determines if the system has
<time.h>, <times.h>, <sys/time.h> and <sys/times.h>.
Because shs.c depends on HASHFUNC, which in turn depends on
VALUE, shs.o has been moved out of libcalc.a. For the same
reasons, hash.h and shs.h are not being installed into
the ${LIBDIR} for now.
A number of the regression tests that need random numbers now
use different seeds.
Fixes for compiling under BSDI's BSD/OS 2.0. Added a Makefile
section for BSD/OS.
Added a Makefile compile section for Dec Alpha without gcc ...
provides a hack-a-round for Dec Alpha cc bug.
Minor comment changes to lucas.cal.
Added pix.cal, a slow painful but interesting way to compute pix(x).
Confusion over the scope of static and global values has been reduced
by a patch from Ernest Bowen <ernie at turing dot une dot edu dot au>.
The change introduced by the following patch terminates the
scope of a static variable at any static declaration with the
same name at the same level, or at any global declaration with
the same name at any level. With the example above, the scope
of the static "a" introduced in the third line ends when the
"global a" is read in the last line. Thus one may now use the
same name in several "static" areas as in:
; static a = 10;
; define f(x) = a + x;
; static a = 20;
; define g(x) = a + x;
; global a;
The first "a" exists only for the definition of f(); the second
"a" only for the definition of g(). At the end one has only
the global "a".
Ending the scope of a static variable in this way is consistent
with the normal use of static variables as in:
; static a = 10;
; define f(x) {static a = 20; return a++ + x;}
; define g(x) = a + x;
; global a;
The scope of the first "a" is temporarily interrupted by the
"static a" in the second line; the second "a" remains active
until its scope ends with the ending of the definition of f().
Thus one ends with g(x) = 10 + x and on successive calls to
f(), f(x) returns 20 + x, 21 + x, etc. With successive "static
a" declarations at the same level, the active one at any stage
is the most recent; if the instructions are being read from a
file, the scope of the last "static a" ends at the end-of-file.
Here I have assumed that no "global a" is encountered. As
there can be only one global variable with name "a", it seems
to me that its use must end the scope of any static "a". Thus
the changes I introduce are such that after:
; global a = 10;
; define f(x) = a + x;
; static a = 20;
; define g(x) = a + x;
; define h(x) {global a = 30; return a + x;}
; define i(x) = a + x;
g(x) will always return 20 + x, and until h(x) has been called,
f(x) and i(x) will return 10 + x; when h(x) is called, it
returns 30 + x and any later call to f(x) or i(x) will return
30 + x. It is the reading of "global a" in the definition of
h() that terminates the scope of the static a = 20, so that the
"a" for the last line is the global variable defined in the
first line. The "a = 30" is executed only when h() is called.
Users who find this confusing might be well advised to use
different names for different variables at the same scope level.
The other changes produced by the patch are more straightforward,
but some tricky programming was needed to get the possibility of
multiple assignments and what seems to be the appropriate order
of executions and assignments. For example, the order for the
declaration:
global a, b = expr1, c, d = expr2, e, f
will be:
evaluation of expr1;
assignment to b;
evaluation of expr2;
assignment to d;
Thus the effect is the same as for:
a = 0; b = expr1; c = 0; d = expr2; e = 0; f = 0;
The order is important when the same name is used for different
variables in the same context. E.g. one may have:
define f(x) {
global a = 10;
static a = a;
local a = a--;
while (--a > 0)
x++;
return x;
}
Every time this is called, the global "a" is assigned the value
10. The first time it is called, the value 10 is passed on to
the static "a" and then to the local "a". In each later call
the "static a = a" is ignored and the static "a" is one less than
it was in the preceding call. I'm not recommending this style of
programming but it is good that calc will be able to handle it.
I've also changed dumpop to do something recent versions do not do:
distinguish between static and global variables with the same name.
Other changes: commas may be replaced by spaces in a sequence of
identifiers in a declaration. so one may now write:
global a b c = 10, d e = 20
The comma after the 10 is still required. Multiple occurrences
of an identifier in a local declaration are now acceptable as
they are for global or static declarations:
local a b c = 10, a = 20;
does the same as:
local a b c;
a = b = c = 10;
a = 20;
The static case is different in that:
static a b c = 10, a = 20;
creates four static variables, the first "a" having a very short and
useless life.
Added new tests to verify the new assignments above.
Added the builtin test(x) which returns 1 or 0 according as x tests
as true or false for conditions.
Added have_posscl.c which attempts to determine if FILEPOS is
a scalar and defines HAVE_FILEPOS_SCALAR in have_posscl.h
accordingly. The Makefile variable HAVE_POSSCL determines
if have_posscl.c will test this condition or assume non-scalar.
Added have_offscl.c which attempts to determine if off_t is
a scalar and defines HAVE_OFF_T_SCALAR in have_posscl.h
accordingly. The Makefile variable HAVE_OFFSCL determines
if have_offscl.c will test this condition or assume non-scalar.
Reading to EOF leaves you positioned one character beyond
the last character in the file, just like Un*x read behavior.
Calc supports files and offsets up to 2^64 bytes, if the OS
and file system permits.
The following are the changes from calc version 2.10.2t4 to 2.10.2t24:
Added makefile debugging rules:
make chk like a 'make check' (run the regression tests)
except that only a few lines around interesting
(and presumable error messages) are printed.
No output if no errors are found.
make env print important makefile values
make mkdebug 'make env' + version information and a
make with verbose output and printing of
constructed files
make debug 'make mkdebug' with a 'make clobber'
so that the entire make is verbose and
a constructed files are printed
Improved instructions in 'BUGS' section on reporting problems.
In particular we made it easy for people to send in a full
diagnostic output by sending 'debug.out' which is made as follows:
make debug > debug.out
Added -v to calc command line to print the version and exit.
Fixed declarations of memcpy(), strcpy() and memset() in the
case of them HAVE_NEWSTR is false.
Fixed some compile time warnings.
Attempting to rewind a file this is not open generates an error.
Noted conversion problems in file.c in triple X comments.
Some extremely brain dead shells cannot correctly deal with if
clauses that do not have a non-empty else statement. Their
exit bogosity results in make problems. As a work-a-round,
Makefile if clauses have 'else true;' clauses for if statements
that previously did not have an else clause.
Fixed problems where the input stack depth reached the 10 levels.
The show keyword is now a statement instead of a command:
; define demo() {local f = open("foo", "w"); show files; fclose(f);}
; demo()
Added a new trace option for display of links to real and complex
numbers. This is activated by config("trace", 4). The printing of
a real number is immediately followed by "#" and the number of links
to that number; complex numbers are printed in the same except for
having "##" instead of "#". <ernie at turing dot une dot edu dot au>
The number of links for a number value is essentially the number of value
locations at which it is either stored or deemed to be stored. Here a
number value is the result of a reading or evaluation; when the result
is assigned to lvalues, "linking" rather than copying occurs. Different
sets of mutually linked values may contain the same number. For example:
a = b = 2 + 3; x, y = 2 + 3;
a and b are linked, and x and y are linked, but a and x are not linked.
Revised the credits help file and man page. Added archive help
file to indicate where recent versions of calc are available.
The regression test suite output has been changed so that it will
output the same information regardless of CPU performance. In
particular, CPU times of certain tests are not printed. This allows
one to compare the regression output of two different systems easier.
A matrix or object declaration is now considered an expression
and returns a matrix or object of the specified type. Thus one may
use assignments like:
A = mat[2]; /* same as: mat A[2]; */
P = obj point; /* same as: obj point P; */
The obj and mat keywords may be with "local", "global", "static" as in:
local mat A[2];
Several matrices or objects may be assigned or declared in the one
statement, as in:
mat A, B[2], C[3]; /* same as: mat A[2], B[2], C[3] */
except that only one matrix creation occurs and is copied as in:
A = B = mat[2];
Initialization of matrices and objects now occur before assignments:
mat A, B [2] = {1,2}; /* same as: A = B = (mat[2] = {1,2}); */
Missing arguments are considered as "no change" rather than
"assign null values". As in recent versions of calc, the default
value assigned to matrix elements is zero and the default for object
elements is a null value). Thus:
mat A[2] = {1,2};
A = { , 3};
will change the value of A to {1,3}.
If the relevant operation exists for matrices or has been defined for
the type of object A is, the assignment = may be combined with +, -, *,
etc. as in:
A += {3, 4}; /* same as: A[0] += 3; A[1] += 4; */
A += { }; /* same as: A += A; */
In (non-local) declarations, the earlier value of a variable may be
used in the initialization list:
mat A[3]={1,2,3}; mat A[3]={A[2],A[1],A[0]}; /* same as: A={3,2,1} */
Also:
mat A[3] = {1,2,3};
mat A[3] = {A, A, A};
produces a 3-element matrix, each of whose elements is a 3-element matrix.
The notation A[i][j] requires A[i] to be a matrix, whereas B[i,j]
accesses an element in a 2-dimensional matrix. Thus:
B == A[i] implies A[i][j] = B[j]
There is requirement in the use of A[i][j] that the matrices A[i]
for i = 0, 1, ... all be of the same size. Thus:
mat A[3] = {(mat[2]), (mat[3]), (mat[2])};
produces a matrix with a 7-element structure:
A[0][0], A[0][1], A[1][0], A[1][1], A[1][2], A[2][0], A[2][1]
One can initialize matrices and objects whose elements are matrices
and/or objects:
obj point {x,y}
obj point P;
obj point A = {P,P};
or:
obj point {x,y};
obj point P;
mat A[2] = {P,P};
A = {{1,2}, {3,4}};
The config("trace", 8) causes opcodes of newly defined functions
are displayed. Also show can now show the opcodes for a function.
For example:
config("trace", 8);
define f(x) = x^2;
show opcodes f;
define g(x,y) {static mat A[2]; A += {x,y}; return A;}
show opcodes g
g(2,3);
show opcodes g;
g(3,4);
The two sequences displayed for f should show the different ways
the parameter is displayed. The third sequence for g should also
show the effects of the static declaration of A.
Fixed a number of compiler warning and type cast problems.
Added a number of new error codes.
Misc bug fixes for gcc2 based Sparc systems.
Fixed a bug in the SVAL() macro on systems with 'long long'
type and on systems with 16 bit HALFs.
Reduced the Makefile CC set:
CCOPT are flags given to ${CC} for optimization
CCWARN are flags given to ${CC} for warning message control
CCMISC are misc flags given to ${CC}
CFLAGS are all flags given to ${CC}
[[often includes CCOPT, CCWARN, CCMISC]]
ICFLAGS are given to ${CC} for intermediate progs
CCMAIN are flags for ${CC} when files with main() instead of CFLAGS
CCSHS are flags given to ${CC} for compiling shs.c instead of CFLAGS
LCFLAGS are CC-style flags for ${LINT}
LDFLAGS are flags given to ${CC} for linking .o files
ILDFLAGS are flags given to ${CC} for linking .o files
for intermediate progs
CC is how the C compiler is invoked
Added more tests to regress.cal.
Port to HP-UX.
Moved config_print() from config.c to value.c so prevent printvalue()
and freevalue() from being unresolved symbols for libcalc.a users.
Calc will generate "maximum depth reached" messages or errors when
reading or eval() is attempted at maximum input depth.
Now each invocation of make is done via ${MAKE} and includes:
MAKE_FILE=${MAKE_FILE}
TOPDIR=${TOPDIR}
LIBDIR=${LIBDIR}
HELPDIR=${HELPDIR}
Setting MAKE_FILE= will cause make to not re-make if the Makefile
is edited.
Added libinit.c which contains the function libcalc_call_me_first().
Users of libcalc.a MUST CALL libcalc_call_me_first BEFORE THEY USE
ANY OTHER libcalc.a functions!
Added support for the SGI IRIX6.2 (or later) Mongoose 7.0 (or later)
C Compiler for the r4k, r8k and r10k. Added LD_NO_SHARED for
non-shared linker support.
Re-ordered and expanded options for the DEBUG make variable.
Make a few minor cosmetic comment changes/fixes in the main Makefile.
Statements such as:
mat A[2][3];
now to the same as:
mat M[3];
mat A[2] = {M, M};
To initialize such an A one can use a statement like
A = {{1,2,3}, {4,5,6}};
or combine initialization with creation by:
mat A[2][3] = {{1,2,3}, {4,5,6}};
One would then have, for example, A[1][0] = 4. Also, the inner braces
cannot be removed from the initialization for A:
mat A[2][3] = {1,2};
results in exactly the same as:
mat A[2] = {1,2};
Added rm("file") builtin to remove a file.
The regress test sections that create files also use rm() to remove
them before and afterward.
Added 4400-4500 set to test new mat and obj initialization rules.
Added 4600 to test version file operations.
Added CCZPRIME Makefile variable to the set for the short term
to work around a CC -O2 bug on some SGI machines.
Added regression test of _ variables and function names.
Added read of read and write, including read and write test for
long strings.
Fixed bug associated with read of a long string variable.
Renumbered some of the early regress.cal test numbers to make room
for more tests. Fixed all out of sequence test numbers. Fixed some
malformed regression reports.
Renamed STSIZE_BITS to OFF_T_BITS. Renamed SWAP_HALF_IN_STSIZE to
SWAP_HALF_IN_OFF_T.
The following are the changes from calc version 2.10.2t1 to 2.10.2t3:
Fixed bug in the regression suite that made test3400 and test4100
fail on correct computations.
The randbit() builtin, when given to argument, returns 1 random bit.
Fixed a bug in longlong.c which made is generate a syntax error
on systems such as the PowerPC where the make variable LONGLONG
was left empty.
By default, the Makefile leaves LONGLONG_BITS empty to allow for
testing of 64 bit data types. A few hosts may have problems with
this, but hopefully not. Such hosts can revert back to LONGLONG_BITS=0.
Improved SGI support. Understands SGI IRIX6.2 performance issues
for multiple architectures.
Fixed a number of implicit conversion from unsigned long to long to avoid
unexpected rounding, sign extension, or loss of accuracy side effects.
Added SHSCC because shs.c contains a large expression that some
systems need help in optimizing.
Added "show files" to display information about all currently open files.
Calc now prevents user-defined function having the same name as a
builtin function.
A number of new error codes (more than 100) have been added.
Added ctime() builtin for date and time as string value.
Added time() builtin for seconds since 00:00:00 1 Jan 1970 UTC.
Added strerror() builtin for string describing error type.
Added freopen() builtin to reopen a file.
Added frewind() builtin to rewind a file.
Added fputstr() builtin to write a null-terminated string to a file.
Added fgetstr() builtin to read a null-terminated string from a file.
Added fgetfield() builtin to read next field from file.
Added strscan() builtin to scan a string.
Added scan() builtin to scan of a file.
Added fscan() builtin to scan of a file.
Added fscanf() builtin to do a formatted scan of a file.
Added scanf() builtin to do a formatted scan of stdin.
Added strscanf() builtin to do a formatted scan of a string.
Added ungetc() builtin to unget character read from a file.
As before, files opened with fopen() will have an id different from
earlier files. But instead of returning the id to the FILEIO slot
used to store information about it, calc simply uses consecutive
numbers starting with 3. A calc file retains its id, even when the
file has been closed.
The builtin files(i) now returns the file opened with id == i
rather than the file with slot number i. For any i <= lastid,
files(i) has at some time been opened. Whether open or closed, it
may be "reopened" with the freopen() command. This write to a file
and then read it, use:
f = fopen("junk", "w")
freopen(f, "r")
To use the same stream f for a new file, one may use:
freopen(f, mode, newfilename)
which closes f (assuming it is open) and then opens newfilename on f.
And as before:
f = fopen("curds", "r")
g = fopen("curds", "r")
results in two file ids (f and g) that refer to the same file
name but with different pointers.
Calc now understands "w+", "a+" and "r+" file modes.
If calc opens a file without a mode there is a "guess" that mode
"r+" will work for any files with small descriptors found to be
open. In case it doesn't (as apparently happens if the file had
not been opened for both reading and reading) the function now also
tries "w" and "r", and if none work, gives up. This avoids having
"open" files with null fp.
The builtin rewind() calls the C rewind() function, but one may
now rewind several files at once by a call like rewind(f1, f2).
With no argument, rewind() rewinds all open files with id >= 3.
The functions fputstr(), fgetstr() have been defined to include the
terminating '\0' when writing a string to a file. This can be done
at present with a sequence of instructions like:
fputs(f, "Landon"); fputc(f, 0);
fputs(f, "Curt"); fputc(f, 0);
fputs(f, "Noll"); fputc(f, 0);
One may now do:
fputstr(f, "Landon", "Curt", "Noll");
and read them back by:
rewind(f);
x = fgetstr(f); /* returns "Landon" */
y = fgetstr(f); /* returns "Curt" */
z = fgetstr(f); /* returns "Noll" */
The builtin fgetfield() returns the next field of non-whitespace
characters.
The builtins scan(), fscan(), strscan() read tokens (fields of
non-whitespace characters) and evaluates them. Thus:
global a,b,c;
strscan("2+3 4^2\n c=a+b", a, b, 0);
results in a = 5, b = 16, c = 21
The functions scanf, fscanf, strscanf behave like the C functions
scanf, fscanf, sscanf. The conversion specifiers recognized are "%c",
"%s", "%[...]" as in C, with the options of *, width-specification,
and complementation (as in [^abc]), and "%n" for file-position, and
"%f", "%r", "%e", "%i" for numbers or simple number-expressions - any
width-specification is ignored; the expressions are not to include any
white space or characters other than decimal digits, +, -, *, /, e, and i.
E.g. expressions like 2e4i+7/8 are acceptable.
The builtin size(x) now returns the size of x if x is an open file
or -1 if x is a file but not open. If s is a string, size(s) returns
characters in s.
Added builtin access("foo", "w") returns the null value if a file
"foo" exists and is writable.
Some systems has a libc symbolic qadd() that conflicted with calc's
qadd function. To avoid this, qadd() has been renamed to qqadd().
The calc error codes are produced from the calcerr.tbl file.
Instead of changing #defines in value.h, one can not edit calcerr.tbl.
The Makefile builds calcerr.h from this file.
Calc error codes are now as follows:
<0 invalid
0 .. sys_nerr-1 system error ala C's errno values
sys_nerr .. E__BASE-1 reserved for future system errors
E__BASE .. E__HIGHEST calc internal errors
E__HIGHEST+1 .. E_USERDEF-1 invalid
E_USERDEF .. user defined errors
Currently, E__BASE == 10000 and E_USERDEF == 20000. Of course,
sys_nerr is system defined however is likely to be < E__BASE.
Renamed CONST_TYPE (as defined in have_const.h) to just CONST.
This symbol will either be 'const' or an empty string depending
on if your compiler understands const.
CONST is beginning to be used with read-only tables and some
function arguments. This allows certain compilers to better
optimize the code as well as alerts one to when some value
is being changed inappropriately. Use of CONST as in:
int foo(CONST int curds, char *CONST whey)
while legal C is not as useful because the caller is protected
by the fact that args are passed by value. However, the
in the following:
int bar(CONST char *fizbin, CONST HALF *data)
is useful because it calls the compiler that the string pointed
at by 'fizbin' and the HALF array pointer at by 'data' should be
treated as read-only.
The following are the changes from calc version 2.10.1t21 to 2.10.2t0:
Bumped patch level 2.10.2t0 in honor of having help files for
all builtin functions. Beta release will happen at the end of
the 2.10.2 cycle!!!
Fewer items listed in BUGS due to a number of bug fixes.
Less todo in the help/todo file because more has already been done. :-)
All builtin functions have help files! While a number need cleanup
and some of the LIMITS, LIBRARY and SEE ALSO sections need fixing
(or are missing), most of it is there. A Big round of thanks goes to
<ernie at turing dot une dot edu dot au> for his efforts in initial
write-ups for many of these files!
The recognition of '\' as an escape character in the format argument
of printf() has been dropped. Thus:
printf("\\n");
will print the two-character string "\n" rather than the a
one-character carriage return. <ernie at turing dot une dot edu dot au>
Missing args to printf-like functions will be treated as null values.
The scope of of config("fullzero") has been extended to integers,
so that for example, after config("mode","real"), config("display", 5),
config("fullzero", 1), both:
print 0, 1, 2;
printf("%d %d %d\n", 0, 1, 2);
print:
.00000 1.00000, 2.00000
The bug which caused calc to exit on:
b = "print 27+"
eval(b)
has been fixed. <ernie at turing dot une dot edu dot au>
Fixed bugs in zio.c which caused eval(str(x)) == x to fail
in non-real modes such as "oct". <ernie at turing dot une dot edu dot au>
The following:
for (i = 1; i < 10; i++) print i^2,;
now prints the same as:
for (i = 1; i < 10; i++) print i^2,;
The show globals will print '...' in the middle of large values.
<ernie at turing dot une dot edu dot au>
The param(n) builtin, then n > 0, returns the address rather than
the value of the n-th argument to save time and memory usage. This
is useful when a matrix with big number entries is passed as an arg.
<ernie at turing dot une dot edu dot au>
The param(n) builtin, then n > 0, may be used as an lvalue:
; define g() = (param(2) = param(1));
; define h() = (param(1)++, param(2)--);
; u = 5
; v = 10
; print g(u, &v), u, v;
5 5 5
; print h(&u, &v), u, v;
5 6 4
Missing args now evaluate to null as in:
A = list(1,,3)
B = list(,,)
mat C[] = {,,}
mat D[] = { }
The following are the changes from calc version 2.10.1t20 to 2.10.1t20:
Changes made in preparation for Blum Blum Shub random number generator.
REDC bug fixes: <ernie at turing dot une dot edu dot au>
Fixed yet another bug in zdiv which occasionally caused the "top digit"
of a nonzero quotient to be zero.
Fixed a bug in zredcmul() where a rarely required "topdigit" is
sometimes lost rather than added to the appropriate carry.
A new function zredcmodinv(ZVALUE z, ZVALUE *res) has been defined
for evaluating rp->inv in zredcalloc(). <ernie at turing dot une
dot edu dot au>
New functions zmod5(ZVALUE *zp) and zmod6(ZVALUE z, ZVALUE *res)
have been defined to give O(N^1.585)-runtime evaluation of z % m
for large N-word m. These require m and BASE^(2*N) // m to have
been stored at named locations lastmod, lastmodinv. zmod5() is
essentially for internal use by zmod6() and zpowermod(). <ernie at
turing dot une dot edu dot au>
Changes to rcmul(x,y,m) so that the result is always in [0, m-1].
<ernie at turing dot une dot edu dot au>
Changes to some of the detail of zredcmul() so that it should run slightly
faster. Also changes to zredcsq() in the hope that it might achieve
something like the improvement in speed of x^2 compared with x * x.
<ernie at turing dot une dot edu dot au>
A new "bignum" algorithm for evaluating pmod(x,k,m) when
N >= config("pow2"). For the multiplications and squaring
modulo m, or their equivalent, when N >= config("redc2"),
calc has used evaluations corresponding to rcout(x * y, m),
for which the runtime is essentially that of three multiplications.
<ernie at turing dot une dot edu dot au>
Yet more additions to the regress.cal test suite.
Fixed some ANSI-C compile nits in shs.c and quickhash.c.
Plugs some potential memory leaks in definitions in func.c.
Expressions such as qlink(vals[2]) in some circumstances are
neither qfreed nor returned as function values.
<ernie at turing dot une dot edu dot au>
The nextcand() and prevcand() functions handle modval, modulus
and skip by using ZVALUE rather than ZVALUE * and dropping
the long modulus, etc. <ernie at turing dot une dot edu dot au>
Changed a couple of occurrences of itoq(1) or itoq(0) to &_qone_
and &_qzero_. <ernie at turing dot une dot edu dot au>
In definition of f_primetest, changed ztolong(q2->num) to ztoi(q2->num)
so that the sign of count in ptest(n, count, skip) is not lost; and
ztolong(q3->num) to q3->num so that skip can be any integer.
<ernie at turing dot une dot edu dot au>
In zprime.c, in definition of small_factor(), adds "&& *tp != 1" to
the exit condition in the for loop so that searching for a factor
will continue beyond the table of primes, as required for e.g.
factor(2^59 - 1). <ernie at turing dot une dot edu dot au>
Changed zprimetest() so that skip in ptest(n, count, skip)
determines the way bases for the tests are selected. Neg values of
n are treated differently. When considering factorization,
primeness, etc. one is concerned with equivalence classes which for
the rational integers are {0}, {-1, 1}, {-2, 2}, etc. To refer to
an equivalence class users may use any of its elements but when
returning a value for a factor the computer normally gives the
non-negative member. The same sort of thing happens with integers
modulo an integer, with fractions, etc., etc. E.g. users may refer
to 3/4 as 6/8 or 9/12, etc. A simple summary of the way negative n
is treated is "the sign is ignored". E.g. isprime(-97) and
nextprime(-97) now return the same as isprime(97) and nextprime(97).
<ernie at turing dot une dot edu dot au>
The following are the changes from calc version 2.10.1t11 to 2.10.1t19:
Added many more regression tests to lib/regress.cal. Some
due to <ernie at turing dot une dot edu dot au>.
Added many help files, most due to <ernie at turing dot une dot edu dot au>.
Fixed exp() and ln() so that when they return a complex value with
a zero imaginary component, isreal() is true. <ernie at turing dot
une dot edu dot au>
Fixed cast problem in byteswap.c. <ernie at turing dot une dot edu dot au>
Fixed memory leak problem where repeated assignments did not
free the previous value. <ernie at turing dot une dot edu dot au>
Complex number ordering/comparison has been changed such that:
a < b implies a + c < b + c
a < b and c > 0 implies a * c < b * c
a < b implies -a > -b
To achieve a "natural" partial ordering of the complex numbers
with the above properties, cmp(a,b) for real or complex numbers
may be considered as follows:
cmp(a,b) = sgn(re(a) - re(b)) + sgn(im(a) - im(b)) * 1i
The cmp help file has been updated.
Change HASH type to QCKHASH. The HASH type is a name better suited
for the upcoming one-way hash interface.
Added the CONFIG type; a structure containing all of the configuration
values under the control of config(). Added V_CONFIG data type.
The call config("all") returns a V_CONFIG. One may now save/restore
the configuration state as follows:
x = config("all")
...
config("all",x)
Added two configuration aliases, "oldstd" (for old backward compatible
standard configuration) and "newstd" (for new style configuration).
One may set the historic configuration state by:
config("all", "oldstd")
One may use what some people consider to be a better but not backward
compatible configuration state by:
config("all", "newstd")
Renamed config.h (configuration file built during the make) to conf.h.
Added a new config.h to contain info on the V_CONFIG type.
Fixed some ANSI C compile warnings.
The show config output is not indented by only one tab, unless
config("tab",0) in which case it is not indented.
The order of show config has been changed to reflect the config
type values.
Changed declaration of sys_errlst in func.c to be char *.
Added quo(x,y,rnd) and mod(x,y,rnd) to give function interfaces
to // and % with rounding mode arguments. Extended these functions
to work for list-values, complex numbers and matrices.
<ernie at turing dot une dot edu dot au>
For integer x, cfsim(x,8) returns 0.
<ernie at turing dot une dot edu dot au>
Fixed config("leadzero"). <ernie at turing dot une dot edu dot au>
Set config("cfsim",8) by default (in "oldstd"). Setup initial idea for
config("all", "newstd") to be the default with the following changes:
display 10
epsilon 1e-10
quo 0
outround 24
leadzero 1
fullzero 1
prompt "; " (allows full line cut/paste)
more ";; " (allows full line cut/paste)
The "newstd" is a (hopefully) more preferred configuration than the
historic default.
The fposval.h file defines DEV_BITS and INODE_BITS giving the
bit size of the st_dev and st_ino stat elements. Also added
SWAP_HALF_IN_DEV and SWAP_HALF_IN_STSIZE.
Added sec(), csc(), cot(), sech(), csch(), coth(), asec(), acsc(),
acot(), asech(), acsch() and acoth() builtins. <ernie at turing dot
une dot edu dot au>
The initmasks() call is no longer needed. The bitmask[] array
is a compiled into zmath.c directly.
Added isconfig(), ishash(), isrand() and israndom() builtins to
test is something is a configuration state, hash state, RAND
state or RANDOM state.
The lib/cryrand.cal library now no longer keeps the Blum prime
factors used to form he Blum modulus. The default modulus has
been expanded to 1062 bits product of two Blum primes.
The function hash_init() is called to initialize the hash function
interface.
Misc calc man page fixes and new command line updates.
Fixed bug related to srand(1).
Cleaned up some warning messages.
All calls to math_error() now have a /*NOTREACHED*/ comment after
them. This allows lint and compiler flow progs to note the jumpjmp
nature of math_error(). Unfortunately some due to some systems
not dealing with /*NOTREACHED*/ comments correctly, calls of the form:
if (foo)
math_error("bar");
must be turned into:
if (foo) {
math_error("bar");
/*NOTREACHED*/
}
The ploy() function can take a list of coefficients. See the
help/poly file. Added poly.c. <ernie at turing dot une dot edu
dot au>
Fixes and performance improvements to det(). <ernie at turing dot
une dot edu dot au>
Renamed atoq() and atoz() to str2q() and str2z() to avoid conflicts
with libc function names.
Fixed use of ${NROFF_ARG} when ${CATDIR} and ${NROFF} are set.
Fixed SWAP_HALF_IN_B64 macro use for Big Endian machines without
long long or with LONGLONG_BITS=0.
Added error() and iserror() to generate a value of a given error type.
See help/error for details. <ernie at turing dot une dot edu dot au>
Added singular forms of help files. For example one can now get
help for binding, bug, change, errorcode and type.
The builtin mmin(x, md) has been changed to return the same as
mod(x, md, 16). The old mmin(x, md) required md to be a positive
integer and x to be an integer. Now md can be any real number; x
can be real, complex, or a matrix or list with real elements, etc.
<ernie at turing dot une dot edu dot au>
The builtin avg(x_1, x_2, ...) has been changed to accept list-valued
arguments: a list x_i contributes its elements to the list of
items to be averaged. E.g. avg(list(1,2,list(3,4)),5) is treated
as if it were avg(1,2,3,4,5). If an error value is encountered in
the items to be averaged, the first such value is returned. If the
number of items to be averaged is zero, the null value is returned.
<ernie at turing dot une dot edu dot au>
The builtin hmean(x_1, x_2, ...) has been changed to admit types
other than real for x_1, x_2, ...; list arguments are treated in
the same way as in avg(). <ernie at turing dot une dot edu dot au>
The builtin eval(str) has been changed so that when str has a
syntax error, instead of call to math_error(), an error value is
returned. <ernie at turing dot une dot edu dot au>
The old frem(x,y) builtin returned the wrong value when y was a power of
2 greater than 2, e.g. f(8,4) is returned as 4 when its value should be 2.
This has been fixed by a small change to the definition of zfacrem().
Calc used to accept with no warning or error message, gcdrem(0,2) or
generally gcdrem(0,y) for any y with abs(y) > 1, but then went into an
infinite loop. This has been fixed by never calling zfacrem() with zero x.
Both frem(x,y) and gcdrem(x,y) now reject y = -1, 0 or 1 as errors. For
nonzero x, and y == -1 or 1, defining frem(x,y) and gcdrem(x,y) to equal
abs(x) is almost as natural as defining x^0 to be 1. Similarly, if x is
not zero then gcdrem(x,0) == 1. <ernie at turing dot une dot edu dot au>
Plugged some more memory leaks.
Fixed bug related randbit(x) skip (where x < 0).
Added seedrandom.cal to help users use the raw random() interface well.
Made extensive additions and changes to the rand() and random() generator
comments in zrand.c.
Fixed a bug in fposval.c that prevented calc from compiling on systems
with 16 bit device and/or inodes. Fixed error messages in fposval.c.
Fixed bug that would put calc into an infinite loop if it is ran
with errors in startup files (calc/startup, .calcrc).
Ha Lam <hl at kuhep5 dot phsx dot ukans dot edu>
The following are the changes from calc version 2.10.0t13 to 2.10.1t10:
Added SB8, USB8, SB16, USB16, SB32, USB32 typedefs, determined by
longbits and declared in longbits.h, to deal with 8, 16 and 32 bit
signed and unsigned values.
The longbits.h will define HAVE_B64 with a 64 bit type (long or
longlong) is available. If one is, then SB64 and US64 typedefs
are declared.
The U(x) and L(x) macros only used to define 33 to 64 bit signed
and unsigned constants. Without HAVE_B64, these macros cannot
be used.
Changed the way zmath.h declares types such as HALF and FULL.
Changed the PRINT typedef.
The only place where the long long type might be used is in longlong.c
and if HAVE_LONGLONG, in longbits.h if it is needed. The only place
were a long long constant might be used is in longlong.c. Any
long long constants, if HAVE_LONGLONG, are hidden under the U(x) and
L(x) macros on longbits.h. And of course, if you don't have long long,
then HAVE_LONGLONG will NOT be defined and long long's will not be used.
The longlong.h file is no longer directly used by the main calc source.
It only comes into play when compiling the longbits tool.
Added config("prompt") to change the default interactive prompt ("> ")
and config("more") to change the default continuation prompt (">> ").
Makefile builds align32.h with determines if 32 bit values must always
be aligned on 32 bit boundaries.
The CALCBINDINGS file is searched for along the CALCPATH. The Makefile
defines the default CALCBINDINGS is "bindings" (or "altbind") which
is now usually found in ./lib or ${LIBDIR}.
Per Ernest Bowen <ernie at turing dot une dot edu dot au>, an optional
third argument was added sqrt() so that in sqrt(x,y,z), y and z have
essentially the same role as in appr(x,y,z) except that of course
what is being approximated is the sqrt of x. Another difference is
that two more bits of z are used in sqrt: bit 5 gives the option of
exact results when they exist (the value of y is then ignored) and
bit 6 returns the non-principal root rather than the principal value.
If commands are given on the command line, leading tabs are not
printed in output. Giving a command on the command line implies
that config("tab",0) was given.
Pipe processing is enabled by use of -p. For example:
echo "print 2^21701-1, 2^23209-1" | calc -p | fizzbin
In pipe mode, calc does not prompt, does not print leading tabs
and does not print the initial version header.
Calc will now form FILE objects for any open file descriptor > 2
and < MAXFILES. Calc assumes they are available for reading
and writing. For example:
$ echo "A line of text in the file on descriptor 5" > datafile
$ calc 5<datafile
C-style arbitrary precision calculator (version 2.10.1t3)
[Type "exit" to exit, or "help" for help.]
; files(5)
FILE 5 "descriptor[5]" (unknown_mode, pos 0)
; fgetline(files(5))
"A line of text in the file on descriptor 5"
The -m mode flag now controls calc's ability to open files
and execute programs. This mode flag is a single digit that
is processed in a similar way as the octal chmod values:
0 do not open any file, do not execute progs
1 do not open any file
2 do not open files for reading, do not execute progs
3 do not open files for reading
4 do not open files for writing, do not execute progs
5 do not open files for writing
6 do not execute any program
7 allow everything (default mode)
Thus if one wished to run calc from a privileged user, one might
want to use -m 0 in an effort to make calc more secure.
The -m flags for reading and writing apply on open.
Files already open are not effected. Thus if one wanted to use
the -m 0 in an effort to make calc more secure, but still be
able to read and write a specific file, one might do:
calc -m 0 3<a.file 4>b.file
NOTE: Files presented to calc in this way are opened in an unknown
mode. Calc will try to read or write them if directed.
The maximum command line size it MAXCMD (16384) bytes. Calc objects to
command lines that are longer.
The -u flag cause calc to un-buffer stdin and stdout.
Added more help files. Improved other help files.
Removed trailing blanks from files.
Removed or rewrite the formally gross and disgusting hacks for
dealing with various sizes and byte sex FILEPOS and off_t types.
Defined ilog2(x), ilog10(x), ilog(x,y) so that sign of x is ignored,
e.g. ilog2(x) = ilog2(abs(x)).
The sixth bit of rnd in config("round", rnd) and config("bround", rnd)
is used to specify rounding to the given number of significant
digits or bits rather than places, e.g. round(.00238, 2, 32)
returns .0023, round(.00238, 2, 56) returns .0024.
The following are the changes from calc version 2.9.3t11 to 2.10.0t12:
The default ${LIBDIR}/bindings CALCBINDINGS uses ^D for editing.
The alternate CALCBINDINGS ${LIBDIR}/altbind uses ^D for EOF.
The Makefile CC flag system has been changed. The new CC flag system
includes:
CCMAIN are flags for ${CC} when compiling only files with main()
CCOPT are flags given to ${CC} for optimization
CCWARN are flags given to ${CC} for warning message control
CCMISC are misc flags given to ${CC}
CNOWARN are all flags given to ${CC} except ${CCWARN} flags
CFLAGS are all flags given to ${CC}
ICFLAGS are given to ${CC} for intermediate progs
LCFLAGS are CC-style flags for ${LINT}
LDFLAGS are flags given to ${CC} for linking .o files
ILDFLAGS are given to ${CC} for linking .o's for intermediate progs
CC is how the C compiler is invoked
The syntax error:
print a[3][[4]]
used to send calc into a loop printing 'missing expression'. This
has been fixed.
Added config("maxerr") and config("maxerr",val) to control the
maximum number of errors before a computation is aborted.
Removed regress.cal test #952 and #953 in case calc's stdout or
stderr is re-directed to a non-file by some test suite.
Changed how <stdarg.h>, <varags.h> or simulate stdarg is determined.
Changed how vsprintf() vs sprintf() is determined. The args.h file
is created by Makefile to test which combination works. Setting
VARARG and/or HAVE_VSPRINTF in the Makefile will alter these tests
and direct a specific combination to be used. Removed have_vs.c,
std_arg.h and try_stdarg.c. Added have_stdvs.c and have_varvs.c.
Added 3rd optional arg to round(), bround(), appr() to specify the type of
rounding to be used.
Moved fnvhash.c to quickhash.c.
Fixed a bug in appr rounding mode when >= 16.
Added test2600.cal and test2700.cal. They are used by the regress.cal
to provide a more extensive test suite for some builtin numeric
functions.
The following are the changes from calc version 2.9.3t9.2+ to 2.9.3t10:
Added many help files for builtin functions and some symbols.
More help files are needed, see help/todo.
Removed the calc malloc code. Calc now uses malloc and free to
manage storage since these implementations are often written to
work best for the local system. Removed CALC_MALLOC code and
Makefile symbol. Removed alloc.c.
Added getenv("name"), putenv("name=val") and putenv("name, "val")
builds for environment variable support thanks to "Dr." "D.J." Picton
<dave at aps2 dot ph dot bham dot ac dot uk>.
Added system("shell command") builtin to execute shell commands,
thanks to "Dr." "D.J." Picton <dave at aps2 dot ph dot bham dot ac dot uk>.
Added isatty(fd) builtin to determine if fd is attached to a tty
thanks to "Dr." "D.J." Picton <dave at aps2 dot ph dot bham dot ac dot uk>.
Added cmdbuf() builtin to return the command line executed by calc's
command line args thanks to "Dr." "D.J." Picton <dave at aps2 dot
ph dot bham dot ac dot uk>.
Added strpos(str1,str2) builtin to determine the first position where
str2 is found in str1 thanks to "Dr." "D.J." Picton
<dave at aps2 dot ph dot bham dot ac dot uk>.
Fixed bug that caused:
global a,b,c (newline with no semicolon)
read test.cal
the read command to not be recognized.
The show command looks at only the first 4 chars of the argument so
that:
show globals
show global
show glob
do the same thing.
Added show config to print the config values and parameters thanks
to Ernest Bowen <ernie at turing dot une dot edu dot au>.
Added show objtypes to print the defined objects thanks to Ernest Bowen
<ernie at turing dot une dot edu dot au>.
Added more builtin function help files.
Fixed the 3rd arg usage of the root builtin.
Expanded the regress.cal regression test suite.
Fixed -- and ++ with respect to objects and assignment (see the 2300
series in regress.cal).
Added isident(m) to determine if m is an identity matrix.
The append(), insert() and push() builtins can now append between
1 to 100 values to a list.
Added reverse() and join() builtins to reverse and join lists
thanks to Ernest Bowen <ernie at turing dot une dot edu dot au>.
Added sort() builtin to sort lists thanks to Ernest Bowen
<ernie at turing dot une dot edu dot au>.
Added head(), segment() and tail() builtins to return the head,
middle or tail of lists thanks to Ernest Bowen <ernie at turing dot
une dot edu dot au>.
Added more and fixed some help files.
The builtin help file is generated by the help makefile. Thus it will
reflect the actual calc builtin list instead of the last time someone
tried to update it correctly. :-)
Fixed non-standard void pointer usage.
Fixed base() bug with regards to the default base.
Renamed MATH_PROTO() and HIST_PROTO() to PROTO(). Moved PROTO()
into prototype.h.
Fixed many function prototypes. Calc does not declare functions
as static in one place and extern in another. Where reasonable
function prototypes were added. Several arg mismatch problems
were fixed.
Added support for SGI MIPSpro C compiler.
Changes the order that args are declared to match the order
of the function. Some source tools got confused when:
arg order did not match as in:
void
funct(foo,bar)
int bar; /* this caused a problem */
char *foo; /* even though it should not! */
{
}
The following are the changes from calc version 2.9.3t8 to 2.9.3t9.2:
Use of the macro zisleone(z) has been clarified. The zisleone(z) macro
tests if z <= 1. The macro zisabsleone(z) tests of z is 1, 0 or -1.
Added zislezero(z) macro. Bugs are related to this confusion have
been fixed.
Added zge64b(z) macro to zmath.h.
Added the macro zgtmaxufull(z) to determine if z will fit into a FULL.
Added the macro zgtmaxlong(z) to determine if z will fit into a long.
Added the macro zgtmaxulong(z) to determine if z will fit into a unsigned
long.
Added the macro ztoulong(z) to convert an absolute value of a ZVALUE to
an unsigned long, or to convert the low order bits of a ZVALUE.
Added the macro ztolong(z) to convert an absolute value of a ZVALUE to
an long, or to convert the low order bits of a ZVALUE.
Some non-ANSI C compilers define __STDC__ to be 0, whereas all ANSI
C compiles define it as non-zero. Code that depends on ANSI C now
uses #if defined(__STDC__) && __STDC__ != 0.
Fixed ptest(a,b) bug where (a mod 2^32) < b. Previously ptest()
incorrectly returned 1 in certain cases.
The second ptest() argument, which is now optional, defaults to 1.
This ptest(x) is the same as ptest(x,1).
Added an optional 3rd argument to ptest(). The 3rd arg tells how many
tests to skip. Thus ptest(a,10) performs the same probabilistic
tests as ptest(a,3) and ptest(a,7,3).
The ptest() builtin by default will determine if a value is divisible
by a trivial prime. Thus, ptest(a,0) will only perform a quick trivial
factor check. If the test count is < 0, then this trivial factor check
is omitted. Thus ptest(a,10) performs the same amount of work as
ptest(a,3) and ptest(a,-7,3) and the same amount of work as
ptest(a,-3) and ptest(a,7,3).
Added nextcand(a[,b[,c]]) and prevcand(a[,b[,c]]) to search for the
next/previous value v > a (or v < a) that passes ptest(v[,b[,c]]).
The nextcand() and prevcand() builtins take the same arguments
as ptest().
Added nextprime(x) and and prevprime(x) return the next and
previous primes with respect to x respectively. As of this
release, x must be < 2^32. With one argument, they will return
an error if x is out of range. With two arguments, they will
not generate an error but instead will return y.
Fixed some memory leaks, particularly those related with pmod().
Fixed some of the array bounds reference problems in domult().
Added a hack-a-round fix for the uninitialized memory reference
problems in zsquare/dosquare.
The LIBRARY file has been updated to include a note about calling
zio_init() first. Also some additional useful macros have been noted.
The lfactor() function returns -1 when given a negative value.
It will not search for factors beyond 2^32 or 203280221 primes.
Performance of lfactor() has been improved.
Added factor(x,y) to look for the smallest factor < min(sqrt(x),y).
Added libcalcerr.a for a math_error() routine for the convince of
progs that make use of libcalc.a. This routine by default will
print an message on stderr and exit. It can also be made to
longjump instead. See the file LIBRARY under ERROR HANDING.
Added isprime() to test if a value is prime. As of this release,
isprime() is limited to values < 2^32. With one argument,
isprime(x) will return an error if x is out of range. With
two arguments, isprime(x,y) will not generate an error but
instead will return y.
Added pix(x) to return the number of primes <= x. As of this
release, x must be < 2^32. With one argument, pix(x) will
return an error if x is out of range. With two arguments,
pix(x,y) will not generate an error but instead will return y.
Fixed the way *.h files are formed. Each file guards against
multiple inclusion.
Fixed numeric I/O on 64 bit systems. Previously the print and
constant conversion routines assumed a base of 2^16.
Added support for 'long long' type. If the Makefile is setup
with 'LONGLONG_BITS=', then it will attempt to detect support
for the 'long long' type. If the Makefile is setup with
'LONGLONG_BITS=64', then a 64 bit 'long long' is assumed.
Currently, only 64 bit 'long long' type is supported.
Use of 'long long' allows one to double the size of the
internal base, making a number of computations much faster.
If the Makefile is setup with 'LONGLONG_BITS=0', then the
'long long' type will not be used, even if the compiler
supports it.
Fixed avg() so that it will correctly handle matrix arguments.
Fixed btrunc() limit.
The ord("string") function can now take a string of multiple
characters. However it still will only operate on the first
character.
Renamed stdarg.h to std_arg.h and endian.h endian_calc.h to
avoid name conflicts with /usr/include on some systems that
have make utilities that are too smart for their own good.
Added additive 55 shuffle generator functions rand(), randbits()
and its seed function srand(). Calling rand(a,b) produces a
random value over the open half interval [a,b). With one arg,
rand(a) is equivalent to rand(0,a). Calling rand() produces
64 random bits and is equivalent to rand(0,2^64).
Calling randbit(x>0) produces x random bits. Calling randbit(skip<0)
skips -skip bits and returns -skip.
The srand() function will return the current state. The call
srand(0) returns the initial state. Calling srand(x), where
x > 0 will seed the generator to a different state. Calling
srand(mat55) (mat55 is a matrix of integers at least 55 elements long)
will seed the internal table with the matrix elements mod 2^64.
Finally calling srand(state) where state is a generator state
also sets/seeds the generator.
The cryrand.cal library has been modified to use the builtin
rand() number generator. The output of this generator is
different from previous versions of this generator because
the rand() builtin does not match the additive 55 / shuffle
generators from the old cryrand.cal file.
Added Makefile support for building BSD/386 releases.
The cmp() builtin can now compare complex values.
Added the errno() builtin to return the meaning of errno numbers.
Added fputc(), fputs(), fgets(), ftell(), fseek() builtins.
Added fsize() builtin to determine the size of an open file.
Supports systems where file positions and offsets are longer than 2^32
byte, longer than long and/or are not a simple type.
When a file file is printed, the file number is also printed:
FILE 3 "/etc/motd" (reading, pos 127)
Added matsum() to sum all numeric values in a matrix.
The following code now works, thanks to a fix by <ernie at turing
dot une dot edu dot au> (Ernest Bowen):
mat A[3] = {1, 2, 3};
A[0] = A;
print A[0];
Also thanks to ernie, calc can process compound expressions
such as 1 ? 2 ? 3 : 4 : 5.
Also^2 thanks to ernie, the = operator is more general:
(a = 3) = 4 (same as a = 3; a = 4)
(a += 3) *= 4 (same as a += 3; a *= 4)
matfill(B = A, 4) (same as B = A; matfill(B, 4);)
Also^3 thanks to ernie, the ++ and -- operators are more general.
a = 3
++(b = a) (a == 3, b == 4)
++++a (a == 5)
(++a)++ == 6 (a == 7)
(++a) *= b (a == 32, b == 4)
Fixed a bug related to calling epsilon(variable) thanks to ernie.
Removed trailing whitespace from source and help files.
Some compilers do not support the const type. The file have_const.h,
which is built from have_const.c will determine if we can or should
use const. See the Makefile for details.
Some systems do not have uid_t. The file have_uid_t.h, which
is built from have_uid_t.c will determine if we can or should
depend on uid_t being typedefed by the system include files.
See the Makefile for details.
Some systems do not have memcpy(), memset() and strchr(). The
file have_newstr.h, which is built from have_newstr.c will
determine if we can or should depend libc providing these
functions. See the Makefile for details.
The Makefile symbol DONT_HAVE_VSPRINTF is now called HAVE_VSPRINTF.
The file have_vs.h, which is built from have_vs.c will determine if
we can or should depend libc providing vsprintf(). See the Makefile
for details.
Removed UID_T and OLD_BSD symbols from the Makefile.
A make all of the upper level Makefile will cause the all rule
of the lib and help subdirs to be made as well.
Fixed bug where reserved keyword used as symbol name caused a core dump.
The following are the changes from calc version 2.9.3t7 to 2.9.3t7:
The 'show' command by itself will issue an error message
that will remind one of the possible show arguments.
(thanks to Ha S. Lam <hl at kuhep4 dot phsx dot ukans dot edu>)
Fixed an ANSI-C related problem with the use of stringindex()
by the show command. ANSI-C interprets "bar\0foo..." as if
it were "bar\017oo...".
Added a cd command to change the current directory.
(thanks to Ha S. Lam <hl at kuhep4 dot phsx dot ukans dot edu>)
Calc will not output the initial version string, startup
message and command prompt if stdin is not a tty. Thus
the shell command:
echo "fact(100)" | calc
only prints the result. (thanks to Ha S. Lam <hl at kuhep4 dot phsx
dot ukans dot edu>)
The zmath.h macro zisbig() macro was replaced with zlt16b(),
zge24b(), zge31b(), zge32b() and zgtmaxfull() which are
independent of word size.
The 'too large' limit for factorial operations (e.g., fact, pfact,
lcmfact, perm and comb) is now 2^24. Previously it depended on the
word size which in the case of 64 bit systems was way too large.
The 'too large' limit for exponentiation, bit position (isset,
digit, ), matrix operations (size, index, creation), scaling,
shifting, rounding and computing a Fibonacci number is 2^31.
For example, one cannot raise a number by a power >= 2^31.
One cannot test for a bit position >= 2^31. One cannot round
a value to 2^31 decimal digit places. One cannot compute
the Fibonacci number F(2^31).
Andy Fingerhut <jaf at dworkin dot wustl dot edu> (thanks!) supplied
a fix to a subtle bug in the code generation routines. The basic
problem was that addop() is sometimes used to add a label to
the opcode table of a function. The addop() function did some
optimization tricks, and if one of these labels happens to be an
opcode that triggers optimization, incorrect opcodes were generated.
Added utoz(), ztou() to zmath.c, and utoq(), qtou() to qmath.c
in preparation for 2.9.3t9 mods.
The following are the changes from calc version 2.9.2 to 2.9.3t7:
Calc can now compile on OSF/1, SGI and IBM RS6000 systems.
A number of systems that have both <varargs.h> and <stdarg.h> do
not correctly implement both types. On some System V, MIPS and DEC
systems, vsprintf() and <stdarg.h> do not mix. While calc will
pass the regression test, use of undefined variables will cause
problems. The Makefile has been modified to look for this problem
and work around it.
Added randmprime.cal which find a prime of the form h*2^n-1 >= 2^x
for some given x. The initial search points for 'h' and 'n'
are selected by a cryptographic pseudo-random generator.
The library script nextprim.cal is now a link to nextprime.cal.
The lib/Makefile will take care of this link and install.
The show command now takes singular forms. For example, the
command 'show builtin' does the same as 'show builtins'. This
allows show to match the historic singular names used in
the help system.
Synced 'show builtin' output with 'help builtin' output.
Fixed the ilog2() builtin. Previously ilog2(2^-20) returned
-21 instead of -20.
The internal function qprecision() has been fixed. The changes
ensure that for any e for which 0 < e <= 1:
1/4 < sup(abs(appr(x,e) - x))/e <= 1/2.
Here 'sup' denotes the least upper bound over values of x (supremum).
Previously calc did: 1/4 <= sup(abs(appr(x,e) - x))/e < 1.
Certain 64 bit processors such as the Alpha are now supported.
Added -once to the READ command. The command:
read -once filename
like the regular READ expect that it will ignore filename if
is has been previously read.
Improved the makefile. One now can select the compiler type. The
make dependency lines are now simple foo.o: bar.h lines. While
this makes for a longer list, it is easier to maintain and will
make future Makefile patches smaller. Added special options for
gcc version 1 & 2, and for cc on RS6000 systems.
Calc compiles cleanly under the watchful eye of gcc version 2.4.5
with the exception of warnings about 'aggregate has a partly
bracketed initializer'. (gcc v2 should allow you to disable
this type of warning with using -Wall)
Fixed a longjmp bug that clobbered a local variable in main().
Fixed a number of cases where local variables or malloced storage was
being used before being set.
Fixed a number of fence post errors resulting in reads or writes
just outside of malloced storage.
A certain parallel processor optimizer would give up on
code in cases where math_error() was called. The obscure
work-a-rounds involved initializing or making static, certain
local variables.
The cryrand.cal library has been improved. Due to the way
the initial quadratic residues are selected, the random numbers
produced differ from previous versions.
The printing of a leading '~' on rounded values is now a config
option. By default, tilde is still printed. See help/config for
details.
The builtin function base() may be used to set the output mode or
base. Calling base(16) is a convenient shorthand for typing
config("mode","hex"). See help/builtin.
The printing of a leading tab is now a config option. This does not
alter the format of functions such as print or printf. By default,
a tab is printed. See help/config for details.
The value atan2(0,0) now returns 0 value in conformance with
the 4.3BSD ANSI/IEEE 754-1985 math library.
For all values of x, x^0 yields 1. The major change here is
that 0^0 yields 1 instead of an error.
Fixed gcd() bug that caused gcd(2,3,1/2) to ignore the 1/2 arg.
Fixed ltol() rounding so that exact results are returned, similar
to the way sqrt() and hypot() round, when they exist.
Fixed a bug involving ilog2().
Fixed quomod(a,b,c,d) to give correct value for d when a is between
0 and -b.
Fixed hmean() to perform the necessary multiplication by the number of
arguments.
The file help/full is now being built.
The man page is not installed by default. One may install either
the man page source or the cat (formatted man) page. See the
Makefile for details.
Added a quit binding. The file lib/bindings2 shows how this new
binding may be used.
One can now do a 'make check' to run the calc regression test
within in the source tree.
The regression test code is now more extensive.
Updated the help/todo list. A BUGS file was added. Volunteers are
welcome to send in patches!
The following are the changes from calc version 2.9.1 to 2.9.1:
Fixed floor() for values -1 < x < 0.
Fixed ceil() for values -1 < x < 0.
Fixed frac() for values < 0 so that int(x) + frac(x) == x.
Fixed wild fetch bug in zdiv, zquo and zmod code.
Fixed bug which caused regression test #719 to fail on some machines.
Added more regression test code.
The following are the changes from calc version 2.9.0 to 2.9.0:
A major bug was fixed in subtracting two numbers when the first
number was zero. The problem caused wrong answers and core dumps.
The following are the changes from calc version 1.27.0 to 2.8.0:
Full prototypes have been provided for all C functions, and are used
if calc is compiled with an ANSI compiler.
Newly defined variables are now initialized to the value of zero instead
of to the null value. The elements of new objects are also initialized
to the value of zero instead of null.
The gcd, lcm, and ismult functions now work for fractional values.
A major bug in the // division for fractions with a negative divisor
was fixed.
A major bug in the calculation of ln for small values was fixed.
A major bug in the calculation of the ln and power functions for complex
numbers was fixed.
A major lack of precision for sin and tan for small values was fixed.
A major lack of precision for complex square roots was fixed.
The "static" keyword has been implemented for variables. So permanent
variables can be defined to have either file scope or function scope.
Initialization of variables during their declaration are now allowed.
This is most convenient for the initialization of static variables.
The matrix definition statement can now be used within a declaration
statement, to immediately define a variable as a matrix.
Initializations of the elements of matrices are now allowed. One-
dimensional matrices may have implicit bounds when initialization is
used.
The obj definition statement can now be used within a declaration
statement, to immediately define a variable as an object.
Object definitions can be repeated as long as they are exactly the same
as the previous definition. This allows the rereading of files which
happen to define objects.
The integer, rational, and complex routines have been made into a
'libcalc.a' library so that they can be used in other programs besides
the calculator. The "math.h" include file has been split into three
include files: "zmath.h", "qmath.h", and "cmath.h".
Following is a list of visible changes to calc from version 1.26.4 to 1.26.4:
Added an assoc function to return a new type of value called an
association. Such values are indexed by one or more arbitrary values.
They are stored in a hash table for quick access.
Added a hash() function which accepts one or more values and returns
a quickly calculated small non-negative hash value for those values.
Following is a list of visible changes to calc from version 1.26.2 to 1.26.4:
Misc fixes to Makefiles.
Misc lint fixes.
Misc portability fixes.
Misc typo and working fixes to comments, help files and the man page.
Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
There is a new emacs-like command line editing and edit history
feature. The old history mechanism has been removed. The key
bindings for the new editing commands are slightly configurable
since they are read in from an initialization file. This file is
usually called /usr/lib/calc/bindings, but can be changed by the
CALCBINDINGS environment variable. All editing code is
self-contained in the new files hist.c and hist.h, which can be
easily extracted and used in other programs.
Two new library files have been added: chrem.cal and cryrand.cal.
The first of these solves the Chinese remainder problem for a set
of modulo's and remainders. The second of these implements several
very good random number generators for large numbers.
A small bug which allowed division by zero was fixed.
A major bug in the mattrans function was fixed.
A major bug in the acos function for negative arguments was fixed.
A major bug in the strprintf function when objects were being printed
was fixed.
A small bug in the library file regress.cal was fixed.
## Copyright (C) 2001-2017,2021-2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## Under source code control: 1993/06/02 18:12:57
## File existed as early as: 1989
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|